jekyllpress 1.1.0 → 1.2.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: f0d47d00a72a498e56cb38afbc882595b0f3d8d4
4
- data.tar.gz: 406dfeb00c94677776c785ed4ca4bbd671f75835
3
+ metadata.gz: 2d303845fd7a9e5a934ffb643ed5be96f56132a1
4
+ data.tar.gz: 2b5ecd0f582606b9dc146fa46ae1e6ab48cc53a2
5
5
  SHA512:
6
- metadata.gz: d8adf1efd5f87f1e2d91755d0e92eb1d492cb2375b285ccda81d389767288f3b542a26d15b22b05175a432cf392f6104f51b858c6514b2ab69637b0f9a378732
7
- data.tar.gz: d652cea47db6747ce0308d6a872067ab76b7fc2c311022937ac91ab7f58a6ffc1d545301b8abd09eeef202b60b6d83f14affc61d007add7e93478766b7013794
6
+ metadata.gz: 3ba18e04440e399506f2d7d96f24f7ced67185eba89bf1e329130ac0bc464f8bcf9331a270d1ce088a9e4f49afa996ca8505641209b47232e6fc79bafa9211b0
7
+ data.tar.gz: 493444facb922e2cbbac1cec9d791ca1e60be2b03621990aad2319e95ac34fa2c44306c56223ad314f24be38514014929f2e97e07cadbe12790c04ec7a198be9
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 2015-11-24 Tamara Temple <tamouse.lists@gmail.com>
2
+
3
+ * lib/jekyllpress.rb (Jekyllpress::App#new_post): add a new
4
+ paramters to the new post command to set the location for the new
5
+ page to live.
6
+
1
7
  d1d64f0 (HEAD, origin/master, master) fix: reset @jekyll_config after reading location of configuration file.
2
8
  4822f67 (tag: v0.1.2) Update CHANGELOG, bump VERSION.
3
9
  6eed295 fix: left binding.pry in the code :((
@@ -1,3 +1,3 @@
1
1
  module Jekyllpress
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/jekyllpress.rb CHANGED
@@ -52,6 +52,7 @@ module Jekyllpress
52
52
  method_option :template, :desc => "specify an alternate template to use for the post", :type => :string
53
53
  method_option :date, :desc => "provide an alternate date for the post", :type => :string, :default => Date.today.iso8601
54
54
  method_option :time, :desc => "provide an alternate time of day for the post", :type => :string, :default => Time.now.strftime("%H:%M")
55
+ method_option :location, :desc => "Location for page to appear in directory", :type => :string, :aliases => %w[-L --loc], :default => nil
55
56
  def new_post(title="")
56
57
  check_templates
57
58
  @title = title.to_s
@@ -64,14 +65,13 @@ module Jekyllpress
64
65
  @layout = options[:layout]
65
66
  @url = options[:url]
66
67
  @template = options.fetch("template") { new_post_template }
68
+ @location = options.fetch("location", posts_dir) || posts_dir
67
69
 
68
70
  with_config do |config|
69
71
  check_templates
70
- @filename = destination(source, posts_dir, post_filename(@title, @date))
71
-
72
+ @filename = destination(source, @location, post_filename(@title, @date))
72
73
  template(File.join(template_dir, @template), @filename)
73
-
74
- [__method__, @title, @date, @time, @filename, @categories, @tags, @layout, @url, @template]
74
+ [__method__, @title, @date, @time, @filename, @categories, @tags, @layout, @url, @template, @location]
75
75
  end
76
76
  end
77
77
 
@@ -31,6 +31,7 @@ describe "my Jekyllpress Thor script" do
31
31
  FileUtils.rm_rf TEST_SITE
32
32
  `jekyll new #{TEST_SITE}`
33
33
  Dir.chdir(TEST_SITE) do |test_site|
34
+ FileUtils.mkdir_p '_my_collection'
34
35
  load 'jekyllpress.rb'
35
36
  Jekyllpress::App.start(%w[setup])
36
37
  end
@@ -45,7 +46,7 @@ describe "my Jekyllpress Thor script" do
45
46
 
46
47
  context "when using all defaults" do
47
48
  before(:all) do
48
- @action, @title, @date, @time, @filename, @categories, @tags, @layout, @url, @template =
49
+ @action, @title, @date, @time, @filename, @categories, @tags, @layout, @url, @template, @location =
49
50
  Jekyllpress::App.start(%w[new_post Using\ The\ Defaults])
50
51
  end
51
52
  it {expect(@action).to eq :new_post}
@@ -57,11 +58,12 @@ describe "my Jekyllpress Thor script" do
57
58
  it {expect(@filename).to be_a String}
58
59
  it {expect(@filename).not_to be_empty}
59
60
  it {expect(@filename).to match %r{/_posts/.*-using-the-defaults\.markdown} }
61
+ it {expect(@location).to eq "_posts"}
60
62
  end
61
63
 
62
64
  context "when using the default template" do
63
65
  before(:all) do
64
- @action, @title, @date, @time, @filename, @categories, @tags, @layout, @url, @template = Jekyllpress::App.start(%w[new_post A\ New\ Post --date=2001-01-01 --time=11:15 -c one two three -t able baker charlie -l post2 --url=https://github.com/tamouse])
66
+ @action, @title, @date, @time, @filename, @categories, @tags, @layout, @url, @template, @location = Jekyllpress::App.start(%w[new_post A\ New\ Post --date=2001-01-01 --time=11:15 -c one two three -t able baker charlie -l post2 --url=https://github.com/tamouse])
65
67
  end
66
68
 
67
69
  it {expect(@action).to eq :new_post}
@@ -76,6 +78,7 @@ describe "my Jekyllpress Thor script" do
76
78
  it {expect(@filename).to be_a String}
77
79
  it {expect(@filename).not_to be_empty}
78
80
  it {expect(@filename).to include("/_posts/2001-01-01-a-new-post.markdown")}
81
+ it {expect(@location).to eq "_posts"}
79
82
  end
80
83
 
81
84
 
@@ -96,7 +99,7 @@ EOF
96
99
 
97
100
  File.write(alt_template_file, alt_template)
98
101
 
99
- @action, @title, @date, @time, @filename, @categories, @tags, @layout, @url, @template = Jekyllpress::App.start(%w[new_post A\ New\ Post\ With\ Alt\ Template -c one two three -t able baker charlie -l link --url=https://github.com/tamouse --template=alt_post.markdown --date=2001-01-01 --time=11:15])
102
+ @action, @title, @date, @time, @filename, @categories, @tags, @layout, @url, @template, @location = Jekyllpress::App.start(%w[new_post A\ New\ Post\ With\ Alt\ Template -c one two three -t able baker charlie -l link --url=https://github.com/tamouse --template=alt_post.markdown --date=2001-01-01 --time=11:15])
100
103
  end
101
104
 
102
105
  it {expect(@action).to eq :new_post}
@@ -111,7 +114,26 @@ EOF
111
114
  it {expect(@filename).to be_a String}
112
115
  it {expect(@filename).not_to be_empty}
113
116
  it {expect(@filename).to include("/_posts/2001-01-01-a-new-post-with-alt-template.markdown")}
117
+ it {expect(@location).to eq "_posts"}
114
118
  end
119
+
120
+ context "when using a different location" do
121
+ before(:all) do
122
+ @action, @title, @date, @time, @filename, @categories, @tags, @layout, @url, @template, @location =
123
+ Jekyllpress::App.start(%w[new_post Diff-Location --location=_my_collection])
124
+ end
125
+ it {expect(@action).to eq :new_post}
126
+ it {expect(@title).to eq "Diff-Location"}
127
+ it {expect(@date).to eq Date.today.iso8601}
128
+ it {expect(@categories).to eq []}
129
+ it {expect(@tags).to eq []}
130
+ it {expect(@template).to eq 'new_post.markdown'}
131
+ it {expect(@filename).to be_a String}
132
+ it {expect(@filename).not_to be_empty}
133
+ it {expect(@filename).to match %r{/_my_collection/.*-diff-location\.markdown} }
134
+ it {expect(@location).to eq "_my_collection"}
135
+ end
136
+
115
137
  end
116
138
 
117
139
  describe ":new_page" do
@@ -213,7 +235,7 @@ EOF
213
235
 
214
236
  end
215
237
 
216
- describe ":redirect" do
238
+ xdescribe ":redirect" do
217
239
  before do
218
240
  kill_jekyll
219
241
  Dir.chdir("spec") do |spec_dir|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyllpress
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tamara Temple
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-04 00:00:00.000000000 Z
11
+ date: 2015-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -216,3 +216,4 @@ test_files:
216
216
  - spec/jekyllpress_spec.rb
217
217
  - spec/lib/jekyllpress_spec.rb
218
218
  - spec/spec_helper.rb
219
+ has_rdoc: