jekyll-assets 0.7.6 → 0.7.7
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 +4 -4
- data/.rubocop.yml +48 -0
- data/Gemfile +4 -4
- data/Rakefile +5 -3
- data/lib/jekyll-assets/bootstrap.rb +6 -7
- data/lib/jekyll-assets/bourbon.rb +0 -1
- data/lib/jekyll-assets/compass.rb +2 -4
- data/lib/jekyll-assets/neat.rb +0 -1
- data/lib/jekyll/assets_plugin/asset_path.rb +1 -9
- data/lib/jekyll/assets_plugin/configuration.rb +18 -24
- data/lib/jekyll/assets_plugin/environment.rb +4 -12
- data/lib/jekyll/assets_plugin/filters.rb +1 -5
- data/lib/jekyll/assets_plugin/patches/asset_patch.rb +6 -23
- data/lib/jekyll/assets_plugin/patches/bundled_asset_patch.rb +1 -5
- data/lib/jekyll/assets_plugin/patches/context_patch.rb +2 -7
- data/lib/jekyll/assets_plugin/patches/index_patch.rb +2 -7
- data/lib/jekyll/assets_plugin/patches/processed_asset_patch.rb +19 -18
- data/lib/jekyll/assets_plugin/patches/site_patch.rb +11 -22
- data/lib/jekyll/assets_plugin/renderer.rb +7 -16
- data/lib/jekyll/assets_plugin/tag.rb +1 -6
- data/lib/jekyll/assets_plugin/version.rb +1 -1
- data/spec/lib/jekyll-assets/bootstrap_spec.rb +10 -10
- data/spec/lib/jekyll-assets/bourbon_spec.rb +0 -1
- data/spec/lib/jekyll-assets/compass_spec.rb +0 -1
- data/spec/lib/jekyll-assets/neat_spec.rb +0 -1
- data/spec/lib/jekyll/assets_plugin/configuration_spec.rb +30 -18
- data/spec/lib/jekyll/assets_plugin/environment_spec.rb +2 -3
- data/spec/lib/jekyll/assets_plugin/filters_spec.rb +8 -6
- data/spec/lib/jekyll/assets_plugin/patches/site_patch_spec.rb +13 -22
- data/spec/lib/jekyll/assets_plugin/renderer_spec.rb +8 -13
- data/spec/lib/jekyll/assets_plugin/tag_spec.rb +8 -6
- data/spec/spec_helper.rb +3 -7
- data/spec/support/fixtures_path.rb +2 -3
- metadata +4 -3
@@ -1,13 +1,12 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
|
4
3
|
module Jekyll::AssetsPlugin
|
5
4
|
describe Environment do
|
6
5
|
context "#asset_path of context" do
|
7
6
|
it "should properly handle query params" do
|
8
7
|
css = @site.assets["vapor.css"].to_s
|
9
|
-
css.should
|
10
|
-
css.should
|
8
|
+
css.should match(/fonts\/vapor-[a-f0-9]{32}\.eot\?#iefix/)
|
9
|
+
css.should match(/fonts\/vapor-[a-f0-9]{32}\.svg#iefix/)
|
11
10
|
end
|
12
11
|
|
13
12
|
it "should properly handle relative paths" do
|
@@ -1,16 +1,15 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
|
4
3
|
module Jekyll::AssetsPlugin
|
5
4
|
describe Filters do
|
6
5
|
let(:context) { { :registers => { :site => @site } } }
|
7
6
|
|
8
|
-
def render
|
7
|
+
def render(content)
|
9
8
|
Liquid::Template.parse(content).render({}, context)
|
10
9
|
end
|
11
10
|
|
12
11
|
context "{{ '<file>' | image }}" do
|
13
|
-
def tag_re
|
12
|
+
def tag_re(name)
|
14
13
|
file = "/assets/#{name}-[a-f0-9]{32}\.png"
|
15
14
|
Regexp.new "^#{Renderer::IMAGE % file}$"
|
16
15
|
end
|
@@ -27,7 +26,7 @@ module Jekyll::AssetsPlugin
|
|
27
26
|
end
|
28
27
|
|
29
28
|
context "{{ '<file>' | stylesheet }}" do
|
30
|
-
def tag_re
|
29
|
+
def tag_re(name)
|
31
30
|
file = "/assets/#{name}-[a-f0-9]{32}\.css"
|
32
31
|
Regexp.new "^#{Renderer::STYLESHEET % file}$"
|
33
32
|
end
|
@@ -49,7 +48,7 @@ module Jekyll::AssetsPlugin
|
|
49
48
|
end
|
50
49
|
|
51
50
|
context "{{ '<file>' | javascript }}" do
|
52
|
-
def tag_re
|
51
|
+
def tag_re(name)
|
53
52
|
file = "/assets/#{name}-[a-f0-9]{32}\.js"
|
54
53
|
Regexp.new "^#{Renderer::JAVASCRIPT % file}$"
|
55
54
|
end
|
@@ -82,7 +81,10 @@ module Jekyll::AssetsPlugin
|
|
82
81
|
end
|
83
82
|
|
84
83
|
context "with baseurl given as /foobar/" do
|
85
|
-
before
|
84
|
+
before do
|
85
|
+
context[:registers][:site].assets_config.baseurl = "/foobar/"
|
86
|
+
end
|
87
|
+
|
86
88
|
subject { render("{{ 'app.css' | asset_path }}") }
|
87
89
|
it { should match(%r{^/foobar/app-[a-f0-9]{32}\.css$}) }
|
88
90
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
|
4
3
|
module Jekyll::AssetsPlugin
|
5
4
|
module Patches
|
6
5
|
describe SitePatch do
|
@@ -9,7 +8,7 @@ module Jekyll::AssetsPlugin
|
|
9
8
|
"source" => RSpecHelpers.fixtures_path.to_s,
|
10
9
|
"dirname" => "foobar",
|
11
10
|
"assets" => {
|
12
|
-
"sources" =>
|
11
|
+
"sources" => %w{ foobar _assets }
|
13
12
|
}
|
14
13
|
})
|
15
14
|
end
|
@@ -22,35 +21,33 @@ module Jekyll::AssetsPlugin
|
|
22
21
|
let(:source_path) { Pathname.new site.source }
|
23
22
|
subject { site.assets.cache_path }
|
24
23
|
|
25
|
-
it { should
|
24
|
+
it { should eq source_path.join(".jekyll-assets-cache") }
|
26
25
|
end
|
27
26
|
|
28
27
|
context "calling #asset_path within assets" do
|
29
28
|
context "when requested file not found" do
|
30
|
-
it "
|
31
|
-
|
32
|
-
|
33
|
-
end.should raise_error(Environment::AssetNotFound)
|
29
|
+
it "raises a NotFound error" do
|
30
|
+
expect { site.assets["should_fail.css"] }
|
31
|
+
.to raise_error Environment::AssetNotFound
|
34
32
|
end
|
35
33
|
end
|
36
34
|
|
37
35
|
context "when requested file found" do
|
38
36
|
it "should have proper asset path" do
|
39
|
-
|
40
|
-
|
37
|
+
expect(site.assets["app.css"].to_s)
|
38
|
+
.to match(%r{url\(/assets/noise-[a-f0-9]{32}\.png\)})
|
41
39
|
end
|
42
40
|
end
|
43
41
|
|
44
42
|
context "when passed a blank path" do
|
45
43
|
it "should be blank" do
|
46
|
-
|
47
|
-
|
44
|
+
expect(site.assets["should_be_blank.css"].to_s)
|
45
|
+
.to match(/url\(\)/)
|
48
46
|
end
|
49
47
|
end
|
50
48
|
end
|
51
49
|
end
|
52
50
|
|
53
|
-
|
54
51
|
context "#asset_path" do
|
55
52
|
subject { site.asset_path "app.css" }
|
56
53
|
|
@@ -76,7 +73,6 @@ module Jekyll::AssetsPlugin
|
|
76
73
|
end
|
77
74
|
end
|
78
75
|
|
79
|
-
|
80
76
|
context "with query part in requested filename" do
|
81
77
|
subject { site.asset_path "app.css?foo=bar" }
|
82
78
|
|
@@ -87,7 +83,7 @@ module Jekyll::AssetsPlugin
|
|
87
83
|
|
88
84
|
context "and soft cachebust" do
|
89
85
|
before { site.assets_config.cachebust = :soft }
|
90
|
-
it { should match
|
86
|
+
it { should match %r{^/assets/app\.css\?cb=[a-f0-9]{32}&foo=bar$} }
|
91
87
|
end
|
92
88
|
|
93
89
|
context "and hard cachebust" do
|
@@ -96,7 +92,6 @@ module Jekyll::AssetsPlugin
|
|
96
92
|
end
|
97
93
|
end
|
98
94
|
|
99
|
-
|
100
95
|
context "with anchor part in requested filename" do
|
101
96
|
subject { site.asset_path "app.css#foobar" }
|
102
97
|
|
@@ -117,25 +112,22 @@ module Jekyll::AssetsPlugin
|
|
117
112
|
end
|
118
113
|
end
|
119
114
|
|
120
|
-
|
121
115
|
context "#assets_config" do
|
122
116
|
subject { site.assets_config }
|
123
117
|
it { should be_an_instance_of Configuration }
|
124
118
|
|
125
119
|
it "should been populated with `assets` section of config" do
|
126
|
-
site.assets_config.dirname.should_not
|
120
|
+
site.assets_config.dirname.should_not eq "foobar"
|
127
121
|
site.assets_config.sources.should include "foobar"
|
128
122
|
end
|
129
123
|
end
|
130
124
|
|
131
|
-
|
132
125
|
it "should regenerate assets upon multiple #process" do
|
133
126
|
@site.assets_config.cachebust = :none
|
134
|
-
2.times{ @site.process }
|
127
|
+
2.times { @site.process }
|
135
128
|
@dest.join("assets", "app.css").exist?.should be_true
|
136
129
|
end
|
137
130
|
|
138
|
-
|
139
131
|
context "with cache" do
|
140
132
|
def site
|
141
133
|
Jekyll::Site.new(Jekyll.configuration({
|
@@ -150,12 +142,11 @@ module Jekyll::AssetsPlugin
|
|
150
142
|
end
|
151
143
|
|
152
144
|
it "should regenerate static assets upon multiple #process" do
|
153
|
-
2.times{ site.process }
|
145
|
+
2.times { site.process }
|
154
146
|
@dest.join("assets", "noise.png").exist?.should be_true
|
155
147
|
end
|
156
148
|
end
|
157
149
|
|
158
|
-
|
159
150
|
context "#gzip" do
|
160
151
|
subject { site.assets_config }
|
161
152
|
|
@@ -1,10 +1,8 @@
|
|
1
1
|
# stdlib
|
2
2
|
require "ostruct"
|
3
3
|
|
4
|
-
|
5
4
|
require "spec_helper"
|
6
5
|
|
7
|
-
|
8
6
|
module Jekyll::AssetsPlugin
|
9
7
|
describe Renderer do
|
10
8
|
|
@@ -16,39 +14,36 @@ module Jekyll::AssetsPlugin
|
|
16
14
|
})
|
17
15
|
end
|
18
16
|
|
19
|
-
|
20
17
|
let(:renderer) do
|
21
18
|
context = OpenStruct.new(:registers => { :site => site })
|
22
19
|
Renderer.new context, "app"
|
23
20
|
end
|
24
21
|
|
25
|
-
|
26
22
|
describe "#render_javascript" do
|
27
23
|
subject { renderer.render_javascript }
|
28
24
|
|
29
25
|
context "when debug mode enabled" do
|
30
|
-
let(:assets_config){ Hash[:debug, true] }
|
31
|
-
it { should match
|
26
|
+
let(:assets_config) { Hash[:debug, true] }
|
27
|
+
it { should match(/^(\s*<script src="[^"]+"><\/script>\s*){3}$/) }
|
32
28
|
end
|
33
29
|
|
34
30
|
context "when debug mode disabled" do
|
35
|
-
let(:assets_config){ Hash[:debug, false] }
|
36
|
-
it { should match
|
31
|
+
let(:assets_config) { Hash[:debug, false] }
|
32
|
+
it { should match(/^(\s*<script src="[^"]+"><\/script>\s*){1}$/) }
|
37
33
|
end
|
38
34
|
end
|
39
35
|
|
40
|
-
|
41
36
|
describe "#render_stylesheet" do
|
42
37
|
subject { renderer.render_stylesheet }
|
43
38
|
|
44
39
|
context "when debug mode enabled" do
|
45
|
-
let(:assets_config){ Hash[:debug, true] }
|
46
|
-
it { should match
|
40
|
+
let(:assets_config) { Hash[:debug, true] }
|
41
|
+
it { should match(/^(\s*<link rel="stylesheet" [^>]+>\s*){3}$/) }
|
47
42
|
end
|
48
43
|
|
49
44
|
context "when debug mode disabled" do
|
50
|
-
let(:assets_config){ Hash[:debug, false] }
|
51
|
-
it { should match
|
45
|
+
let(:assets_config) { Hash[:debug, false] }
|
46
|
+
it { should match(/^(\s*<link rel="stylesheet" [^>]+>\s*){1}$/) }
|
52
47
|
end
|
53
48
|
end
|
54
49
|
|
@@ -1,16 +1,15 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
|
4
3
|
module Jekyll::AssetsPlugin
|
5
4
|
describe Tag do
|
6
5
|
let(:context) { { :registers => { :site => @site } } }
|
7
6
|
|
8
|
-
def render
|
7
|
+
def render(content)
|
9
8
|
Liquid::Template.parse(content).render({}, context)
|
10
9
|
end
|
11
10
|
|
12
11
|
context "{% image <file> %}" do
|
13
|
-
def tag_re
|
12
|
+
def tag_re(name)
|
14
13
|
file = "/assets/#{name}-[a-f0-9]{32}\.png"
|
15
14
|
Regexp.new "^#{Renderer::IMAGE % file}$"
|
16
15
|
end
|
@@ -27,7 +26,7 @@ module Jekyll::AssetsPlugin
|
|
27
26
|
end
|
28
27
|
|
29
28
|
context "{% stylesheet <file> %}" do
|
30
|
-
def tag_re
|
29
|
+
def tag_re(name)
|
31
30
|
file = "/assets/#{name}-[a-f0-9]{32}\.css"
|
32
31
|
Regexp.new "^#{Renderer::STYLESHEET % file}$"
|
33
32
|
end
|
@@ -49,7 +48,7 @@ module Jekyll::AssetsPlugin
|
|
49
48
|
end
|
50
49
|
|
51
50
|
context "{% javascript <file> %}" do
|
52
|
-
def tag_re
|
51
|
+
def tag_re(name)
|
53
52
|
file = "/assets/#{name}-[a-f0-9]{32}\.js"
|
54
53
|
Regexp.new "^#{Renderer::JAVASCRIPT % file}$"
|
55
54
|
end
|
@@ -82,7 +81,10 @@ module Jekyll::AssetsPlugin
|
|
82
81
|
end
|
83
82
|
|
84
83
|
context "with baseurl given as /foobar/" do
|
85
|
-
before
|
84
|
+
before do
|
85
|
+
context[:registers][:site].assets_config.baseurl = "/foobar/"
|
86
|
+
end
|
87
|
+
|
86
88
|
subject { render("{% asset_path app.css %}") }
|
87
89
|
it { should match(%r{^/foobar/app-[a-f0-9]{32}\.css$}) }
|
88
90
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,26 +1,22 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
|
3
|
-
|
4
|
-
require 'simplecov'
|
3
|
+
require "simplecov"
|
5
4
|
require "coveralls"
|
6
5
|
|
7
|
-
|
8
6
|
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
9
7
|
SimpleCov::Formatter::HTMLFormatter,
|
10
8
|
Coveralls::SimpleCov::Formatter
|
11
9
|
]
|
12
10
|
SimpleCov.start
|
13
11
|
|
14
|
-
|
15
12
|
require "jekyll"
|
16
13
|
require "liquid"
|
17
14
|
require "sprockets"
|
18
15
|
|
19
|
-
|
20
16
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
21
17
|
# in spec/support/ and its subdirectories.
|
22
|
-
Dir[File.expand_path("../support", __FILE__) + "/**/*.rb"]
|
23
|
-
|
18
|
+
Dir[File.expand_path("../support", __FILE__) + "/**/*.rb"]
|
19
|
+
.each { |f| require f }
|
24
20
|
|
25
21
|
RSpec.configure do |config|
|
26
22
|
config.include Jekyll::AssetsPlugin::RSpecHelpers
|
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.7.
|
4
|
+
version: 0.7.7
|
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-
|
11
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -162,6 +162,7 @@ extra_rdoc_files: []
|
|
162
162
|
files:
|
163
163
|
- .gitignore
|
164
164
|
- .rspec
|
165
|
+
- .rubocop.yml
|
165
166
|
- .travis.yml
|
166
167
|
- .yardopts
|
167
168
|
- Gemfile
|
@@ -248,7 +249,7 @@ rubyforge_project:
|
|
248
249
|
rubygems_version: 2.0.3
|
249
250
|
signing_key:
|
250
251
|
specification_version: 4
|
251
|
-
summary: jekyll-assets-0.7.
|
252
|
+
summary: jekyll-assets-0.7.7
|
252
253
|
test_files:
|
253
254
|
- spec/fixtures/.gitignore
|
254
255
|
- spec/fixtures/_assets/app.css.erb
|