mr_poole 0.3.0 → 0.3.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.
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.8.7"
4
+ - "1.9.2"
5
+ - "1.9.3"
6
+ - "2.0.0"
7
+
8
+ script: bundle exec rspec spec
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### v0.3.1 (2013-09-22)
4
+
5
+ - Bugfixes to work properly on ruby 1.8.7.
6
+
3
7
  ### v0.3.0 (2013-09-22)
4
8
 
5
9
  - Added --keep-draft and --keep-timestamp flags to publish command (thanks,
data/README.md CHANGED
@@ -6,9 +6,13 @@ blogs.
6
6
 
7
7
  The literary Mr. Poole is Jekyll's butler, who "serves Jekyll faithfully, and
8
8
  attempts to do a good job and be loyal to his master"
9
- [Wikipedia](http://en.wikipedia.org/wiki/Jekyll_and_hyde#Mr._Poole), and the
9
+ ([Wikipedia](http://en.wikipedia.org/wiki/Jekyll_and_hyde#Mr._Poole)), and the
10
10
  Mr. Poole gem looks to be the same thing.
11
11
 
12
+ [![Build Status](https://travis-ci.org/mmcclimon/mr_poole.png)](https://travis-ci.org/mmcclimon/mr_poole)
13
+ [![Code Climate](https://codeclimate.com/github/mmcclimon/mr_poole.png)](https://codeclimate.com/github/mmcclimon/mr_poole)
14
+ [![Coverage Status](https://coveralls.io/repos/mmcclimon/mr_poole/badge.png)](https://coveralls.io/r/mmcclimon/mr_poole)
15
+
12
16
  ## Usage
13
17
 
14
18
  Mr. Poole is primarily a command-line application: the gem installs an
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require 'rubygems'
1
2
  require "bundler/gem_tasks"
2
3
  require 'rspec/core/rake_task'
3
4
 
@@ -8,7 +8,7 @@ module MrPoole
8
8
  # Check for a _posts directory in current directory
9
9
  # If we don't find one, puke an error message and die
10
10
  def ensure_jekyll_dir
11
- unless Dir.exists?('./_posts')
11
+ unless File.exists?('./_posts')
12
12
  puts 'ERROR: Cannot locate _posts directory. Double check to make sure'
13
13
  puts ' that you are in a jekyll directory.'
14
14
  exit
@@ -1,3 +1,3 @@
1
1
  module MrPoole
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
data/mr_poole.gemspec CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
 
30
30
  spec.add_development_dependency "bundler", "~> 1.3"
31
+ spec.add_development_dependency('coveralls', "~> 0.6.9")
31
32
  spec.add_development_dependency "rspec"
32
33
  spec.add_development_dependency "rake"
33
34
  end
data/spec/cli_spec.rb CHANGED
@@ -191,7 +191,7 @@ module MrPoole
191
191
  end # describe draft
192
192
 
193
193
  describe "action 'publish'" do
194
- let(:d_path) { Commands.new.draft({title: 'test_draft'}) }
194
+ let(:d_path) { Commands.new.draft({:title => 'test_draft'}) }
195
195
  before(:each) { @olddir, @tmpdir = make_jekyll_dir }
196
196
  after(:each) { clean_tmp_files(@tmpdir, @olddir) }
197
197
 
@@ -252,7 +252,7 @@ module MrPoole
252
252
  end
253
253
 
254
254
  describe "action 'unpublish'" do
255
- let(:p_path) { Commands.new.post({title: 'test_post'}) }
255
+ let(:p_path) { Commands.new.post({:title => 'test_post'}) }
256
256
  before(:each) { @olddir, @tmpdir = make_jekyll_dir }
257
257
  after(:each) { clean_tmp_files(@tmpdir, @olddir) }
258
258
 
data/spec/command_spec.rb CHANGED
@@ -14,44 +14,44 @@ module MrPoole
14
14
  describe "#post" do
15
15
  context 'title only' do
16
16
  it "should create a new post in the _posts directory" do
17
- fn = c.post({title: "test_post"})
17
+ fn = c.post({:title => "test_post"})
18
18
  expect(File.exists?(fn)).to be_true
19
19
  end
20
20
 
21
21
  it "should return path to the newly created post" do
22
- returned = c.post({title: "test_post"})
22
+ returned = c.post({:title => "test_post"})
23
23
  determined = Dir.glob("_posts/*.md").first
24
24
  expect(returned).to eq(determined)
25
25
  end
26
26
 
27
27
  it "should create a timestamped post in the _posts directory" do
28
- fn = c.post({title: "test_post" })
28
+ fn = c.post({:title => "test_post" })
29
29
  expect(fn).to match(/#{date_regex}-test_post[.]md$/)
30
30
  end
31
31
 
32
32
  it "should downcase a title" do
33
- fn = c.post({title: "Test_Post_With_Uppercase"})
33
+ fn = c.post({:title => "Test_Post_With_Uppercase"})
34
34
  expect(fn).to match(/#{date_regex}-test_post_with_uppercase[.]md/)
35
35
  end
36
36
 
37
37
  it "should sub underscores for spaces in title" do
38
- fn = c.post({title: "Test Post with Spaces"})
38
+ fn = c.post({:title => "Test Post with Spaces"})
39
39
  expect(fn).to match(/#{date_regex}-test_post_with_spaces[.]md/)
40
40
  end
41
41
 
42
42
  it "should remove non-word characters for slug" do
43
- fn = c.post({title: "On (function() {}()) in JavaScript"})
43
+ fn = c.post({:title => "On (function() {}()) in JavaScript"})
44
44
  expect(fn).to match(/#{date_regex}-on_function_in_javascript[.]md/)
45
45
  end
46
46
 
47
47
  it "should update the title in the file itself" do
48
- fn = c.post({title: "Testing Post {}"})
48
+ fn = c.post({:title => "Testing Post {}"})
49
49
  content = File.open(fn, 'r').read
50
- expect(content).to match(/title: Testing Post {}/)
50
+ expect(content).to match(/title: Testing Post \{\}/)
51
51
  end
52
52
 
53
53
  it "should update the date in the file itself" do
54
- fn = c.post({title: "Date test post"})
54
+ fn = c.post({:title => "Date test post"})
55
55
 
56
56
  # date in filename should match date in file itself
57
57
  date = fn.match(/(#{date_regex})-date_test_post[.]md/)[1]
@@ -62,19 +62,19 @@ module MrPoole
62
62
 
63
63
  context 'title and slug' do
64
64
  it "should create a post named for slug" do
65
- fn = c.post({title: "Test Post", slug: 'unique_slug'})
65
+ fn = c.post({:title => "Test Post", :slug => 'unique_slug'})
66
66
  expect(fn).to match(/#{date_regex}-unique_slug[.]md$/)
67
67
  end
68
68
 
69
69
  it "should sub any weird characters in slug" do
70
- fn = c.post({title: "Test Post with Spaces", slug: "(stupid] {slüg/"})
70
+ fn = c.post({:title => "Test Post with Spaces", :slug => "(stupid] {slüg/"})
71
71
  expect(fn).to match(/#{date_regex}-stupid_slg[.]md/)
72
72
  end
73
73
 
74
74
  it "should update the title in the file itself" do
75
- fn = c.post({title: "Testing Post {}", slug: 'shouldnt_be_in_title'})
75
+ fn = c.post({:title => "Testing Post {}", :slug => 'shouldnt_be_in_title'})
76
76
  content = File.open(fn, 'r').read
77
- expect(content).to match(/title: Testing Post {}/)
77
+ expect(content).to match(/title: Testing Post \{\}/)
78
78
  end
79
79
  end # end context title & slug
80
80
 
@@ -84,19 +84,19 @@ module MrPoole
84
84
  it "should exit if layout path doesn't exist" do
85
85
  expect {
86
86
  capture_stdout do
87
- c.post({title: 'test_post', layout: 'bogus_path.md'})
87
+ c.post({:title => 'test_post', :layout => 'bogus_path.md'})
88
88
  end
89
89
  }.to raise_error(SystemExit)
90
90
  end
91
91
 
92
92
  it 'should not use the default layout' do
93
- fn = c.post({title: 'test_post', layout: layout_path})
93
+ fn = c.post({:title => 'test_post', :layout => layout_path})
94
94
  content = File.open(fn, 'r').read
95
95
  expect(content).not_to match(/layout: post/)
96
96
  end
97
97
 
98
98
  it 'should use the custom layout' do
99
- fn = c.post({title: 'test_post', layout: layout_path})
99
+ fn = c.post({:title => 'test_post', :layout => layout_path})
100
100
  content = File.open(fn, 'r').read
101
101
  expect(content).to match(/tags: testing/)
102
102
  end
@@ -106,44 +106,44 @@ module MrPoole
106
106
  describe "#draft" do
107
107
  context 'title only' do
108
108
  it "should create a _drafts directory" do
109
- c.draft({title: 'draft post'})
110
- expect(Dir.exists?('_drafts')).to be_true
109
+ c.draft({:title => 'draft post'})
110
+ expect(File.exists?('_drafts')).to be_true
111
111
  end
112
112
 
113
113
  it "should return path to the newly created draft" do
114
- returned = c.draft({title: "test_draft"})
114
+ returned = c.draft({:title => "test_draft"})
115
115
  determined = Dir.glob("_drafts/*.md").first
116
116
  expect(returned).to eq(determined)
117
117
  end
118
118
 
119
119
  it "should create a new draft in the _drafts directory" do
120
- fn = c.draft({title: 'draft post'})
120
+ fn = c.draft({:title => 'draft post'})
121
121
  expect(File.exists?(fn)).to be_true
122
122
  end
123
123
 
124
124
  it "should create a non-timestamped draft" do
125
- fn = c.draft({title: 'draft post'})
125
+ fn = c.draft({:title => 'draft post'})
126
126
  expect(fn).not_to match(/#{date_regex}/)
127
127
  end
128
128
 
129
129
  it "should downcase and underscore title for slug" do
130
- fn = c.draft({title: "Test Post with Spaces"})
130
+ fn = c.draft({:title => "Test Post with Spaces"})
131
131
  expect(fn).to match(/test_post_with_spaces[.]md/)
132
132
  end
133
133
 
134
134
  it "should remove non-word characters for slug" do
135
- fn = c.draft({title: "On (function() {}()) in JavaScript"})
135
+ fn = c.draft({:title => "On (function() {}()) in JavaScript"})
136
136
  expect(fn).to match(/on_function_in_javascript[.]md/)
137
137
  end
138
138
 
139
139
  it "should update the title in the file itself" do
140
- fn = c.draft({title: "Testing Draft {}"})
140
+ fn = c.draft({:title => "Testing Draft {}"})
141
141
  content = File.open(fn, 'r').read
142
- expect(content).to match(/title: Testing Draft {}/)
142
+ expect(content).to match(/title: Testing Draft \{\}/)
143
143
  end
144
144
 
145
145
  it "should not update the date in the file itself" do
146
- fn = c.draft({title: "Date test post"})
146
+ fn = c.draft({:title => "Date test post"})
147
147
  content = File.open(fn, 'r').read
148
148
  expect(content).to match(/date:\s*\n/)
149
149
  end
@@ -151,19 +151,19 @@ module MrPoole
151
151
 
152
152
  context 'title and slug' do
153
153
  it "should create a draft named for slug" do
154
- fn = c.draft({title: "Test Draft", slug: 'unique_slug'})
154
+ fn = c.draft({:title => "Test Draft", :slug => 'unique_slug'})
155
155
  expect(fn).to match(/unique_slug[.]md$/)
156
156
  end
157
157
 
158
158
  it "should sub any weird characters in slug" do
159
- fn = c.draft({title: "Test Post with Spaces", slug: "(stupid] {slüg/"})
159
+ fn = c.draft({:title => "Test Post with Spaces", :slug => "(stupid] {slüg/"})
160
160
  expect(fn).to match(/stupid_slg[.]md/)
161
161
  end
162
162
 
163
163
  it "should update the title in the file itself" do
164
- fn = c.draft({title: "Testing Post {}", slug: 'shouldnt_be_in_title'})
164
+ fn = c.draft({:title => "Testing Post {}", :slug => 'shouldnt_be_in_title'})
165
165
  content = File.open(fn, 'r').read
166
- expect(content).to match(/title: Testing Post {}/)
166
+ expect(content).to match(/title: Testing Post \{\}/)
167
167
  end
168
168
  end # context title & slug
169
169
 
@@ -173,19 +173,19 @@ module MrPoole
173
173
  it "should exit if layout path doesn't exist" do
174
174
  expect {
175
175
  capture_stdout do
176
- c.draft({title: 'test_post', layout: 'bogus_path.md'})
176
+ c.draft({:title => 'test_post', :layout => 'bogus_path.md'})
177
177
  end
178
178
  }.to raise_error(SystemExit)
179
179
  end
180
180
 
181
181
  it 'should not use the default layout' do
182
- fn = c.draft({title: 'test_post', layout: layout_path})
182
+ fn = c.draft({:title => 'test_post', :layout => layout_path})
183
183
  content = File.open(fn, 'r').read
184
184
  expect(content).not_to match(/layout: post/)
185
185
  end
186
186
 
187
187
  it 'should use the custom layout' do
188
- fn = c.draft({title: 'test_post', layout: layout_path})
188
+ fn = c.draft({:title => 'test_post', :layout => layout_path})
189
189
  content = File.open(fn, 'r').read
190
190
  expect(content).to match(/tags: testing/)
191
191
  end
@@ -193,7 +193,7 @@ module MrPoole
193
193
  end # end describe draft
194
194
 
195
195
  describe "#publish" do
196
- let(:d_path) { c.draft({title: 'test_draft'}) }
196
+ let(:d_path) { c.draft({:title => 'test_draft'}) }
197
197
 
198
198
  it 'should return path to newly created post' do
199
199
  returned = c.publish(d_path)
@@ -237,7 +237,7 @@ module MrPoole
237
237
  end # end describe publish
238
238
 
239
239
  describe "#unpublish" do
240
- let(:p_path) { c.post({title: 'test_post'}) }
240
+ let(:p_path) { c.post({:title => 'test_post'}) }
241
241
 
242
242
  it 'should return path to newly created draft' do
243
243
  returned = c.unpublish(p_path)
@@ -247,7 +247,7 @@ module MrPoole
247
247
 
248
248
  it 'should create a _drafts directory' do
249
249
  c.unpublish(p_path)
250
- expect(Dir.exists?('_drafts')).to be_true
250
+ expect(File.exists?('_drafts')).to be_true
251
251
  end
252
252
 
253
253
  it 'should create an untimestamped draft in the _drafts folder' do
@@ -290,23 +290,23 @@ module MrPoole
290
290
  let(:commands) { Commands.new('textile') }
291
291
 
292
292
  it 'post should use custom extension' do
293
- fn = commands.post({title: 'post title'})
293
+ fn = commands.post({:title => 'post title'})
294
294
  expect(fn).to match(/textile$/)
295
295
  end
296
296
 
297
297
  it 'draft should use custom extension' do
298
- fn = commands.draft({title: 'post title'})
298
+ fn = commands.draft({:title => 'post title'})
299
299
  expect(fn).to match(/textile$/)
300
300
  end
301
301
 
302
302
  it 'publish should use custom extension' do
303
- draft_path = commands.draft({title: 'post title'})
303
+ draft_path = commands.draft({:title => 'post title'})
304
304
  fn = commands.publish(draft_path)
305
305
  expect(fn).to match(/textile$/)
306
306
  end
307
307
 
308
308
  it 'unpublish should use custom extension' do
309
- post_path = commands.post({title: 'post title'})
309
+ post_path = commands.post({:title => 'post title'})
310
310
  fn = commands.unpublish(post_path)
311
311
  expect(fn).to match(/textile$/)
312
312
  end
@@ -317,21 +317,21 @@ module MrPoole
317
317
 
318
318
  it "post should inherit layout's file extension" do
319
319
  layout_path = write_custom_layout_textile
320
- fn = c.post({title: 'post title', layout: layout_path})
320
+ fn = c.post({:title => 'post title', :layout => layout_path})
321
321
  expect(fn).not_to match(/md/)
322
322
  expect(fn).to match(/textile$/)
323
323
  end
324
324
 
325
325
  it "draft should inherit layout's file extension" do
326
326
  layout_path = write_custom_layout_textile
327
- fn = c.draft({title: 'post title', layout: layout_path})
327
+ fn = c.draft({:title => 'post title', :layout => layout_path})
328
328
  expect(fn).not_to match(/md/)
329
329
  expect(fn).to match(/textile$/)
330
330
  end
331
331
 
332
332
  it "publish should inherit draft's extension" do
333
333
  layout_path = write_custom_layout_textile
334
- draft_path = c.draft({title: 'post title', layout: layout_path})
334
+ draft_path = c.draft({:title => 'post title', :layout => layout_path})
335
335
  fn = c.publish(draft_path)
336
336
  expect(fn).not_to match(/md/)
337
337
  expect(fn).to match(/textile$/)
@@ -339,7 +339,7 @@ module MrPoole
339
339
 
340
340
  it "unpublish should inherit post's extension" do
341
341
  layout_path = write_custom_layout_textile
342
- post_path = c.post({title: 'post title', layout: layout_path})
342
+ post_path = c.post({:title => 'post title', :layout => layout_path})
343
343
  fn = c.publish(post_path)
344
344
  expect(fn).not_to match(/md/)
345
345
  expect(fn).to match(/textile$/)
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,11 @@ require 'stringio'
4
4
  require 'tmpdir'
5
5
  require 'fileutils'
6
6
 
7
+ if RUBY_VERSION > '1.9'
8
+ require 'coveralls'
9
+ Coveralls.wear!
10
+ end
11
+
7
12
  def capture_stdout(&block)
8
13
  stdout = $stdout
9
14
  fake_out = StringIO.new
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.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: coveralls
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.6.9
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.6.9
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: rspec
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -68,6 +84,7 @@ extensions: []
68
84
  extra_rdoc_files: []
69
85
  files:
70
86
  - .gitignore
87
+ - .travis.yml
71
88
  - CHANGES.md
72
89
  - Gemfile
73
90
  - LICENSE