mr_poole 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb4818933c757b8aa91900c8c95dac0d225afd49
4
- data.tar.gz: 88de70683c306da09dd89bfe901ce5c08f10e9b8
3
+ metadata.gz: 348c60dc739c0d74aca225020adcafaef4b972be
4
+ data.tar.gz: f15c9fc736df931ea84213845e9665cabac84ff3
5
5
  SHA512:
6
- metadata.gz: daa89c474db50ae3deb18407cc2c2fb9ad9709e60456e79bffce23f55e11b607c07a20b7eea9cb62e2c1ad50373a55c5437ed79278cf63d6873af3d3ccce8b1d
7
- data.tar.gz: 2fdb742701f6e8a8f947d440e27157889e16927e97580736a283be1697b0cf23bc517eb10b07d74089ae70155416a828f9b82cf7df4def7501d65b312d3d00d6
6
+ metadata.gz: e02d0164747f81f95cd9e7073ecda9e00dcf2a1fd330bd9442da2d0a3862dc2395fb1e0eae8210b38b8f14645b519cb095a316981f0514c2417dfce5ca844ed8
7
+ data.tar.gz: 50457e40e867b1d275bd359b373b38b0d043a35ceead08168e8d67c3691ee085263e803df4a75e6f41529865f24e1e1ef6c05c263773b998e96fc61d18e6ff1e
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### v0.2.1 (2013-09-22)
4
+
5
+ - Command-line methods now echo a filename (useful for piping into editor)
6
+
3
7
  ### v0.2.0 (2013-09-21)
4
8
 
5
9
  - Hooked into Jekyll's `_config.yml` for customizations
data/README.md CHANGED
@@ -13,7 +13,9 @@ Mr. Poole gem looks to be the same thing.
13
13
 
14
14
  Mr. Poole is primarily a command-line application: the gem installs an
15
15
  executable called `poole` in your path. It has four subcommands: post, draft,
16
- publish, and unpublish.
16
+ publish, and unpublish. All four of these commands echo a filename to STDOUT,
17
+ so you can do something like `poole post "Title" | vim` and start editing
18
+ immediately.
17
19
 
18
20
  ### Post
19
21
 
@@ -146,7 +148,7 @@ Or install it yourself as:
146
148
 
147
149
  $ gem install mr_poole
148
150
 
149
- A## Contact
151
+ ## Contact
150
152
 
151
153
  Contact me on Github, at michael@mcclimon.org, or on twitter, @mmcclimon.
152
154
 
data/lib/mr_poole/cli.rb CHANGED
@@ -30,7 +30,8 @@ module MrPoole
30
30
  options.title ||= @params.first
31
31
 
32
32
  @helper.post_usage unless options.title
33
- @commands.post(options)
33
+ fn = @commands.post(options)
34
+ puts fn
34
35
  end
35
36
 
36
37
  def handle_draft
@@ -38,7 +39,8 @@ module MrPoole
38
39
  options.title ||= @params.first
39
40
 
40
41
  @helper.draft_usage unless options.title
41
- @commands.draft(options)
42
+ fn = @commands.draft(options)
43
+ puts fn
42
44
  end
43
45
 
44
46
  def handle_publish
@@ -50,7 +52,8 @@ module MrPoole
50
52
 
51
53
  path = @params.first
52
54
  @helper.publish_usage unless path
53
- @commands.publish(path)
55
+ fn = @commands.publish(path)
56
+ puts fn
54
57
  end
55
58
 
56
59
  def handle_unpublish
@@ -62,7 +65,8 @@ module MrPoole
62
65
 
63
66
  path = @params.first
64
67
  @helper.unpublish_usage unless path
65
- @commands.unpublish(path)
68
+ fn = @commands.unpublish(path)
69
+ puts fn
66
70
  end
67
71
 
68
72
  def do_creation_options
@@ -72,11 +76,11 @@ module MrPoole
72
76
  options.layout = nil
73
77
 
74
78
  opt_parser = OptionParser.new do |opts|
75
- opts.on('-s', '--slug [SLUG]', "Use custom slug") do |s|
79
+ opts.on('-s', '--slug SLUG', "Use custom slug") do |s|
76
80
  options.slug = s
77
81
  end
78
82
 
79
- opts.on('-t', '--title [TITLE]', "Specifiy title") do |t|
83
+ opts.on('-t', '--title TITLE', "Specifiy title") do |t|
80
84
  options.title = t
81
85
  end
82
86
 
@@ -1,3 +1,3 @@
1
1
  module MrPoole
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
data/spec/cli_spec.rb CHANGED
@@ -50,11 +50,19 @@ module MrPoole
50
50
  end # context error handling
51
51
 
52
52
  context 'exit message' do
53
- it 'should exit with a usage message' do
53
+ it 'exits with a usage message on fail' do
54
54
  argv = ['post']
55
55
  output = aborted_poole_output(argv).call
56
56
  expect(output).to match(/Usage:\s+poole post/)
57
57
  end
58
+
59
+ it 'echoes path to newly created post on success' do
60
+ argv = ['post', 'post title']
61
+ output = poole_no_stdout(argv).call.chomp
62
+ determined = Dir.glob("_posts/*.md").first
63
+ expect(output).to eq(determined)
64
+ end
65
+
58
66
  end # context exit message
59
67
 
60
68
  context 'custom layout' do
@@ -62,8 +70,7 @@ module MrPoole
62
70
 
63
71
  it 'should use custom layout with --layout' do
64
72
  argv = ['post', '--layout', layout_path, '--title', 'title']
65
- poole_no_stdout(argv).call
66
- new_file = Dir.glob("_posts/*.md").first
73
+ new_file = poole_no_stdout(argv).call.chomp
67
74
  content = File.open(new_file, 'r').read
68
75
  expect(content).to match(/tags: testing/)
69
76
  end
@@ -79,8 +86,7 @@ module MrPoole
79
86
 
80
87
  it 'overrides default layout' do
81
88
  argv = ['post', 'post title']
82
- poole_no_stdout(argv).call
83
- new_file = Dir.glob("_posts/*.md").first
89
+ new_file = poole_no_stdout(argv).call.chomp
84
90
  content = File.open(new_file, 'r').read
85
91
  expect(content).to match(/tags: from_config/)
86
92
  end
@@ -89,8 +95,7 @@ module MrPoole
89
95
  custom_path = write_custom_layout
90
96
 
91
97
  argv = ['post', '--layout', custom_path, '--title', 'title']
92
- poole_no_stdout(argv).call
93
- new_file = Dir.glob("_posts/*.md").first
98
+ new_file = poole_no_stdout(argv).call.chomp
94
99
  content = File.open(new_file, 'r').read
95
100
  expect(content).not_to match(/tags: from_config/)
96
101
  expect(content).to match(/tags: testing/)
@@ -131,11 +136,18 @@ module MrPoole
131
136
  end # context error handling
132
137
 
133
138
  context 'exit message' do
134
- it 'should exit with a usage message' do
139
+ it 'exits with a usage message' do
135
140
  argv = ['draft']
136
141
  output = aborted_poole_output(argv).call
137
142
  expect(output).to match(/Usage:\s+poole draft/)
138
143
  end
144
+
145
+ it 'echoes path to newly created post on success' do
146
+ argv = ['draft', 'post title']
147
+ output = poole_no_stdout(argv).call.chomp
148
+ determined = Dir.glob("_drafts/*.md").first
149
+ expect(output).to eq(determined)
150
+ end
139
151
  end # context exit message
140
152
 
141
153
  context 'custom layout' do
@@ -159,8 +171,7 @@ module MrPoole
159
171
 
160
172
  it 'overrides default layout' do
161
173
  argv = ['draft', 'post title']
162
- poole_no_stdout(argv).call
163
- new_file = Dir.glob("_drafts/*.md").first
174
+ new_file = poole_no_stdout(argv).call.chomp
164
175
  content = File.open(new_file, 'r').read
165
176
  expect(content).to match(/tags: from_config/)
166
177
  end
@@ -169,8 +180,7 @@ module MrPoole
169
180
  custom_path = write_custom_layout
170
181
 
171
182
  argv = ['draft', '--layout', custom_path, '--title', 'title']
172
- poole_no_stdout(argv).call
173
- new_file = Dir.glob("_drafts/*.md").first
183
+ new_file = poole_no_stdout(argv).call.chomp
174
184
  content = File.open(new_file, 'r').read
175
185
  expect(content).not_to match(/tags: from_config/)
176
186
  expect(content).to match(/tags: testing/)
@@ -213,6 +223,13 @@ module MrPoole
213
223
  output = aborted_poole_output(argv).call
214
224
  expect(output).to match(/Error:\s+could not open/)
215
225
  end
226
+
227
+ it 'echoes path to newly created post on success' do
228
+ argv = ['publish', d_path]
229
+ output = poole_no_stdout(argv).call.chomp
230
+ determined = Dir.glob("_posts/*.md").first
231
+ expect(output).to eq(determined)
232
+ end
216
233
  end # context exit message
217
234
 
218
235
  end
@@ -251,6 +268,13 @@ module MrPoole
251
268
  output = aborted_poole_output(argv).call
252
269
  expect(output).to match(/Error:\s+could not open/)
253
270
  end
271
+
272
+ it 'echoes path to newly created post on success' do
273
+ argv = ['unpublish', p_path]
274
+ output = poole_no_stdout(argv).call.chomp
275
+ determined = Dir.glob("_drafts/*.md").first
276
+ expect(output).to eq(determined)
277
+ end
254
278
  end # context exit message
255
279
 
256
280
  end # context action unpublish
@@ -262,23 +286,20 @@ module MrPoole
262
286
 
263
287
  it 'should override default extension for post' do
264
288
  argv = ['post', 'post title']
265
- poole_no_stdout(argv).call
266
- fn = Dir.glob("_posts/*").first
289
+ fn = poole_no_stdout(argv).call
267
290
  expect(fn).to match(/textile$/)
268
291
  end
269
292
 
270
293
  it 'should not override if command-line layout given' do
271
294
  layout_path = write_custom_layout
272
295
  argv = ['post', '--layout', layout_path, '-t', 'title']
273
- poole_no_stdout(argv).call
274
- fn = Dir.glob("_posts/*").first
296
+ fn = poole_no_stdout(argv).call
275
297
  expect(fn).to match(/md$/)
276
298
  end
277
299
 
278
300
  it 'should override default extension for draft' do
279
301
  argv = ['draft', 'post title']
280
- poole_no_stdout(argv).call
281
- fn = Dir.glob("_drafts/*").first
302
+ fn = poole_no_stdout(argv).call.chomp
282
303
  expect(fn).to match(/textile$/)
283
304
  end
284
305
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mr_poole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael McClimon
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.0.6
101
+ rubygems_version: 2.1.4
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: A butler for Jekyll. Provides a command-line interface (called `poole`) for