Plasticx Blog

Capable of being shaped or formed Powered by Obtvse

distribute scripts as gist micro-gems

It's really easy to distribute scripts, not just gems, as gist micro-gems. Since rubygems and bundler can handle complicated dependencies the scripts you distribute can be more advanced than just ten or twenty lines.

I wrote a script to generate an OAuth key and secret for the Tumblr API and I made it available as a micro-gem. It is encapsulated in gist 4577106 To generate your key and secret is as simple as the following:

mkdir /some/working/dir
cd /some/working/dir

wget \
https://gist.github.com/raw/4577106/6bc9befedcd5238ce9f2ee562cace666dece460c/Gemfile

bundle install
bundle exec generate-token

One bit of useful flare is the ability to set the bindir in the gemspec of the microgem to dot "." - the current working directory. This allows bundle exec generate-token to work correctly since github gists don't allow files to be in sub-directories, and the default bindir in rubygems is 'bin/'.

Back to Blog
Real Time Web Analytics