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.

Installation

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

Authorization

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:

tumblr authorize

This will open up your browser, where you’ll be given instructions to authorize the app, storing your OAuth keys to ~/.tumblr.

Authentication with the cli

Posting

v2 of 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.

Editing

In a matter similar to git commit, 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.


  1. See my post about building animated gifs on the command line

  1. boozeandbitching reblogged this from codingjester
  2. kazupon reblogged this from mwunsch
  3. blakryu reblogged this from tf2-robotic-boogaloo
  4. tf2-robotic-boogaloo reblogged this from squishysound
  5. squishysound reblogged this from famthegeek
  6. avalon-faerie reblogged this from famthegeek
  7. famthegeek reblogged this from mwunsch
  8. spetharrific reblogged this from codingjester
  9. happinessandleather reblogged this from inky and added:
    AWEESOME!!!
  10. inky reblogged this from mwunsch and added:
    The Tumblr Gem v2 by mwunsch
  11. codingjester reblogged this from mwunsch and added:
    release!! Also you’ve made me decide...tumblr client gem :)
  12. mwunsch posted this