tumblr-rb 1.3.0 → 2.0.0.alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. data/.travis.yml +7 -0
  2. data/Gemfile +15 -8
  3. data/Gemfile.lock +65 -65
  4. data/LICENSE +4 -2
  5. data/README.md +31 -84
  6. data/Rakefile +8 -68
  7. data/bin/tumblr +3 -133
  8. data/lib/tumblr.rb +7 -184
  9. data/lib/tumblr/authentication.rb +71 -0
  10. data/lib/tumblr/client.rb +148 -0
  11. data/lib/tumblr/command_line_interface.rb +222 -0
  12. data/lib/tumblr/credentials.rb +31 -0
  13. data/lib/tumblr/post.rb +253 -171
  14. data/lib/tumblr/post/answer.rb +17 -0
  15. data/lib/tumblr/post/audio.rb +22 -10
  16. data/lib/tumblr/post/chat.rb +25 -0
  17. data/lib/tumblr/post/link.rb +22 -9
  18. data/lib/tumblr/post/photo.rb +29 -10
  19. data/lib/tumblr/post/quote.rb +17 -10
  20. data/lib/tumblr/post/text.rb +18 -0
  21. data/lib/tumblr/post/video.rb +26 -11
  22. data/lib/tumblr/version.rb +3 -0
  23. data/lib/tumblr/views/error.erb +6 -0
  24. data/lib/tumblr/views/form.erb +11 -0
  25. data/lib/tumblr/views/layout.erb +41 -0
  26. data/lib/tumblr/views/success.erb +6 -0
  27. data/man/tumblr.1 +67 -65
  28. data/man/tumblr.1.html +131 -108
  29. data/man/tumblr.1.ronn +76 -57
  30. data/man/tumblr.5 +48 -68
  31. data/man/tumblr.5.html +106 -114
  32. data/man/tumblr.5.ronn +38 -51
  33. data/spec/fixtures/posts.json +10 -0
  34. data/spec/fixtures/typical_animated_gif.gif +0 -0
  35. data/spec/spec_helper.rb +12 -0
  36. data/spec/tumblr/authentication_spec.rb +57 -0
  37. data/spec/tumblr/client_spec.rb +223 -0
  38. data/spec/tumblr/credentials_spec.rb +63 -0
  39. data/spec/tumblr/post_spec.rb +125 -0
  40. data/tumblr-rb.gemspec +16 -89
  41. metadata +101 -102
  42. data/lib/tumblr/authenticator.rb +0 -18
  43. data/lib/tumblr/post/conversation.rb +0 -15
  44. data/lib/tumblr/post/regular.rb +0 -14
  45. data/lib/tumblr/reader.rb +0 -191
  46. data/lib/tumblr/writer.rb +0 -39
  47. data/test/fixtures/vcr_cassettes/authenticate/authenticate.yml +0 -39
  48. data/test/fixtures/vcr_cassettes/read/all_pages.yml +0 -34
  49. data/test/fixtures/vcr_cassettes/read/authenticated.yml +0 -40
  50. data/test/fixtures/vcr_cassettes/read/authentication_failure.yml +0 -33
  51. data/test/fixtures/vcr_cassettes/read/like.yml +0 -31
  52. data/test/fixtures/vcr_cassettes/read/mwunsch.yml +0 -101
  53. data/test/fixtures/vcr_cassettes/read/optional.yml +0 -48
  54. data/test/fixtures/vcr_cassettes/read/pages.yml +0 -36
  55. data/test/fixtures/vcr_cassettes/read/tumblrgemtest.yml +0 -42
  56. data/test/fixtures/vcr_cassettes/read/unlike.yml +0 -31
  57. data/test/fixtures/vcr_cassettes/write/delete.yml +0 -31
  58. data/test/fixtures/vcr_cassettes/write/edit.yml +0 -31
  59. data/test/fixtures/vcr_cassettes/write/reblog.yml +0 -31
  60. data/test/fixtures/vcr_cassettes/write/write.yml +0 -31
  61. data/test/helper.rb +0 -44
  62. data/test/test_tumblr.rb +0 -710
@@ -2,164 +2,187 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta http-equiv='content-type' value='text/html;charset=utf8'>
5
- <meta name='generator' value='Ronn/v0.4.1'>
6
- <title>tumblr(1) -- publish to tumblr.com</title>
7
- <style type='text/css'>
8
- body {margin:0}
9
- #man, #man code, #man pre, #man tt, #man kbd, #man samp {
10
- font-family:consolas,monospace;
11
- font-size:16px;
12
- line-height:1.3;
13
- color:#343331;
14
- background:#fff; }
15
- #man { max-width:89ex; text-align:justify; margin:0 25px 25px 25px }
16
- #man h1, #man h2, #man h3 { color:#232221;clear:left }
17
- #man h1 { font-size:28px; margin:15px 0 30px 0; text-align:center }
18
- #man h2 { font-size:18px; margin-bottom:0; margin-top:10px; line-height:1.3; }
19
- #man h3 { font-size:16px; margin:0 0 0 4ex; }
20
- #man p, #man ul, #man ol, #man dl, #man pre { margin:0 0 18px 0; }
21
- #man pre {
22
- color:#333231;
23
- background:#edeceb;
24
- padding:5px 7px;
25
- margin:0px 0 20px 0;
26
- border-left:2ex solid #ddd}
27
- #man pre + h2, #man pre + h3 {
28
- margin-top:22px;
29
- }
30
- #man h2 + pre, #man h3 + pre {
31
- margin-top:5px;
32
- }
33
- #man > p, #man > ul, #man > ol, #man > dl, #man > pre { margin-left:8ex; }
34
- #man dt { margin:0; clear:left }
35
- #man dt.flush { float:left; width:8ex }
36
- #man dd { margin:0 0 0 9ex }
37
- #man code, #man strong, #man b { font-weight:bold; color:#131211; }
38
- #man pre code { font-weight:normal; color:#232221; background:inherit }
39
- #man em, var, u {
40
- font-style:normal; color:#333231; border-bottom:1px solid #999; }
41
- #man h1.man-title { display:none; }
42
- #man ol.man, #man ol.man li { margin:2px 0 10px 0; padding:0;
43
- float:left; width:33%; list-style-type:none;
44
- text-transform:uppercase; font-size:18px; color:#999;
45
- letter-spacing:1px;}
46
- #man ol.man { width:100%; }
47
- #man ol.man li.tl { text-align:left }
48
- #man ol.man li.tc { text-align:center;letter-spacing:4px }
49
- #man ol.man li.tr { text-align:right }
50
- #man ol.man a { color:#999 }
51
- #man ol.man a:hover { color:#333231 }
5
+ <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
6
+ <title>tumblr(1) - publish to tumblr.com</title>
7
+ <style type='text/css' media='all'>
8
+ /* style: man */
9
+ body#manpage {margin:0}
10
+ .mp {max-width:100ex;padding:0 9ex 1ex 4ex}
11
+ .mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
12
+ .mp h2 {margin:10px 0 0 0}
13
+ .mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
14
+ .mp h3 {margin:0 0 0 4ex}
15
+ .mp dt {margin:0;clear:left}
16
+ .mp dt.flush {float:left;width:8ex}
17
+ .mp dd {margin:0 0 0 9ex}
18
+ .mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
19
+ .mp pre {margin-bottom:20px}
20
+ .mp pre+h2,.mp pre+h3 {margin-top:22px}
21
+ .mp h2+pre,.mp h3+pre {margin-top:5px}
22
+ .mp img {display:block;margin:auto}
23
+ .mp h1.man-title {display:none}
24
+ .mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
25
+ .mp h2 {font-size:16px;line-height:1.25}
26
+ .mp h1 {font-size:20px;line-height:2}
27
+ .mp {text-align:justify;background:#fff}
28
+ .mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
29
+ .mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
30
+ .mp u {text-decoration:underline}
31
+ .mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
32
+ .mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
33
+ .mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
34
+ .mp b.man-ref {font-weight:normal;color:#434241}
35
+ .mp pre {padding:0 4ex}
36
+ .mp pre code {font-weight:normal;color:#434241}
37
+ .mp h2+pre,h3+pre {padding-left:0}
38
+ ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
39
+ ol.man-decor {width:100%}
40
+ ol.man-decor li.tl {text-align:left}
41
+ ol.man-decor li.tc {text-align:center;letter-spacing:4px}
42
+ ol.man-decor li.tr {text-align:right;float:right}
52
43
  </style>
53
44
  </head>
54
- <body>
55
- <div id='man'>
45
+ <!--
46
+ The following styles are deprecated and will be removed at some point:
47
+ div#man, div#man ol.man, div#man ol.head, div#man ol.man.
56
48
 
57
- <h1 class='man-title'>tumblr(1)</h1>
49
+ The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
50
+ .man-navigation should be used instead.
51
+ -->
52
+ <body id='manpage'>
53
+ <div class='mp' id='man'>
58
54
 
59
- <ol class='head man'>
60
- <li class='tl'>tumblr(1)</li>
61
- <li class='tc'>Tumblr Manual</li>
62
- <li class='tr'>tumblr(1)</li>
63
- </ol>
55
+ <div class='man-navigation' style='display:none'>
56
+ <a href="#NAME">NAME</a>
57
+ <a href="#SYNOPSIS">SYNOPSIS</a>
58
+ <a href="#DESCRIPTION">DESCRIPTION</a>
59
+ <a href="#COMMANDS">COMMANDS</a>
60
+ <a href="#POSTING-OPTIONS">POSTING OPTIONS</a>
61
+ <a href="#COMMON-OPTIONS">COMMON OPTIONS</a>
62
+ <a href="#AUTHORIZATION">AUTHORIZATION</a>
63
+ <a href="#EXAMPLES">EXAMPLES</a>
64
+ <a href="#COPYRIGHT">COPYRIGHT</a>
65
+ <a href="#SEE-ALSO">SEE ALSO</a>
66
+ </div>
64
67
 
65
- <h2 id='NAME'>NAME</h2>
66
- <p><code>tumblr</code> -- publish to tumblr.com</p>
68
+ <ol class='man-decor man-head man head'>
69
+ <li class='tl'>tumblr(1)</li>
70
+ <li class='tc'>Tumblr Manual</li>
71
+ <li class='tr'>tumblr(1)</li>
72
+ </ol>
67
73
 
68
- <h2>SYNOPSIS</h2>
74
+ <h2 id="NAME">NAME</h2>
75
+ <p class="man-name">
76
+ <code>tumblr</code> - <span class="man-whatis">publish to tumblr.com</span>
77
+ </p>
69
78
 
70
- <p><code>tumblr</code> [<var>OPTIONS</var>] <var>FILE OR URL</var></p>
79
+ <h2 id="SYNOPSIS">SYNOPSIS</h2>
71
80
 
72
- <h2>DESCRIPTION</h2>
81
+ <p><code>tumblr</code> COMMAND [ARGS]</p>
73
82
 
74
- <p><code>tumblr</code> is a command line utility and Ruby library for working with Tumblr.com. It can read plain-text files and publish them to Tumblr.</p>
83
+ <h2 id="DESCRIPTION">DESCRIPTION</h2>
75
84
 
76
- <p>The <code>tumblr</code> command will publish a named input <var>FILE</var> (or Standard Input if no file is given), or if a <var>URL</var> is given it will publish that URL as a Link post (or a Video post if the url is a YouTube or Vimeo post).</p>
85
+ <p><code>tumblr</code> is a command line utility and Ruby library for working with Tumblr.com. It can read plain-text and binary files and publish them to Tumblr.</p>
77
86
 
78
- <p>If you preface your <var>FILE</var> with a bit of YAML (&lt;yaml.org>) frontmatter, you can give <code>tumblr</code> more explicit instructions for publishing your post. See tumblr(5) for available YAML parameters.</p>
87
+ <p><code>tumblr</code> is driven through a group of <a href="#COMMANDS" title="COMMANDS" data-bare-link="true">COMMANDS</a> (similar to <code>git</code> or <code>rbenv</code>).</p>
79
88
 
80
- <h2>OPTIONS</h2>
89
+ <p>If you preface your plaintext file with a bit of YAML (&lt;yaml.org>) frontmatter, you can give <code>tumblr</code> more explicit instructions for how to publish your post. See <a class="man-ref" href="tumblr.5.html">tumblr<span class="s">(5)</span></a> for available YAML parameters.</p>
90
+
91
+ <h2 id="COMMANDS">COMMANDS</h2>
81
92
 
82
93
  <dl>
83
- <dt><code>-a</code>,<code>--auth</code> <em>EMAIL:PASSWORD</em></dt><dd><p> Provide Email Address and Password, to authenticate to Tumblr, separated by a colon.
84
- If these are not provided, you will be prompted for them.
85
- You <b>must</b> provide this or the <code>--credentials</code> argument if the post comes from standard input.</p></dd>
86
- <dt><code>-e</code>, <code>--email</code> <em>EMAIL</em></dt><dd><p> Email Address associated with your Tumblr account.
87
- You will be prompted for a password.</p></dd>
88
- <dt><code>--credentials</code> <em>FILE</em></dt><dd><p> A YAML file with the user credentials. Should have keys <code>email</code> and <code>password</code>.</p></dd>
89
- <dt><code>-p</code>,<code>--publish</code></dt><dd><p> Publish the post immediately. This will ignore the <code>state</code> parameter set in the post.</p></dd>
90
- <dt><code>-q</code>,<code>--queue</code></dt><dd><p> Add the post to the queue.</p></dd>
91
- <dt><code>-d</code>,<code>--draft</code></dt><dd><p> Save the post as a draft.</p></dd>
92
- <dt><code>--group</code>=<em>GROUP</em></dt><dd><p> Publish the post to a <em>GROUP</em> tumblelog.</p></dd>
94
+ <dt><code>tumblr post</code> <var>POST</var> | <var>FILE</var> | <var>URL</var></dt><dd><p> Post to tumblr.
95
+ A <var>POST</var> is a piece of plaintext, assumed to be formatted as <code>tumblr(5)</code>.
96
+ <var>FILE</var> is a path to a <var>POST</var>. If <var>FILE</var> has a binary extension, that file will be uploaded as an image, audio, or video post.
97
+ <var>URL</var> will create a link-type post, or a video or audio post, depending on the location of the url.</p></dd>
98
+ <dt><code>tumblr pipe</code></dt><dd><p> Read from STDIN and post to tumblr.</p></dd>
99
+ <dt><code>tumblr edit</code> <var>POST_ID</var></dt><dd><p> Edit <var>POST_ID</var> on tumblr.
100
+ Will open the serialized post in the foreground with $TUMBLREDITOR then $EDITOR.</p></dd>
101
+ <dt><code>tumblr fetch</code> <var>POST_ID</var></dt><dd><p> Fetch <var>POST_ID</var> from tumblr and write out its serialized form.</p></dd>
102
+ <dt><code>tumblr delete</code> <var>POST_ID</var></dt><dd><p> Delete <var>POST_ID</var> from tumblr.</p></dd>
103
+ <dt><code>tumblr help</code> [<var>TASK</var>]</dt><dd><p> Print the help message and the description for <var>TASK</var>.</p></dd>
104
+ <dt><code>tumblr authorize</code></dt><dd><p> Start a web server and application to authenticate to tumblr and authorize the cli.
105
+ See <a href="#AUTHORIZATION" title="AUTHORIZATION" data-bare-link="true">AUTHORIZATION</a></p></dd>
106
+ <dt><code>tumblr version</code></dt><dd><p> Print the <code>tumblr</code> version and quit.</p></dd>
93
107
  </dl>
94
108
 
95
109
 
96
- <p>Other:</p>
110
+ <h2 id="POSTING-OPTIONS">POSTING OPTIONS</h2>
111
+
112
+ <p>These options are used when posting to tumblr, i.e. when using <code>tumblr post</code> or <code>tumblr pipe</code>.</p>
97
113
 
98
114
  <dl>
99
- <dt><code>-h</code>, <code>--help</code></dt><dd><p> Print the help message and quit.</p></dd>
100
- <dt><code>-v</code>, <code>--version</code></dt><dd><p> Print the <code>tumblr</code> version and quit.</p></dd>
115
+ <dt><code>-p</code>,<code>--publish</code></dt><dd><p> Publish this post (ignoring the <code>state</code> parameter set in the post).</p></dd>
116
+ <dt><code>-q</code>,<code>--queue</code></dt><dd><p> Add this post to the queue.</p></dd>
117
+ <dt><code>-d</code>,<code>--draft</code></dt><dd><p> Save this post as a draft.</p></dd>
101
118
  </dl>
102
119
 
103
120
 
104
- <h2>EXAMPLES</h2>
121
+ <h2 id="COMMON-OPTIONS">COMMON OPTIONS</h2>
122
+
123
+ <dl>
124
+ <dt><code>--credentials</code>=<em>PATH</em></dt><dd><p> The file where your OAuth keys are stored.
125
+ When authenticating, this path is where the keys should be stored.</p></dd>
126
+ <dt><code>--host</code>=<em>HOST</em></dt><dd><p> The hostname of the Tumblr account your posting to.
127
+ Posting and fetching posts require the hostname.</p></dd>
128
+ </dl>
129
+
130
+
131
+ <h2 id="AUTHORIZATION">AUTHORIZATION</h2>
132
+
133
+ <p>Most actions of the cli require authorization to Tumblr. <code>tumblr authorize</code> provides a mechanism to authenticate and authorize the cli.</p>
134
+
135
+ <p>In order to use <code>tumblr</code>, you first need to <a href="http://www.tumblr.com/oauth/apps">register</a> an OAuth application with tumblr.</p>
136
+
137
+ <p>Run <code>tumblr authorize</code> to start up server, and type in the consumer key and secret. You'll then be asked to authorize the app.
138
+ These keys are saved to the file noted in <code>--credentials</code>, defaulting to <code>~/.tumblr</code>.
139
+ If you choose not to use this default, you will need to enter the <code>--credentials</code> option every time you post.
140
+ Alternatively, use the <code>$TUMBLRCRED</code> environment variable.</p>
141
+
142
+ <h2 id="EXAMPLES">EXAMPLES</h2>
105
143
 
106
144
  <p>Publish a file to Tumblr.com:</p>
107
145
 
108
- <pre><code>$ tumblr my_post.txt
146
+ <pre><code>$ tumblr post my_post.txt
109
147
  </code></pre>
110
148
 
111
149
  <p>Or from standard input:</p>
112
150
 
113
- <pre><code>$ cat data.yml my_post.txt | tumblr -a tumblr_user@foobar.com:p4ssw0rd
151
+ <pre><code>$ cat data.yml my_post.txt | tumblr --host=mwunsch.tumblr.com
114
152
  </code></pre>
115
153
 
116
154
  <p>Make a Link post:</p>
117
155
 
118
- <pre><code>$ tumblr http://github.com/mwunsch/tumblr
156
+ <pre><code>$ tumblr post http://github.com/mwunsch/tumblr
119
157
  </code></pre>
120
158
 
121
159
  <p>Or a Video post:</p>
122
160
 
123
- <pre><code>$ tumblr http://www.youtube.com/watch?v=CW0DUg63lqU
161
+ <pre><code>$ tumblr post http://www.youtube.com/watch?v=CW0DUg63lqU
124
162
  </code></pre>
125
163
 
126
164
  <p>Save it as a draft:</p>
127
165
 
128
- <pre><code>$ tumblr -d http://www.youtube.com/watch?v=CW0DUg63lqU
129
- </code></pre>
130
-
131
- <p>Authenticate with credentials given from a file:</p>
132
-
133
- <pre><code>$ cat ~/.tumblrlogin
134
- email: tumblruser@generic-email.com
135
- password: myvoiceismypassport
136
- $ cat data.yml my_post.txt | tumblr --credentials ~/.tumblrlogin
137
- </code></pre>
138
-
139
- <h2>INSTALLATION</h2>
140
-
141
- <p>If you have RubyGems installed:</p>
142
-
143
- <pre><code>gem install tumblr-rb
166
+ <pre><code>$ tumblr post -d http://www.youtube.com/watch?v=CW0DUg63lqU
144
167
  </code></pre>
145
168
 
146
- <h2>COPYRIGHT</h2>
169
+ <h2 id="COPYRIGHT">COPYRIGHT</h2>
147
170
 
148
- <p>Tumblr (the gem) is Copyright (C) 2010 Mark Wunsch</p>
171
+ <p>Tumblr (the gem) is Copyright (C) 2010 - 2012 Mark Wunsch</p>
149
172
 
150
173
  <p>Tumblr is Copyright (c) Tumblr, Inc. The Tumblr gem is NOT affiliated with Tumblr, Inc.</p>
151
174
 
152
- <h2>SEE ALSO</h2>
175
+ <h2 id="SEE-ALSO">SEE ALSO</h2>
153
176
 
154
- <p>tumblr(5), gem(1)</p>
177
+ <p><a class="man-ref" href="tumblr.5.html">tumblr<span class="s">(5)</span></a>, <span class="man-ref">gem<span class="s">(1)</span></span></p>
155
178
 
156
179
 
157
- <ol class='foot man'>
158
- <li class='tl'>Mark Wunsch</li>
159
- <li class='tc'>March 2010</li>
160
- <li class='tr'>tumblr(1)</li>
161
- </ol>
180
+ <ol class='man-decor man-foot man foot'>
181
+ <li class='tl'>Mark Wunsch</li>
182
+ <li class='tc'>October 2012</li>
183
+ <li class='tr'>tumblr(1)</li>
184
+ </ol>
162
185
 
163
- </div>
186
+ </div>
164
187
  </body>
165
188
  </html>
@@ -3,88 +3,107 @@ tumblr(1) -- publish to tumblr.com
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `tumblr` [<OPTIONS>] <FILE OR URL>
6
+ `tumblr` COMMAND [ARGS]
7
7
 
8
8
  ## DESCRIPTION
9
9
 
10
- `tumblr` is a command line utility and Ruby library for working with Tumblr.com. It can read plain-text files and publish them to Tumblr.
11
-
12
- The `tumblr` command will publish a named input <FILE> (or Standard Input if no file is given), or if a <URL> is given it will publish that URL as a Link post (or a Video post if the url is a YouTube or Vimeo post).
13
-
14
- If you preface your <FILE> with a bit of YAML (<yaml.org>) frontmatter, you can give `tumblr` more explicit instructions for publishing your post. See tumblr(5) for available YAML parameters.
15
-
16
- ## OPTIONS
17
-
18
- * `-a`,`--auth` _EMAIL:PASSWORD_:
19
- Provide Email Address and Password, to authenticate to Tumblr, separated by a colon.
20
- If these are not provided, you will be prompted for them.
21
- You <b>must</b> provide this or the `--credentials` argument if the post comes from standard input.
22
-
23
- * `-e`, `--email` _EMAIL_:
24
- Email Address associated with your Tumblr account.
25
- You will be prompted for a password.
26
-
27
- * `--credentials` _FILE_:
28
- A YAML file with the user credentials. Should have keys `email` and `password`.
29
-
10
+ `tumblr` is a command line utility and Ruby library for working with Tumblr.com. It can read plain-text and binary files and publish them to Tumblr.
11
+
12
+ `tumblr` is driven through a group of [COMMANDS][] (similar to `git` or `rbenv`).
13
+
14
+ If you preface your plaintext file with a bit of YAML (<yaml.org>) frontmatter, you can give `tumblr` more explicit instructions for how to publish your post. See tumblr(5) for available YAML parameters.
15
+
16
+ ## COMMANDS
17
+
18
+ * `tumblr post` <POST> | <FILE> | <URL>:
19
+ Post to tumblr.
20
+ A <POST> is a piece of plaintext, assumed to be formatted as `tumblr(5)`.
21
+ <FILE> is a path to a <POST>. If <FILE> has a binary extension, that file will be uploaded as an image, audio, or video post.
22
+ <URL> will create a link-type post, or a video or audio post, depending on the location of the url.
23
+
24
+ * `tumblr pipe`:
25
+ Read from STDIN and post to tumblr.
26
+
27
+ * `tumblr edit` <POST_ID>:
28
+ Edit <POST_ID> on tumblr.
29
+ Will open the serialized post in the foreground with $TUMBLREDITOR then $EDITOR.
30
+
31
+ * `tumblr fetch` <POST_ID>:
32
+ Fetch <POST_ID> from tumblr and write out its serialized form.
33
+
34
+ * `tumblr delete` <POST_ID>:
35
+ Delete <POST_ID> from tumblr.
36
+
37
+ * `tumblr help` [<TASK>]:
38
+ Print the help message and the description for <TASK>.
39
+
40
+ * `tumblr authorize`:
41
+ Start a web server and application to authenticate to tumblr and authorize the cli.
42
+ See [AUTHORIZATION][]
43
+
44
+ * `tumblr version`:
45
+ Print the `tumblr` version and quit.
46
+
47
+ ## POSTING OPTIONS
48
+
49
+ These options are used when posting to tumblr, i.e. when using `tumblr post` or `tumblr pipe`.
50
+
30
51
  * `-p`,`--publish`:
31
- Publish the post immediately. This will ignore the `state` parameter set in the post.
52
+ Publish this post (ignoring the `state` parameter set in the post).
32
53
 
33
54
  * `-q`,`--queue`:
34
- Add the post to the queue.
35
-
55
+ Add this post to the queue.
56
+
36
57
  * `-d`,`--draft`:
37
- Save the post as a draft.
38
-
39
- * `--group`=_GROUP_:
40
- Publish the post to a _GROUP_ tumblelog.
58
+ Save this post as a draft.
41
59
 
42
- Other:
43
60
 
44
- * `-h`, `--help`:
45
- Print the help message and quit.
46
-
47
- * `-v`, `--version`:
48
- Print the `tumblr` version and quit.
61
+ ## COMMON OPTIONS
62
+
63
+ * `--credentials`=_PATH_:
64
+ The file where your OAuth keys are stored.
65
+ When authenticating, this path is where the keys should be stored.
66
+
67
+ * `--host`=_HOST_:
68
+ The hostname of the Tumblr account your posting to.
69
+ Posting and fetching posts require the hostname.
70
+
71
+ ## AUTHORIZATION
72
+
73
+ Most actions of the cli require authorization to Tumblr. `tumblr authorize` provides a mechanism to authenticate and authorize the cli.
74
+
75
+ In order to use `tumblr`, you first need to [register](http://www.tumblr.com/oauth/apps) an OAuth application with tumblr.
76
+
77
+ Run `tumblr authorize` to start up server, and type in the consumer key and secret. You'll then be asked to authorize the app.
78
+ These keys are saved to the file noted in `--credentials`, defaulting to `~/.tumblr`.
79
+ If you choose not to use this default, you will need to enter the `--credentials` option every time you post.
80
+ Alternatively, use the `$TUMBLRCRED` environment variable.
49
81
 
50
82
  ## EXAMPLES
51
83
 
52
84
  Publish a file to Tumblr.com:
53
85
 
54
- $ tumblr my_post.txt
55
-
86
+ $ tumblr post my_post.txt
87
+
56
88
  Or from standard input:
57
89
 
58
- $ cat data.yml my_post.txt | tumblr -a tumblr_user@foobar.com:p4ssw0rd
59
-
90
+ $ cat data.yml my_post.txt | tumblr --host=mwunsch.tumblr.com
91
+
60
92
  Make a Link post:
61
93
 
62
- $ tumblr http://github.com/mwunsch/tumblr
63
-
64
- Or a Video post:
94
+ $ tumblr post http://github.com/mwunsch/tumblr
65
95
 
66
- $ tumblr http://www.youtube.com/watch?v=CW0DUg63lqU
67
-
68
- Save it as a draft:
69
-
70
- $ tumblr -d http://www.youtube.com/watch?v=CW0DUg63lqU
71
-
72
- Authenticate with credentials given from a file:
96
+ Or a Video post:
73
97
 
74
- $ cat ~/.tumblrlogin
75
- email: tumblruser@generic-email.com
76
- password: myvoiceismypassport
77
- $ cat data.yml my_post.txt | tumblr --credentials ~/.tumblrlogin
78
-
79
- ## INSTALLATION
98
+ $ tumblr post http://www.youtube.com/watch?v=CW0DUg63lqU
80
99
 
81
- If you have RubyGems installed:
100
+ Save it as a draft:
82
101
 
83
- gem install tumblr-rb
102
+ $ tumblr post -d http://www.youtube.com/watch?v=CW0DUg63lqU
84
103
 
85
104
  ## COPYRIGHT
86
105
 
87
- Tumblr (the gem) is Copyright (C) 2010 Mark Wunsch
106
+ Tumblr (the gem) is Copyright (C) 2010 - 2012 Mark Wunsch
88
107
 
89
108
  Tumblr is Copyright (c) Tumblr, Inc. The Tumblr gem is NOT affiliated with Tumblr, Inc.
90
109