mr_poole 0.2.1 → 0.2.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.
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### v0.2.2 (2013-09-22)
4
+
5
+ - Bugfix so that poole works on ruby 1.9.3
6
+
3
7
  ### v0.2.1 (2013-09-22)
4
8
 
5
9
  - Command-line methods now echo a filename (useful for piping into editor)
@@ -13,19 +13,20 @@ module MrPoole
13
13
 
14
14
  # Generate a timestamped post
15
15
  def post(opts)
16
+ opts = @helper.ensure_open_struct(opts)
16
17
  date = @helper.get_date_stamp
17
18
 
18
19
  # still want to escape any garbage in the slug
19
- slug = if opts[:slug].nil? || opts[:slug].empty?
20
- opts[:title]
20
+ slug = if opts.slug.nil? || opts.slug.empty?
21
+ opts.title
21
22
  else
22
- opts[:slug]
23
+ opts.slug
23
24
  end
24
25
  slug = @helper.get_slug_for(slug)
25
26
 
26
27
  # put the metadata into the layout header
27
- head, ext = @helper.get_layout(opts[:layout])
28
- head.sub!(/^title:\s*$/, "title: #{opts[:title]}")
28
+ head, ext = @helper.get_layout(opts.layout)
29
+ head.sub!(/^title:\s*$/, "title: #{opts.title}")
29
30
  head.sub!(/^date:\s*$/, "date: #{date}")
30
31
  ext ||= @ext
31
32
 
@@ -39,19 +40,21 @@ module MrPoole
39
40
 
40
41
  # Generate a non-timestamped draft
41
42
  def draft(opts)
43
+ opts = @helper.ensure_open_struct(opts)
44
+
42
45
  # the drafts folder might not exist yet...create it just in case
43
46
  FileUtils.mkdir_p(DRAFTS_FOLDER)
44
47
 
45
- slug = if opts[:slug].nil? || opts[:slug].empty?
46
- opts[:title]
48
+ slug = if opts.slug.nil? || opts.slug.empty?
49
+ opts.title
47
50
  else
48
- opts[:slug]
51
+ opts.slug
49
52
  end
50
53
  slug = @helper.get_slug_for(slug)
51
54
 
52
55
  # put the metadata into the layout header
53
- head, ext = @helper.get_layout(opts[:layout])
54
- head.sub!(/^title:\s*$/, "title: #{opts[:title]}")
56
+ head, ext = @helper.get_layout(opts.layout)
57
+ head.sub!(/^title:\s*$/, "title: #{opts.title}")
55
58
  ext ||= @ext
56
59
 
57
60
  path = File.join(DRAFTS_FOLDER, "#{slug}.#{ext}")
@@ -14,7 +14,7 @@ module MrPoole
14
14
  end
15
15
 
16
16
  def empty?
17
- @config.to_h.empty?
17
+ @config == OpenStruct.new
18
18
  end
19
19
 
20
20
  def inspect
@@ -15,6 +15,10 @@ module MrPoole
15
15
  end
16
16
  end
17
17
 
18
+ def ensure_open_struct(opts)
19
+ return opts.instance_of?(Hash) ? OpenStruct.new(opts) : opts
20
+ end
21
+
18
22
  # Get a layout as a string. If layout_path is non-nil, will open that
19
23
  # file and read it, otherwise will return a default one, and a file
20
24
  # extension to use
@@ -1,3 +1,3 @@
1
1
  module MrPoole
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
data/spec/command_spec.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'spec_helper'
2
4
  require 'mr_poole'
3
5
 
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mr_poole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Michael McClimon
@@ -13,6 +14,7 @@ dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,29 +30,33 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rspec
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rake
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  description: A butler for Jekyll, provides interface for creating posts/drafts
@@ -81,26 +88,27 @@ files:
81
88
  homepage: http://github.com/mmcclimon/mr_poole
82
89
  licenses:
83
90
  - MIT
84
- metadata: {}
85
91
  post_install_message:
86
92
  rdoc_options: []
87
93
  require_paths:
88
94
  - lib
89
95
  required_ruby_version: !ruby/object:Gem::Requirement
96
+ none: false
90
97
  requirements:
91
- - - '>='
98
+ - - ! '>='
92
99
  - !ruby/object:Gem::Version
93
100
  version: '0'
94
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
95
103
  requirements:
96
- - - '>='
104
+ - - ! '>='
97
105
  - !ruby/object:Gem::Version
98
106
  version: '0'
99
107
  requirements: []
100
108
  rubyforge_project:
101
- rubygems_version: 2.1.4
109
+ rubygems_version: 1.8.24
102
110
  signing_key:
103
- specification_version: 4
111
+ specification_version: 3
104
112
  summary: A butler for Jekyll. Provides a command-line interface (called `poole`) for
105
113
  creating and publishing posts and drafts for Jekyll (http://jekyllrb.com) blogs. The
106
114
  literary Mr. Poole is Jekyll's butler, who "serves Jekyll faithfully, and attempts
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 348c60dc739c0d74aca225020adcafaef4b972be
4
- data.tar.gz: f15c9fc736df931ea84213845e9665cabac84ff3
5
- SHA512:
6
- metadata.gz: e02d0164747f81f95cd9e7073ecda9e00dcf2a1fd330bd9442da2d0a3862dc2395fb1e0eae8210b38b8f14645b519cb095a316981f0514c2417dfce5ca844ed8
7
- data.tar.gz: 50457e40e867b1d275bd359b373b38b0d043a35ceead08168e8d67c3691ee085263e803df4a75e6f41529865f24e1e1ef6c05c263773b998e96fc61d18e6ff1e