mr_poole 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0bb58fc7fc0fff02dd0be8fae3c1de6a74dd8a4
4
- data.tar.gz: 7b4e5d81046fe6e405948da87c791745b22aa453
3
+ metadata.gz: 1acabb246f914c206b6293212d4b9c29a2b578ad
4
+ data.tar.gz: c5b2d46212caa39e5d594f289980534c9d08792e
5
5
  SHA512:
6
- metadata.gz: 663fca7eb25273cae3c580d32ec9ae7c33b5cb44458ddba6558c5b0ee1b17894a0c950e6970d7c5ad19dad89f1466f49f6d43924b8795e626df947bc9ab46df7
7
- data.tar.gz: cecba65c4d0ff57bc87ea30796cf4b1e69911a4c030712c11b30bdd967c5307e747297a78ed4cc818ee60772bddc69cda878fab434d913ee4fd83487c927c2a5
6
+ metadata.gz: 04c7545aea3b70efef6a49424a007d6d331eafad00e86b5a82ad77247bf7431fb47c3c1290146061df4069e100242884d65ac7450c47165c1e45cce925241ede
7
+ data.tar.gz: 70ec47d6126492dd7140e763a4f2404f68a7b0884ba6998a3ceca40b13f3e8061c86f516981782237fc370223529573d53da26ccd387d09f6d392a9c7491e746
data/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ### v0.7.0 (2014-10-26)
4
+
5
+ - Ability to create a custom date/time stamp via the time_format option in
6
+ the config.
7
+
3
8
  ### v0.6.0 (2014-04-02)
4
9
 
5
10
  - Ability to open new posts in editor specified in config file. Thanks
data/README.md CHANGED
@@ -128,6 +128,7 @@ should provide a `poole` key, which may take the following subkeys:
128
128
  - `default_layout` - path to a default layout to use
129
129
  - `default_extension` - file extension to use
130
130
  - `word_separator` - character to use for slug generation
131
+ - `time_format` - a percent-formatted string suitable for passing to Ruby's [Time.strftime](http://www.ruby-doc.org/core-2.1.1/Time.html#method-i-strftime) method
131
132
  - `auto_open` - set to `true`to automatically open new posts in your `$EDITOR`
132
133
 
133
134
  Any options you provide in `_config.yml` will override poole's built-in
@@ -141,7 +142,10 @@ example, if you have your default extension set to `textile`, but then pass the
141
142
  `--layout` flag to post/draft with a Markdown template, the generated post will
142
143
  use the Markdown extension.
143
144
 
144
- *Important!* If you want to use hyphens for the `word_separator` option, you'll
145
+ *Important!* Certain characters have special meaning in YAML, which means
146
+ you'll need to be careful using certain options.
147
+
148
+ If you want to use hyphens for the `word_separator` option, you'll
145
149
  need to escape it (because a single dash is the beginning a YAML bulleted
146
150
  list). If you don't, the YAML parser will choke (I don't have any control over
147
151
  this).
@@ -152,6 +156,17 @@ poole:
152
156
  word_separator: - # WRONG...don't do this!
153
157
  ```
154
158
 
159
+ Likewise, Ruby's
160
+ [`strftime`](http://www.ruby-doc.org/core-2.1.1/Time.html#method-i-strftime)
161
+ uses percent-formatted strings. The percent sign is special in YAML, so you
162
+ have to put the time format in quotation marks.
163
+
164
+ ```
165
+ poole:
166
+ time_format: "%Y-%m-%d" # correct
167
+ time_format: %Y-%m-%d # WRONG...poole will exit
168
+ ```
169
+
155
170
 
156
171
  ## To do
157
172
 
@@ -77,7 +77,8 @@ module MrPoole
77
77
  end
78
78
 
79
79
  def get_date_stamp
80
- Time.now.strftime("%Y-%m-%d")
80
+ format = @config.time_format || '%Y-%m-%d'
81
+ Time.now.strftime(format)
81
82
  end
82
83
 
83
84
  def get_time_stamp
@@ -1,3 +1,3 @@
1
1
  module MrPoole
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
data/mr_poole.gemspec CHANGED
@@ -28,7 +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 "rspec"
31
+ spec.add_development_dependency "rspec", "~> 2.14.1"
32
32
  spec.add_development_dependency "rake"
33
33
 
34
34
  if RUBY_VERSION > '1.9'
data/spec/cli_spec.rb CHANGED
@@ -155,6 +155,17 @@ module MrPoole
155
155
  end
156
156
  end # default layout in config
157
157
 
158
+ context 'custom time_format in config file' do
159
+ before(:each) { write_config_file_custom_timestamp }
160
+
161
+ it 'overrides default timestamp' do
162
+ argv = ['post', 'post title']
163
+ new_file = poole_no_stdout(argv).call.chomp
164
+ content = File.open(new_file, 'r').read
165
+ expect(content).to match(/date: \d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d/)
166
+ end
167
+ end # custom time format in config
168
+
158
169
  end # end describe post
159
170
 
160
171
  describe "action 'draft'" do
data/spec/spec_helper.rb CHANGED
@@ -150,6 +150,13 @@ def write_config_file_custom_layout
150
150
  filename
151
151
  end
152
152
 
153
+ def write_config_file_custom_timestamp
154
+ c = File.open('_config.yml', 'w')
155
+ c.puts 'poole:'
156
+ c.puts ' time_format: "%Y-%m-%d %H:%M:%S"'
157
+ c.close
158
+ end
159
+
153
160
  def write_config_file_custom_src_dir
154
161
  c = File.open('_config.yml', 'w')
155
162
  c.puts 'source: src'
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mr_poole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael McClimon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2014-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 2.14.1
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 2.14.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: coveralls
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.6.9
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.6.9
69
69
  description: A butler for Jekyll, provides interface for creating posts/drafts
@@ -74,8 +74,8 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - .gitignore
78
- - .travis.yml
77
+ - ".gitignore"
78
+ - ".travis.yml"
79
79
  - CHANGES.md
80
80
  - Gemfile
81
81
  - LICENSE
@@ -103,17 +103,17 @@ require_paths:
103
103
  - lib
104
104
  required_ruby_version: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - '>='
106
+ - - ">="
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
115
  rubyforge_project:
116
- rubygems_version: 2.2.1
116
+ rubygems_version: 2.2.2
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: A butler for Jekyll. Provides a command-line interface (called `poole`) for