This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
## WP2TUMBLR: WordPress 2 Tumblr Importing tool | |
## | |
## Usage: wp2tumblr [OPTION] WORDPRESS_XML_FILE | |
## | |
## Import the WORDPRESS_XML_FILE to a Tumblr blog. | |
## Provide `--group` option to publish to a group. | |
## This could take a long time... | |
## | |
## To install, download the script and chmod to 755. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
## TumblrPurge: Destroy everything. | |
## | |
## *************WARNING************* | |
## | |
## USE THIS SCRIPT AT YOUR OWN RISK! | |
## I TAKE NO RESPONSIBILITY. | |
## | |
## This will destroy every Tumblr post. | |
## There is no undo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
## TumblrBak: Gets posts. | |
## | |
begin | |
require 'optparse' | |
require 'rubygems' | |
require 'tumblr' | |
require 'highline/import' | |
rescue LoadError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):005:0> m = mark.to_h | |
=> {:fn=>"Mark Wunsch", :title=>["Front End Engineer at Scripps Networks"], :n=>{:family_name=>["Wunsch"], :given_name=>["Mark"]}, :adr=>[{:locality=>["Greater New York City Area"]}]} | |
irb(main):006:0> m.to_yaml | |
ArgumentError: wrong number of arguments (1 for 0) | |
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:41:in `to_yaml' | |
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:41:in `node_export' | |
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:41:in `add' | |
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:41:in `to_yaml' | |
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:40:in `each' | |
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:40:in `to_yaml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parent | |
|-- dog | |
| `-- puppy | |
|-- son | |
| |-- grandson | |
| | |-- greatgrandson | |
| | | `-- cheese | |
| | `-- greatgranddaughter | |
| | | `-- strawberry | |
| | | | `-- juice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node = Redwood::Node.new(:parent) | |
dog = node.add_child(:dog) | |
puppy = dog.add_child(:puppy) | |
son = node.add_child(:son) | |
grandson = son.add_child(:grandson) | |
greatgrandson = grandson.add_child(:greatgrandson) | |
greatgrandson.add_child(:cheese) | |
greatgranddaughter = grandson.add_child(:greatgranddaughter).add_child(:strawberry).add_child(:juice) | |
son.add_child(:granddaughter) | |
daughter = node.add_child(:daughter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snnym-mwunsch2:Redwood 156280$ bundle exec rake | |
(in /Users/156280/Projects/Redwood) | |
rake aborted! | |
no such file to load -- bundler | |
/Users/156280/Projects/Redwood/Rakefile:2:in `require' | |
(See full trace by running task with --trace) | |
snnym-mwunsch2:Redwood 156280$ ruby --version | |
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.3.0] | |
snnym-mwunsch2:Redwood 156280$ bundle version | |
Bundler version 0.9.18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Copyright (c) 2010 Joe Mahoney | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the | |
# "Software"), to deal in the Software without restriction, including | |
# without limitation the rights to use, copy, modify, merge, publish, | |
# distribute, sublicense, and/or sell copies of the Software, and to | |
# permit persons to whom the Software is furnished to do so, subject to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ruby -v | |
if ( type -P rvm &> /dev/null ) && ( rvm list | grep jruby &> /dev/null ) ; then | |
( rvm jruby && ruby -v ) | |
else | |
echo 'No RVM!' | |
fi |