The Tumblr Gem v2
Several years ago, I released
tumblr-rb: a library, written in Ruby, for making access to the original Tumblr API simple. As a proof of concept for the library, I built a command line utility to post directly to Tumblr from the command line, using a plaintext format similar to jekyll.
I am tremendously proud to announce tumblr-rb v2.0.0.
This tool allows you to do things like this:
tumblr post my_post.txt
tumblr post path/to/animated.gif
tumblr post spotify:track:6tGtBvK6DezcjbtUxXGyxe
cat data.yml my_post.txt | tumblr --host=mwunsch.tumblr.com
For those that missed v1, the Tumblr Gem allows you to quickly post to Tumblr. Optionally, you can add some additional metadata with YAML front-matter, in a manner similar to Jekyll and other static-site generators. For example, here’s this post.
This update is a complete rewrite of
tumblr. Both the underlying library AND the command line interface are all new, written to wrap [v2 of the Tumblr API] (http://www.tumblr.com/docs/en/api/v2). The new cli provides a ton of new features, and I’m going to focus on those in this post.
If you’re only interested in the command line tool, and are on a Mac using Homebrew, installation is super simple:
brew install https://raw.github.com/mwunsch/tumblr/master/share/tumblr-rb.rb
Otherwise, use RubyGems:
gem install tumblr-rb
v2 of the Tumblr API enforces all authentication through OAuth, and recently deprecated basic auth in v1.
tumblr-rb gets around this by providing a mechanism to authenticate and authorize the command line tool. The first thing you need to do is register an application. Then you’ll boot up the authorization app:
This will open up your browser, where you’ll be given instructions to authorize the app, storing your OAuth keys to
tumblr-rb now allows you to make photo, video, and audio posts by pointing directly to an image, video, or audio file. Posting animated gifs to tumblr completely through the command line is now possible1.
As with the last version,
tumblr accepts STDIN and writes out posts to STDOUT, making it a great unix citizen. See tumblr(1) for more information.
See tumblr(5) for more information about the YAML front-matter to add metadata to your post.
In a matter similar to
tumblr edit will open up your $EDITOR in the foreground for easy post editing. No more typos.
Go forth and tumblr
I love Tumblr’s ease of use and low barrier to posting. I love blogging like a hacker. My desire is to build a tool that matches up these two approaches. I hope you’ll find
tumblr a handy addition to your command line life.
Also, I’m shipping this software in the midst of a hurricane and a state of emergency declared for New York. Now is always the right time to ship.