mr_poole 0.3.1 → 0.3.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 60010ebbd261458b1cef4e8f5bcc0db1fe10739d
4
+ data.tar.gz: 403a24571f75f6cd5e2e452123aafe83bf1c9548
5
+ SHA512:
6
+ metadata.gz: 8f708900d1366bdb5ba468b66fcd0e584a6b7c060d4480ff23f21d6c3edba23e95107ee70de518a84c8a1977e0cd01ddba8374fa3c8499eb290358ab72e523ba
7
+ data.tar.gz: 104ece8c3f20331977ee429002472ea238d32a8cf8936274906ed5fdf1784d87688938759cfdd0516c43cb8275197973c3c1a103ad68f9ab7d6d40e17d581995
data/README.md CHANGED
@@ -9,7 +9,9 @@ attempts to do a good job and be loyal to his master"
9
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)
12
+ [![Gem Version](https://badge.fury.io/rb/mr_poole.png)](http://badge.fury.io/rb/mr_poole)
13
+
14
+ [![Build Status](https://travis-ci.org/mmcclimon/mr_poole.png?branch=master)](https://travis-ci.org/mmcclimon/mr_poole)
13
15
  [![Code Climate](https://codeclimate.com/github/mmcclimon/mr_poole.png)](https://codeclimate.com/github/mmcclimon/mr_poole)
14
16
  [![Coverage Status](https://coveralls.io/repos/mmcclimon/mr_poole/badge.png)](https://coveralls.io/r/mmcclimon/mr_poole)
15
17
 
@@ -33,12 +35,12 @@ character.
33
35
  Options:
34
36
 
35
37
  ```
36
- --slug (-s) Define a custom slug for post, used for generated file name
38
+ -s, --slug Define a custom slug for post, used for generated file name
37
39
 
38
- --title (-t) Define a title for post. This option may be omitted provided
40
+ -t, --title Define a title for post. This option may be omitted provided
39
41
  that TITLE is given as the last argument to poole
40
42
 
41
- --layout (-l) Path to a custom layout file to use
43
+ -l, --layout Path to a custom layout file to use
42
44
  ```
43
45
 
44
46
  By default, poole generates a simple file that looks like this (but see section
@@ -62,10 +64,15 @@ as `post`. In the generated file, no date is inserted.
62
64
 
63
65
  ### Publish
64
66
 
65
- poole publish DRAFT_PATH
67
+ poole publish [OPTIONS] DRAFT_PATH
68
+
69
+ Publishes a draft from your _drafts folder to your _posts folder By default,
70
+ renames the file and updates the date in the header, but see options:
66
71
 
67
- Publishes a draft from your _drafts folder to your _posts folder, renaming the
68
- file and updating the date in the header.
72
+ ```
73
+ -d, --keep-draft Do not delete the draft post'
74
+ -t, --keep-timestamp Do not update the draft timestamp'
75
+ ```
69
76
 
70
77
  Given this file (called `_drafts/test_draft.md`):
71
78
 
@@ -79,7 +86,7 @@ date:
79
86
  The life, universe, and everything.
80
87
  ```
81
88
 
82
- A call to `poole publish` will generate a file named
89
+ A call to `poole publish _drafts/test_draft.md` will generate a file named
83
90
  `_posts/yyyy-mm-dd-test_draft.md` and delete the draft. Also updates the date
84
91
  filed in the header with a date, and HH:MM, producing this file:
85
92
 
data/lib/mr_poole/cli.rb CHANGED
@@ -21,6 +21,8 @@ module MrPoole
21
21
  when 'draft' then handle_draft
22
22
  when 'publish' then handle_publish
23
23
  when 'unpublish' then handle_unpublish
24
+ when '--version' then @helper.version_statement
25
+ when '-v' then @helper.version_statement
24
26
  else @helper.gen_usage
25
27
  end
26
28
  end
@@ -55,6 +55,7 @@ module MrPoole
55
55
  # put the metadata into the layout header
56
56
  head, ext = @helper.get_layout(opts.layout)
57
57
  head.sub!(/^title:\s*$/, "title: #{opts.title}")
58
+ head.sub!(/^date:\s*$/, "date: #{@helper.get_date_stamp}")
58
59
  ext ||= @ext
59
60
 
60
61
  path = File.join(DRAFTS_FOLDER, "#{slug}.#{ext}")
@@ -87,7 +88,7 @@ module MrPoole
87
88
  outfile = File.open(outpath, "w")
88
89
 
89
90
  infile.each_line do |line|
90
- line.sub!(/^date:\s*$/, "date: #{date} #{time}\n") unless opts.keep_timestamp
91
+ line.sub!(/^date:.*$/, "date: #{date} #{time}\n") unless opts.keep_timestamp
91
92
  outfile.write(line)
92
93
  end
93
94
 
@@ -62,6 +62,16 @@ module MrPoole
62
62
  exit
63
63
  end
64
64
 
65
+ def version_statement
66
+ puts ''
67
+ puts "This is Mr. Poole, version #{MrPoole::VERSION}, running on ruby version #{RUBY_VERSION}"
68
+ puts ''
69
+ puts 'Copyright 2013, Michael McClimon'
70
+ puts 'https://github.com/mmcclimon/mr_poole'
71
+ puts ''
72
+ exit
73
+ end
74
+
65
75
  # Print a usage message and exit
66
76
  def gen_usage
67
77
  puts 'Usage:'
@@ -78,37 +88,33 @@ module MrPoole
78
88
  def post_usage
79
89
  puts 'Usage:'
80
90
  puts ' poole post [OPTION] [ARG] TITLE'
81
- puts ''
82
- puts 'Options:'
83
- puts ' --slug Define a custom slug for post, used for generated file name'
84
- puts ' (also available with -s)'
85
- puts ' --title Define a title for post (also available with -t)'
86
- puts ' This option may be omitted provided that TITLE is given as'
87
- puts ' the last argument to poole'
88
- puts ' --layout Path to a custom layout file to use (also availabe with -l)'
91
+ creation_options_usage
89
92
  exit
90
93
  end
91
94
 
92
95
  def draft_usage
93
96
  puts 'Usage:'
94
97
  puts ' poole draft [OPTION] [ARG] TITLE'
98
+ creation_options_usage
99
+ exit
100
+ end
101
+
102
+ def creation_options_usage
95
103
  puts ''
96
104
  puts 'Options:'
97
- puts ' --slug Define a custom slug for post, used for generated file name'
98
- puts ' (also available with -s)'
99
- puts ' --title Define a title for post (also available with -t)'
100
- puts ' This option may be omitted provided that TITLE is given as'
101
- puts ' the last argument to poole'
102
- puts ' --layout Path to a custom layout file to use (also availabe with -l)'
103
- exit
105
+ puts ' -s, --slug Define a custom slug for post, used for generated file name'
106
+ puts ' -t, --title Define a title for post This option may be omitted provided'
107
+ puts ' that TITLE is given as the last argument to poole'
108
+ puts ' -l, --layout Path to a custom layout file to use'
104
109
  end
105
110
 
106
111
  def publish_usage
107
112
  puts 'Usage:'
108
- puts ' poole publish PATH_TO_DRAFT'
113
+ puts ' poole publish [OPTIONS] PATH_TO_DRAFT'
109
114
  puts ''
110
115
  puts 'Options:'
111
- puts ' (coming soon)'
116
+ puts ' -d, --keep-draft Do not delete the draft post'
117
+ puts ' -t, --keep-timestamp Do not update the draft timestamp'
112
118
  exit
113
119
  end
114
120
 
@@ -1,3 +1,3 @@
1
1
  module MrPoole
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
data/lib/mr_poole.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'fileutils'
2
2
 
3
- %w{ commands helper cli config }.each do |lib|
3
+ %w{ commands helper cli config version }.each do |lib|
4
4
  require File.expand_path("../mr_poole/#{lib}", __FILE__)
5
5
  end
6
6
 
data/spec/cli_spec.rb CHANGED
@@ -19,6 +19,41 @@ module MrPoole
19
19
  end
20
20
  end # context determine jekyll dir
21
21
 
22
+ context 'no correct action' do
23
+ before(:each) { @olddir, @tmpdir = make_jekyll_dir }
24
+ after(:each) { clean_tmp_files(@tmpdir, @olddir) }
25
+
26
+ it 'prints help message with no action' do
27
+ argv = []
28
+ output = aborted_poole_output(argv).call
29
+ expect(output).to match(/poole \[ACTION\] \[ARG\]/)
30
+ end
31
+
32
+ it 'prints help message with unknown action' do
33
+ argv = ['bogusify']
34
+ output = aborted_poole_output(argv).call
35
+ expect(output).to match(/poole \[ACTION\] \[ARG\]/)
36
+ end
37
+
38
+ end
39
+
40
+ context 'version switch' do
41
+ before(:each) { @olddir, @tmpdir = make_jekyll_dir }
42
+ after(:each) { clean_tmp_files(@tmpdir, @olddir) }
43
+
44
+ it 'prints version and exits with --version' do
45
+ argv = ['--version']
46
+ output = aborted_poole_output(argv).call
47
+ expect(output).to match(/Mr[.] Poole, version /)
48
+ end
49
+
50
+ it 'prints version and exits with -v' do
51
+ argv = ['-v']
52
+ output = aborted_poole_output(argv).call
53
+ expect(output).to match(/Mr[.] Poole, version /)
54
+ end
55
+
56
+ end
22
57
  describe "action 'post'" do
23
58
  before(:each) { @olddir, @tmpdir = make_jekyll_dir }
24
59
  after(:each) { clean_tmp_files(@tmpdir, @olddir) }
@@ -246,7 +281,7 @@ module MrPoole
246
281
  argv = ['publish', '--keep-timestamp', d_path]
247
282
  new_file = poole_no_stdout(argv).call.chomp
248
283
  content = File.open(new_file, "r").read
249
- expect(content).to match(/^date:$/)
284
+ expect(content).to match(/^date: \d{4}-\d{2}-\d{2}$/)
250
285
  end
251
286
  end
252
287
  end
data/spec/command_spec.rb CHANGED
@@ -145,7 +145,7 @@ module MrPoole
145
145
  it "should not update the date in the file itself" do
146
146
  fn = c.draft({:title => "Date test post"})
147
147
  content = File.open(fn, 'r').read
148
- expect(content).to match(/date:\s*\n/)
148
+ expect(content).to match(/date: \d{4}-\d{2}-\d{2}\n/)
149
149
  end
150
150
  end # end context title only
151
151
 
data/spec/config_spec.rb CHANGED
@@ -39,6 +39,13 @@ module MrPoole
39
39
  config = Config.new
40
40
  expect(config).not_to be_empty
41
41
  end
42
+ end
43
+
44
+ describe '#inspect' do
45
+ it 'looks like OpenStruct.inspect' do
46
+ config = Config.new
47
+ expect(config.inspect).to match(/#<OpenStruct/)
48
+ end
42
49
 
43
50
  end
44
51
 
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mr_poole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
5
- prerelease:
4
+ version: 0.3.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Michael McClimon
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-22 00:00:00.000000000 Z
11
+ date: 2013-09-24 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: coveralls
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,33 +41,29 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: A butler for Jekyll, provides interface for creating posts/drafts
@@ -105,27 +96,26 @@ files:
105
96
  homepage: http://github.com/mmcclimon/mr_poole
106
97
  licenses:
107
98
  - MIT
99
+ metadata: {}
108
100
  post_install_message:
109
101
  rdoc_options: []
110
102
  require_paths:
111
103
  - lib
112
104
  required_ruby_version: !ruby/object:Gem::Requirement
113
- none: false
114
105
  requirements:
115
- - - ! '>='
106
+ - - '>='
116
107
  - !ruby/object:Gem::Version
117
108
  version: '0'
118
109
  required_rubygems_version: !ruby/object:Gem::Requirement
119
- none: false
120
110
  requirements:
121
- - - ! '>='
111
+ - - '>='
122
112
  - !ruby/object:Gem::Version
123
113
  version: '0'
124
114
  requirements: []
125
115
  rubyforge_project:
126
- rubygems_version: 1.8.24
116
+ rubygems_version: 2.1.4
127
117
  signing_key:
128
- specification_version: 3
118
+ specification_version: 4
129
119
  summary: A butler for Jekyll. Provides a command-line interface (called `poole`) for
130
120
  creating and publishing posts and drafts for Jekyll (http://jekyllrb.com) blogs. The
131
121
  literary Mr. Poole is Jekyll's butler, who "serves Jekyll faithfully, and attempts