jekyll-assets 0.12.1 → 0.13.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: 4b13b9ae4b4a5eae8cb3afdf1e3d46e3b7b0ca23
4
- data.tar.gz: 811a606087a27842d0b2b1a65d1720a734830712
3
+ metadata.gz: 1486650f4f5b1efb09c5b1702d8f052e6b736a87
4
+ data.tar.gz: aac54191d17adae04afea7a41662310f160a50f8
5
5
  SHA512:
6
- metadata.gz: 2aba32817397a9efc3daa1b63d213a3172a434a520c8ee0f69019ed3698c9308c438a1979fe8a4cd6da823d1deecbb556bd294bd04f6b9292ac01b4f60e1322c
7
- data.tar.gz: e63294b112e63448dc5383c4f2346db0923649e93b0ffe3813eec2aa25e5d5f208326b00fa4e2b3ddc1f6f16f0e5249ab7ccaa6554c5ca7eead2c5b4846f1859
6
+ metadata.gz: aac486f0eb18fd587fc992e542b26d27fc0438998dbe397be8c23936d948d684f2825a3f495327a16fd6dd0d2b090d1ee96e8dd71c57af34428eeac3c84d45ff
7
+ data.tar.gz: b92ff5a3abc206ca4612a8154c9ecbf3268c5c33ed6919abe9c3f898a1ef1de0bea20a83aabf2e45dcab64dd7ff1013574569f3480a1843db2f1e3ed4737deaf
data/HISTORY.md CHANGED
@@ -1,6 +1,11 @@
1
1
  ### master (unreleased)
2
2
 
3
3
 
4
+ ### 0.13.0 (2015-02-01)
5
+
6
+ * Respect Jekyll config's `baseurl` when auto-guessing baseurl. See #125.
7
+
8
+
4
9
  ### 0.12.1 (2014-12-08)
5
10
 
6
11
  * Fix regression with image attributes when `autosize` is used. See #117.
@@ -161,6 +166,11 @@
161
166
  * Update jekyll dependency `~> 1.0`
162
167
 
163
168
 
169
+ ### 0.4.3 (2014-12-21)
170
+
171
+ * Fix configuration reader. See #119.
172
+
173
+
164
174
  ### 0.4.2 (2013-05-08)
165
175
 
166
176
  * Require jekyll < 1.0.0. This is a the last release with support of 0.x branch
@@ -19,7 +19,8 @@ module Jekyll
19
19
  :version => 1
20
20
  }.freeze
21
21
 
22
- def initialize(config = {})
22
+ def initialize(site, config = {})
23
+ @site = site
23
24
  @data = OpenStruct.new DEFAULTS.merge(config)
24
25
 
25
26
  @data.sources = [@data.sources] if @data.sources.is_a? String
@@ -30,12 +31,16 @@ module Jekyll
30
31
  @data.js_compressor ||= compress.js
31
32
  @data.css_compressor ||= compress.css
32
33
  @data.cache ||= @data.cache_assets
33
-
34
- # if baseurl not given - autoguess base on dirname
35
- @data.baseurl ||= "/#{@data.dirname}/".squeeze "/"
36
34
  end
37
35
 
38
36
  def baseurl
37
+ unless @data.baseurl
38
+ baseurl = "/" << [@site.config["baseurl"], @data.dirname].join("/")
39
+
40
+ # if baseurl not given - autoguess base on dirname
41
+ @data.baseurl = baseurl.squeeze("/")
42
+ end
43
+
39
44
  @data.baseurl.chomp "/"
40
45
  end
41
46
 
@@ -21,7 +21,7 @@ module Jekyll
21
21
  end
22
22
 
23
23
  def assets_config
24
- @assets_config ||= Configuration.new(config["assets"] || {})
24
+ @assets_config ||= Configuration.new(self, config["assets"] || {})
25
25
  end
26
26
 
27
27
  def assets
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module AssetsPlugin
3
- VERSION = "0.12.1"
3
+ VERSION = "0.13.0"
4
4
  end
5
5
  end
@@ -1,9 +1,10 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe Jekyll::AssetsPlugin::Configuration do
4
- context "with defaults" do
5
- let(:config) { described_class.new }
4
+ let(:options) { {} }
5
+ subject(:config) { described_class.new(@site, options) }
6
6
 
7
+ context "with defaults" do
7
8
  context "output assets dirname" do
8
9
  subject { config.dirname }
9
10
  it { is_expected.to eq described_class::DEFAULTS[:dirname] }
@@ -62,7 +63,7 @@ RSpec.describe Jekyll::AssetsPlugin::Configuration do
62
63
  end
63
64
 
64
65
  it "overrides specified options and leave defaults for missing" do
65
- config = described_class.new({
66
+ config = described_class.new(@site, {
66
67
  :sources => %w(abc),
67
68
  :css_compressor => "sass"
68
69
  })
@@ -75,95 +76,88 @@ RSpec.describe Jekyll::AssetsPlugin::Configuration do
75
76
 
76
77
  context "#cache" do
77
78
  context "when specified as String" do
79
+ let(:options) { { :cache => "/tmp/jekyll-assets" } }
80
+
78
81
  it "overrides default cache path" do
79
- config = described_class.new :cache => "/tmp/jekyll-assets"
80
82
  expect(config.cache_path).to eq("/tmp/jekyll-assets")
81
83
  end
82
84
  end
83
85
  end
84
86
 
85
87
  context "#baseurl" do
86
- it "respects explicit overrides" do
87
- expect(described_class.new({
88
- :dirname => "foo",
89
- :baseurl => "/bar/"
90
- }).baseurl).to eq("/bar")
88
+ subject { config.baseurl }
89
+
90
+ context "when given" do
91
+ let(:options) { { :dirname => "foo", :baseurl => "/bar/" } }
92
+ it { is_expected.to eq "/bar" }
91
93
  end
92
94
 
93
- it "is auto-guessed from dirname" do
94
- expect(described_class.new({
95
- :dirname => "foo"
96
- }).baseurl).to eq("/foo")
95
+ context "when not explicitly given" do
96
+ let(:options) { { :dirname => "foo" } }
97
+ it { is_expected.to eq "/foo" }
98
+
99
+ context "and site has baseurl config" do
100
+ before { @site.config["baseurl"] = "/blog" }
101
+ it { is_expected.to eq "/blog/foo" }
102
+ end
97
103
  end
98
104
  end
99
105
 
100
106
  context "#js_compressor" do
107
+ subject { config.js_compressor }
108
+
101
109
  context "when js compressor is given as `uglify`" do
102
- let(:config) { described_class.new(:js_compressor => "uglify") }
103
- subject { config.js_compressor }
110
+ let(:options) { { :js_compressor => "uglify" } }
104
111
  it { is_expected.to be :uglify }
105
112
  end
106
113
 
107
114
  context "otherwise" do
108
- let(:config) { described_class.new }
109
- subject { config.js_compressor }
110
115
  it { is_expected.to be_falsey }
111
116
  end
112
117
  end
113
118
 
114
119
  context "#css_compressor" do
120
+ subject { config.css_compressor }
121
+
115
122
  context "when css compressor is given as `sass`" do
116
- let(:config) { described_class.new(:css_compressor => "sass") }
117
- subject { config.css_compressor }
123
+ let(:options) { { :css_compressor => "sass" } }
118
124
  it { is_expected.to be :sass }
119
125
  end
120
126
 
121
127
  context "otherwise" do
122
- let(:config) { described_class.new }
123
- subject { config.css_compressor }
124
128
  it { is_expected.to be_falsey }
125
129
  end
126
130
  end
127
131
 
128
132
  context "#gzip" do
133
+ subject { config.gzip }
134
+
129
135
  context "when gzip is disabled" do
130
- let(:config) { described_class.new(:gzip => false) }
131
- subject { config.gzip }
136
+ let(:options) { { :gzip => false } }
132
137
  it { is_expected.to eq [] }
133
138
  end
134
139
  end
135
140
 
136
141
  context "#version" do
137
- subject { described_class.new(:version => version).version }
142
+ let(:options) { { :version => "abc" } }
143
+ subject { config.version }
138
144
 
139
- context "when given as 123" do
140
- let(:version) { 123 }
141
- it { is_expected.to eq 123 }
142
- it { is_expected.to be_a Integer }
143
- end
144
-
145
- context "when given as 'abc'" do
146
- let(:version) { "abc" }
147
- it { is_expected.to eq "abc" }
148
- it { is_expected.to be_a String }
149
- end
145
+ it { is_expected.to be options.fetch(:version) }
150
146
  end
151
147
 
152
148
  context "Deprecated options" do
153
- subject(:config) { described_class.new options }
154
-
155
149
  context "compress" do
156
150
  let :options do
157
151
  { :compress => { :js => "uglify", :css => "sass" } }
158
152
  end
159
153
 
160
154
  describe "#js_compressor" do
161
- subject { super().js_compressor }
155
+ subject { config.js_compressor }
162
156
  it { is_expected.to be :uglify }
163
157
  end
164
158
 
165
159
  describe "#css_compressor" do
166
- subject { super().css_compressor }
160
+ subject { config.css_compressor }
167
161
  it { is_expected.to be :sass }
168
162
  end
169
163
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksey V Zapparov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-08 00:00:00.000000000 Z
11
+ date: 2015-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -215,7 +215,7 @@ rubyforge_project:
215
215
  rubygems_version: 2.2.2
216
216
  signing_key:
217
217
  specification_version: 4
218
- summary: jekyll-assets-0.12.1
218
+ summary: jekyll-assets-0.13.0
219
219
  test_files:
220
220
  - spec/fixtures/.gitignore
221
221
  - spec/fixtures/_assets/alert.js