Skip to content

Instantly share code, notes, and snippets.

@mwunsch
Created March 10, 2010 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwunsch/328196 to your computer and use it in GitHub Desktop.
Save mwunsch/328196 to your computer and use it in GitHub Desktop.
---
title: The Tumblr Gem
state: queue
format: markdown
tags: Ruby, Tumblr, Weary
slug: tumblr-rb
---
Last night, I released the [Tumblr gem](http://github.com/mwunsch/tumblr), a command line utility and Ruby library for interacting with Tumblr. Here's what it does:
$ tumblr my_post.txt
That will publish `my_post.txt` to Tumblr. Simple.
You can also give it a URL:
$ tumblr http://mwunsch.github.com/tumblr/tumblr.1.html
That will create a _Link_ post on Tumblr pointing to the `tumblr` manpage.
Or create a _Video_ post by giving it a YouTube or Vimeo URL:
$ tumblr http://www.youtube.com/watch?v=CW0DUg63lqU
Easy publishing to Tumblr on the command line.
## Get Started
You need Ruby and Rubygems installed:
$ gem install tumblr-rb
Read through [`tumblr(1)`](http://mwunsch.github.com/tumblr/tumblr.1.html) to get an idea of what you can do.
## How it works
`tumblr` does a pretty good job of inferring what kind of post you want to make, as shown above, but you can give more options in your document by adding a little bit of [YAML](http://yaml.org) frontmatter, in the style of [Jekyll](http://tom.preston-werner.com/jekyll/). You can do things like specify a post-type, tagging posts, saving posts to your queue, etc. Read more about post formatting in [`tumblr(5)`](http://mwunsch.github.com/tumblr/tumblr.5.html).
## Why?
Most of my Tumblr posts begin life as little notes in [Notational Velocity](http://notational.net/) (combined with [Simplenote](http://simplenoteapp.com/)). I write them in [Markdown](http://daringfireball.net/projects/markdown/), and then copy and paste them into Tumblr.com. It feels tedious. Now, with `tumblr`, I write a post in TextMate and can publish it immediately, with very little effort.
_This_ post began life as a [gist](http://gist.github.com/328196), and was published via the command line with `tumblr`.
The Tumblr gem was created as a kind-of-sort-of proof-of-concept for [Weary](http://github.com/mwunsch/weary), a Ruby library I wrote for simple RESTful web service consumption. Tumblr (the gem), is a robust Ruby wrapper supporting full coverage of the [Tumblr API](http://www.tumblr.com/docs/en/api). The `tumblr` command line tool is a client of the Tumblr Ruby library (and comes packaged with it). I published this post with `tumblr`. In software, this is called ["eating your own dogfood"](http://en.wikipedia.org/wiki/Eating_one's_own_dog_food).
The Tumblr Gem (my more-or-less official name for it; I also sometimes refer to it as "`tumblr-rb`"), is Open Source, available under an MIT License. The source code is available on [GitHub](http://github.com/mwunsch/tumblr).
Follow me on Twitter [@markwunsch](http://twitter.com/markwunsch) and on [Tumblr](http://mwunsch.tumblr.com) for updates on all of my Open Source projects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment