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 +8 -0
- data/CHANGES.md +4 -0
- data/README.md +5 -1
- data/Rakefile +1 -0
- data/lib/mr_poole/helper.rb +1 -1
- data/lib/mr_poole/version.rb +1 -1
- data/mr_poole.gemspec +1 -0
- data/spec/cli_spec.rb +2 -2
- data/spec/command_spec.rb +44 -44
- data/spec/spec_helper.rb +5 -0
- metadata +18 -1
data/.travis.yml
ADDED
data/CHANGES.md
CHANGED
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
|
+
[](https://travis-ci.org/mmcclimon/mr_poole)
|
13
|
+
[](https://codeclimate.com/github/mmcclimon/mr_poole)
|
14
|
+
[](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
data/lib/mr_poole/helper.rb
CHANGED
@@ -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
|
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
|
data/lib/mr_poole/version.rb
CHANGED
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
110
|
-
expect(
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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(
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
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.
|
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
|