Michael Boutros (me@michaelboutros)
“Snipt is your collection of frequently used commands or code snippets.” The aim of this library is to provide an easy to use interface for developers to create new applications that can use Snipt. At the same time, a CLI is provided in order to provide extremely easy access to the library’s funtionality. Run ‘snipt –help’ for more information on that.
Currently, GitHub isn’t properly building the gem, so you’ll have to build it manually.
$ git clone git://github.com/michaelboutros/rsnipt.git $ cd rsnipt $ sudo gem build rsnipt.gemspec $ sudo gem install rsnipt
At present, almost all / all functionality of the website is implemented. I say all because it does everything that I would need, but I say almost all because someone else might come along and want something new. If you do want something new, feel free to do it yourself, or send me an email.
client = Snipt.new('username', 'password') client.snipts # => [SniptStruct, SniptStruct, ...] client.snipts(:ruby) # => [SniptStruct, SniptStruct, ...]
client = Snipt.new('username', 'password') ruby_snipt = client.snipts(:ruby).first ruby_snipt.update(:description => 'This is a ruby snippet.', :public => true) # true on success, false otherwise ruby_snipt.destroy # true on success, false otherwise
snipts = Snipt.snipts # => [SniptStruct, SniptStruct, ...]
# "!!" is the last command that was executed. You will be prompted to enter your username and password, which is # stored for future use. You can flush your credentials from the 'user' command. $ snipt add "ssh user@site.com -p 1234" -d 'ssh-login' -t "shell, site.com" -l text -p false # Will execute the command that you just created. This is much more useful for longer commands. $ snipt ssh-login
I’m eagerly awaiting any pull requests, and unless your code causes pain to small kittens, it will most likely be accepted.
For usage examples, just browse the source until the full docs are written. As for tests, I haven’t found any way of testing libraries that scrape websites. If anyone has any suggestions, feel free to put them forth.