Post to Tumblr from TextMate

Okay, this is harder than it should be, probably because of the new tools, but here’s how to post to Tumblr from OS X / TextMate. Props to this post for getting me upto speed.

Step 1: tumblr-rb – A shell script that lets users post to tumblr from the command line.


sudo gem install tumblr-rb

Had a few path errors at this point and had to dig into configuing the $PATH variable on OSX. Turns out you can add an entry in /etc/paths.d folder so all the shells in OS X accept it and add it to their path. Thanks ServerFault!

Step 2: Specify your tubmlr credentials in a file somewhere in your home folder


cat ~/.tumblrcredentials
email: xyz@email.com
password: trimmed

Note the space between email and the actual address. Not having that can cause tumblr to not accept the login.

Step 3: Fire up textmate’s bundle editor and create a command that lets you publish your post

Go ahead and create a new command in Textmate’s Markdown syntax editing preferences and drop the following text in there:


/Users/teja/.gem/ruby/1.8/bin/tumblr --credentials ~/.tumblrlogin $TM_FILEPATH

I was having issues where the $PATH variable was correctly setup on my Shell, but TextMate was having problems finding the tumblr command. So I’ve specified the direct path to the executable. Replace it with the corresponding path to make it work. Here I deviate from the article I’ve mentioned above as well. In the command, you also need to specify the file name that you want to publish using the $TM_FILEPATH variable. I was getting errors from tumblr about publishing empty blog posts if this is not present. Define a shortcut to publish your post to the blog. I have it set to Ctrl + Cmd + P.

AAND we’re done. A few quirks, but everything’s good to go. You can view the preview of your .mdown file by hitting Ctrl+Alt+Cmd+P. One other tip I have is to save all your posts to a DropBox folder so you can refine them as you go along.

Coming Next: Syntax formatting!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s