Sparrow is a Linux scripting platform to ease the daily scripting jobs and distribution. In this small post I am going to show you how to share simple Bash tasks with the rest of the world.
Install Sparrow
$ sudo yum install curl
$ cpanm -q --notest Sparrow
Create Bash Task
First of all we need Bash plugin:
$ sparrow index update
$ sparrow plg install bash
Then let's create a task. I always forgot how to install Rvm/Ruby so I want a mnemonic command for this:
$ sparrow project create utils
$ sparrow task add utils ruby-rvm-stable bash
$ EDITOR=nano && sparrow task ini utils/ruby-rvm-stable
command: "\curl -sSL https://get.rvm.io | bash -s stable --ruby"
Share Bash Task
First of all you need to get an account at SparrowHub, because you're going to save your task into the account.
Then having set credentials up:
$ cat ~/sparrowhub.json
{
"user" : "melezhik",
"token" : "*****-****-****-*******-*****"
}
Just upload the task with some useful description:
$ sparrow remote task upload utils/ruby-rvm-stable "Install RVM stable with ruby"
By default your tasks are private so it is only you who can see them. Let's take simple step to changes this:
$ sparrow remote task share utils/ruby-rvm-stable
Running Remote Bash Task
Now the rest of the team could enjoy your little nifty task. To do this they only need Sparrow client installed:
$ sparrow remote task run melezhik@utils/ruby-rvm-stable
Community Remote Tasks
To list SparrowHub community remotes task just say this:
$ sparrow remote task public list
Further reading is Sparrow documentation on remotes tasks.
Conclusion
Sparrow enables creation of scripts in easy and fun manner. Or if you want - "Quick and dirty way to develop some useful script and share with others".
Top comments (2)
Hi! Sparrow's support for hosted solutions is limited. Drop me an issue on GH on this and I'll see what can I do to improve this ( should be a big deal as SparrowHub source code is ready to open source, just stored at private GitLab repo )
As workaround you can use gemote Git repositories to host your private sparrow plugins, the example in the paper could be rewritten as:
Create sparrow plugin
Spin up custom Sparrow repository and add a plugin to index
Then you have to add plugin to the custom Sparrow repository:
Use Sparrow plugin
And then end user need just need this:
Sure. Meanwhile here these links:
github.com/melezhik/sparrow#privat... - on Sparrow private plugins
github.com/melezhik/sparrow-nest - custom Sparrow repository indexer
Let me know if anything else you need. I would be glad to adapt Sparrow for users needs.