Skip to content
A Ruby library that interacts with Snipt.net.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
examples
lib
tests
.gitignore
README.rdoc
rsnipt.gemspec

README.rdoc

rSnipt

Michael Boutros (me@michaelboutros)

Introduction

“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.

Installation

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

Progress

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 Example for Getting Snipts

client = Snipt.new('username', 'password')

client.snipts # => [SniptStruct, SniptStruct, ...]
client.snipts(:ruby) # => [SniptStruct, SniptStruct, ...]

Client Example for Adding Snipts

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

Public Example

snipts = Snipt.snipts # => [SniptStruct, SniptStruct, ...]

CLI Example

# "!!" 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

Contributions

I'm eagerly awaiting any pull requests, and unless your code causes pain to small kittens, it will most likely be accepted.

Usage and Tests

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.

You can’t perform that action at this time.