jekyll-assets 0.7.7 → 0.7.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,12 +23,30 @@ BlockNesting:
23
23
  HashSyntax:
24
24
  EnforcedStyle: hash_rockets
25
25
 
26
- Encoding:
27
- Enabled: false
28
-
29
26
  StringLiterals:
30
27
  EnforcedStyle: double_quotes
31
28
 
29
+ AlignParameters:
30
+ EnforcedStyle: with_fixed_indentation
31
+
32
+ IndentHash:
33
+ EnforcedStyle: consistent
34
+
35
+ PercentLiteralDelimiters:
36
+ PreferredDelimiters:
37
+ '%': ()
38
+ '%i': ()
39
+ '%q': ()
40
+ '%Q': ()
41
+ '%r': '{}'
42
+ '%s': ()
43
+ '%w': '[]'
44
+ '%W': '[]'
45
+ '%x': ()
46
+
47
+ Encoding:
48
+ Enabled: false
49
+
32
50
  BracesAroundHashParameters:
33
51
  Enabled: false
34
52
 
@@ -43,6 +61,14 @@ TrivialAccessors:
43
61
  Lambda:
44
62
  Enabled: false
45
63
 
64
+ # Ridiculous (and IMHO useless) restriction, that makes impossible aligning
65
+ # code like this:
66
+ #
67
+ # redis.hset :k1, now
68
+ # redis.hincrby :k2, 123
69
+ SingleSpaceBeforeFirstArg:
70
+ Enabled: false
71
+
46
72
  AllCops:
47
- Includes:
73
+ Include:
48
74
  - Gemfile
@@ -1,2 +1,9 @@
1
1
  language: ruby
2
- rvm: [ 1.9.3, 2.0.0 ]
2
+
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+
7
+ gemfile:
8
+ - Gemfile
9
+ - Gemfile.jekyll-1.0
data/Gemfile CHANGED
@@ -7,5 +7,9 @@ group :test do
7
7
  gem "simplecov", :require => false
8
8
  end
9
9
 
10
+ group :development do
11
+ gem "guard-rspec"
12
+ end
13
+
10
14
  # Specify your gem's dependencies in jekyll-assets.gemspec
11
15
  gemspec
@@ -0,0 +1,2 @@
1
+ eval_gemfile "Gemfile"
2
+ gem "jekyll", "~> 1.0"
data/HISTORY.md CHANGED
@@ -1,3 +1,23 @@
1
+ ### 0.7.8 (2014-05-08)
2
+
3
+ * Support jekyll `~> 2.0`.
4
+
5
+
6
+ ### 0.7.7 (2014-03-12)
7
+
8
+ * Allow purge cache by bumping assest config version.
9
+
10
+
11
+ ### 0.7.6 (2014-02-22)
12
+
13
+ * Add `bootstrap-sass` support. See #75. (Thanks @adilsoncarvalho)
14
+
15
+
16
+ ### 0.7.5 (2014-02-11)
17
+
18
+ * Fix `asset_path` error against empty srting. See #72. (Thanks @yaegashi)
19
+
20
+
1
21
  ### 0.7.4 (2013-10-25)
2
22
 
3
23
  * Fix relative paths requires. See #59. (Thanks @wadetandy)
data/README.md CHANGED
@@ -505,6 +505,11 @@ assets:
505
505
  # Default: false
506
506
  #
507
507
  debug: false
508
+ #
509
+ # Configuration version. Used to force cache invalidation.
510
+ # Default: 1
511
+ #
512
+ version: 1
508
513
  ```
509
514
 
510
515
 
@@ -23,15 +23,19 @@ Gem::Specification.new do |spec|
23
23
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_dependency "jekyll", "~> 1.0"
26
+ spec.add_dependency "jekyll", ">= 1.0.0", "< 3.0.0"
27
27
  spec.add_dependency "sprockets", "~> 2.10"
28
+ spec.add_dependency "sass"
28
29
 
29
30
  spec.add_development_dependency "bundler", "~> 1.3"
30
31
  spec.add_development_dependency "rake"
31
32
  spec.add_development_dependency "rspec"
32
- spec.add_development_dependency "guard-rspec"
33
33
  spec.add_development_dependency "compass"
34
34
  spec.add_development_dependency "bourbon"
35
35
  spec.add_development_dependency "neat"
36
36
  spec.add_development_dependency "bootstrap-sass"
37
+
38
+ # compass fails with SASS than 3.3+
39
+ # https://github.com/chriseppstein/compass/issues/1513
40
+ spec.add_development_dependency "sass", "~> 3.2.13"
37
41
  end
@@ -1 +1,2 @@
1
+ # rubocop: disable FileName
1
2
  require "jekyll/assets_plugin"
@@ -1,6 +1,6 @@
1
1
  require "sprockets"
2
2
 
3
3
  bootstrap = Gem::Specification.find_by_name("bootstrap-sass").gem_dir
4
- %w(fonts javascripts stylesheets).each do |asset|
4
+ %w[fonts javascripts stylesheets].each do |asset|
5
5
  Sprockets.append_path File.join(bootstrap, "vendor", "assets", asset)
6
6
  end
@@ -20,9 +20,11 @@ module Jekyll
20
20
  query = []
21
21
 
22
22
  query << "cb=#{@asset.digest}" if :soft == cachebust
23
- query << @query if @query
23
+ query << @query if @query
24
24
 
25
- "?#{query.join '&'}" unless query.empty?
25
+ return if query.empty?
26
+
27
+ "?" << query.join("&")
26
28
  end
27
29
 
28
30
  def anchor
@@ -6,14 +6,14 @@ module Jekyll
6
6
  class Configuration
7
7
  DEFAULTS = {
8
8
  :dirname => "assets",
9
- :sources => %w{ _assets/javascripts
10
- _assets/stylesheets
11
- _assets/images },
9
+ :sources => %w[_assets/javascripts
10
+ _assets/stylesheets
11
+ _assets/images],
12
12
  :js_compressor => nil,
13
13
  :css_compressor => nil,
14
14
  :cachebust => :hard,
15
15
  :cache => false,
16
- :gzip => %w{ text/css application/javascript },
16
+ :gzip => %w[text/css application/javascript],
17
17
  :debug => false,
18
18
  :version => 1
19
19
  }.freeze
@@ -53,7 +53,7 @@ module Jekyll
53
53
  end
54
54
 
55
55
  def cache_assets?
56
- !!@data.cache
56
+ @data.cache ? true : false
57
57
  end
58
58
 
59
59
  def cache_path
@@ -4,7 +4,7 @@ require "jekyll/assets_plugin/renderer"
4
4
  module Jekyll
5
5
  module AssetsPlugin
6
6
  module Filters
7
- %w{ asset asset_path image javascript stylesheet }.each do |name|
7
+ %w[asset asset_path image javascript stylesheet].each do |name|
8
8
  module_eval <<-RUBY, __FILE__, __LINE__
9
9
  def #{name} path # def stylesheet logical_path
10
10
  r = Renderer.new @context, path # r = Renderer.new @context, path
@@ -13,10 +13,10 @@ module Jekyll
13
13
  attr_reader :jekyll_assets
14
14
 
15
15
  alias_method :__orig_build_dependency_paths,
16
- :build_dependency_paths
16
+ :build_dependency_paths
17
17
 
18
18
  alias_method :build_dependency_paths,
19
- :__wrap_build_dependency_paths
19
+ :__wrap_build_dependency_paths
20
20
 
21
21
  alias_method :__orig_init_with, :init_with
22
22
  alias_method :init_with, :__wrap_init_with
@@ -37,7 +37,7 @@ module Jekyll
37
37
  def render_tag(template)
38
38
  asset = @site.assets[@path]
39
39
  tags = (@site.assets_config.debug ? asset.to_a : [asset]).map do |a|
40
- sprintf template, AssetPath.new(a).to_s
40
+ format template, AssetPath.new(a).to_s
41
41
  end
42
42
 
43
43
  tags.join "\n"
@@ -14,6 +14,6 @@ module Jekyll
14
14
  end
15
15
  end
16
16
 
17
- %w{ asset asset_path image javascript stylesheet }.each do |tag|
17
+ %w[asset asset_path image javascript stylesheet].each do |tag|
18
18
  Liquid::Template.register_tag tag, Jekyll::AssetsPlugin::Tag
19
19
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module AssetsPlugin
3
- VERSION = "0.7.7"
3
+ VERSION = "0.7.8"
4
4
  end
5
5
  end
@@ -1,10 +1,8 @@
1
1
  require "spec_helper"
2
2
  require "jekyll-assets/bootstrap"
3
3
 
4
- module Jekyll::AssetsPlugin
5
- describe "Bootstrap integration" do
6
- it "should globally append bootstrap paths into Sprockets environment" do
7
- @site.assets["bootstrap.css"].to_s.should =~ /bootstrap\//
8
- end
4
+ describe "Bootstrap integration" do
5
+ it "should globally append bootstrap paths into Sprockets environment" do
6
+ @site.assets["bootstrap.css"].to_s.should =~ /bootstrap\//
9
7
  end
10
8
  end
@@ -1,10 +1,8 @@
1
1
  require "spec_helper"
2
2
  require "jekyll-assets/bourbon"
3
3
 
4
- module Jekyll::AssetsPlugin
5
- describe "Bourbon integration" do
6
- it "should globally append bourbon paths into Sprockets environment" do
7
- @site.assets["vendor/bourbon.css"].to_s.should =~ /linear-gradient/
8
- end
4
+ describe "Bourbon integration" do
5
+ it "should globally append bourbon paths into Sprockets environment" do
6
+ @site.assets["vendor/bourbon.css"].to_s.should =~ /linear-gradient/
9
7
  end
10
8
  end
@@ -1,10 +1,8 @@
1
1
  require "spec_helper"
2
2
  require "jekyll-assets/compass"
3
3
 
4
- module Jekyll::AssetsPlugin
5
- describe "Compass integration" do
6
- it "should globally append compass paths into Sprockets environment" do
7
- @site.assets["vendor/compass.css"].to_s.should =~ /linear-gradient/
8
- end
4
+ describe "Compass integration" do
5
+ it "should globally append compass paths into Sprockets environment" do
6
+ @site.assets["vendor/compass.css"].to_s.should =~ /linear-gradient/
9
7
  end
10
8
  end
@@ -1,10 +1,8 @@
1
1
  require "spec_helper"
2
2
  require "jekyll-assets/neat"
3
3
 
4
- module Jekyll::AssetsPlugin
5
- describe "Neat integration" do
6
- it "should globally append neat paths into Sprockets environment" do
7
- @site.assets["vendor/neat.css"].to_s.should =~ /max-width/
8
- end
4
+ describe "Neat integration" do
5
+ it "should globally append neat paths into Sprockets environment" do
6
+ @site.assets["vendor/neat.css"].to_s.should =~ /max-width/
9
7
  end
10
8
  end
@@ -1,166 +1,166 @@
1
1
  require "spec_helper"
2
2
 
3
- module Jekyll::AssetsPlugin
4
- describe Configuration do
5
- context "with defaults" do
6
- let(:config) { Configuration.new }
7
-
8
- context "output assets dirname" do
9
- subject { config.dirname }
10
- it { should == Configuration::DEFAULTS[:dirname] }
11
- end
3
+ describe Jekyll::AssetsPlugin::Configuration do
4
+ context "with defaults" do
5
+ let(:config) { described_class.new }
12
6
 
13
- context "assets baseurl" do
14
- subject { config.baseurl }
15
- it { should == "/" + Configuration::DEFAULTS[:dirname] }
16
- end
7
+ context "output assets dirname" do
8
+ subject { config.dirname }
9
+ it { should == described_class::DEFAULTS[:dirname] }
10
+ end
17
11
 
18
- context "sources list" do
19
- subject { config.sources }
20
- it { should =~ Configuration::DEFAULTS[:sources] }
21
- end
12
+ context "assets baseurl" do
13
+ subject { config.baseurl }
14
+ it { should == "/" + described_class::DEFAULTS[:dirname] }
15
+ end
22
16
 
23
- context "cachebust" do
24
- subject { config.cachebust }
25
- it { should == :hard }
26
- end
17
+ context "sources list" do
18
+ subject { config.sources }
19
+ it { should =~ described_class::DEFAULTS[:sources] }
20
+ end
27
21
 
28
- context "js compressor" do
29
- subject { config.js_compressor }
30
- it { should be_nil }
31
- end
22
+ context "cachebust" do
23
+ subject { config.cachebust }
24
+ it { should == :hard }
25
+ end
32
26
 
33
- context "css compressor" do
34
- subject { config.css_compressor }
35
- it { should be_nil }
36
- end
27
+ context "js compressor" do
28
+ subject { config.js_compressor }
29
+ it { should be_nil }
30
+ end
37
31
 
38
- context "gzip" do
39
- subject { config.gzip }
40
- it { should =~ %w{ text/css application/javascript } }
41
- end
32
+ context "css compressor" do
33
+ subject { config.css_compressor }
34
+ it { should be_nil }
35
+ end
42
36
 
43
- context "cache_assets?" do
44
- subject { config.cache_assets? }
45
- it { should be_false }
46
- end
37
+ context "gzip" do
38
+ subject { config.gzip }
39
+ it { should =~ %w[text/css application/javascript] }
40
+ end
47
41
 
48
- context "cache_path" do
49
- subject { config.cache_path }
50
- it { should == ".jekyll-assets-cache" }
51
- end
42
+ context "cache_assets?" do
43
+ subject { config.cache_assets? }
44
+ it { should be_false }
45
+ end
52
46
 
53
- context "debug" do
54
- subject { config.debug }
55
- it { should be_false }
56
- end
47
+ context "cache_path" do
48
+ subject { config.cache_path }
49
+ it { should == ".jekyll-assets-cache" }
50
+ end
57
51
 
52
+ context "debug" do
53
+ subject { config.debug }
54
+ it { should be_false }
58
55
  end
59
56
 
60
- it "should override specified options and leave defaults for missing" do
61
- config = Configuration.new({
62
- :sources => %w{abc},
63
- :css_compressor => "sass"
64
- })
57
+ end
65
58
 
66
- expect(config.dirname).to eq "assets"
67
- expect(config.sources).to eq %w{abc}
68
- expect(config.js_compressor).to be_nil
69
- expect(config.css_compressor).to be :sass
70
- end
59
+ it "should override specified options and leave defaults for missing" do
60
+ config = described_class.new({
61
+ :sources => %w[abc],
62
+ :css_compressor => "sass"
63
+ })
64
+
65
+ expect(config.dirname).to eq "assets"
66
+ expect(config.sources).to eq %w[abc]
67
+ expect(config.js_compressor).to be_nil
68
+ expect(config.css_compressor).to be :sass
69
+ end
71
70
 
72
- context "#cache" do
73
- context "when specified as String" do
74
- it "should override default cache path" do
75
- config = Configuration.new :cache => "/tmp/jekyll-assets"
76
- config.cache_path.should == "/tmp/jekyll-assets"
77
- end
71
+ context "#cache" do
72
+ context "when specified as String" do
73
+ it "should override default cache path" do
74
+ config = described_class.new :cache => "/tmp/jekyll-assets"
75
+ config.cache_path.should == "/tmp/jekyll-assets"
78
76
  end
79
77
  end
78
+ end
80
79
 
81
- context "#baseurl" do
82
- it "should respect explicit overrides" do
83
- Configuration.new({
84
- :dirname => "foo",
85
- :baseurl => "/bar/"
86
- }).baseurl.should == "/bar"
87
- end
80
+ context "#baseurl" do
81
+ it "should respect explicit overrides" do
82
+ described_class.new({
83
+ :dirname => "foo",
84
+ :baseurl => "/bar/"
85
+ }).baseurl.should == "/bar"
86
+ end
88
87
 
89
- it "should be auto-guessed from dirname" do
90
- Configuration.new({
91
- :dirname => "foo"
92
- }).baseurl.should == "/foo"
93
- end
88
+ it "should be auto-guessed from dirname" do
89
+ described_class.new({
90
+ :dirname => "foo"
91
+ }).baseurl.should == "/foo"
94
92
  end
93
+ end
95
94
 
96
- context "#js_compressor" do
97
- context "when js compressor is given as `uglify`" do
98
- let(:config) { Configuration.new(:js_compressor => "uglify") }
99
- subject { config.js_compressor }
100
- it { should be :uglify }
101
- end
95
+ context "#js_compressor" do
96
+ context "when js compressor is given as `uglify`" do
97
+ let(:config) { described_class.new(:js_compressor => "uglify") }
98
+ subject { config.js_compressor }
99
+ it { should be :uglify }
100
+ end
102
101
 
103
- context "otherwise" do
104
- let(:config) { Configuration.new }
105
- subject { config.js_compressor }
106
- it { should be_false }
107
- end
102
+ context "otherwise" do
103
+ let(:config) { described_class.new }
104
+ subject { config.js_compressor }
105
+ it { should be_false }
108
106
  end
107
+ end
109
108
 
110
- context "#css_compressor" do
111
- context "when css compressor is given as `sass`" do
112
- let(:config) { Configuration.new(:css_compressor => "sass") }
113
- subject { config.css_compressor }
114
- it { should be :sass }
115
- end
109
+ context "#css_compressor" do
110
+ context "when css compressor is given as `sass`" do
111
+ let(:config) { described_class.new(:css_compressor => "sass") }
112
+ subject { config.css_compressor }
113
+ it { should be :sass }
114
+ end
116
115
 
117
- context "otherwise" do
118
- let(:config) { Configuration.new }
119
- subject { config.css_compressor }
120
- it { should be_false }
121
- end
116
+ context "otherwise" do
117
+ let(:config) { described_class.new }
118
+ subject { config.css_compressor }
119
+ it { should be_false }
122
120
  end
121
+ end
123
122
 
124
- context "#gzip" do
125
- context "when gzip is disabled" do
126
- let(:config) { Configuration.new(:gzip => false) }
127
- subject { config.gzip }
128
- it { should == [] }
129
- end
123
+ context "#gzip" do
124
+ context "when gzip is disabled" do
125
+ let(:config) { described_class.new(:gzip => false) }
126
+ subject { config.gzip }
127
+ it { should == [] }
130
128
  end
129
+ end
131
130
 
132
- context "#version" do
133
- subject { Configuration.new(:version => version).version }
131
+ context "#version" do
132
+ subject { described_class.new(:version => version).version }
134
133
 
135
- context "when given as 123" do
136
- let(:version) { 123 }
137
- it { should eq 123 }
138
- it { should be_a Integer }
139
- end
134
+ context "when given as 123" do
135
+ let(:version) { 123 }
136
+ it { should eq 123 }
137
+ it { should be_a Integer }
138
+ end
140
139
 
141
- context "when given as 'abc'" do
142
- let(:version) { "abc" }
143
- it { should eq "abc" }
144
- it { should be_a String }
145
- end
140
+ context "when given as 'abc'" do
141
+ let(:version) { "abc" }
142
+ it { should eq "abc" }
143
+ it { should be_a String }
146
144
  end
145
+ end
147
146
 
148
- context "Deprecated options" do
149
- context "compress" do
150
- let(:options) { { :compress => { :js => "uglify", :css => "sass" } } }
151
- subject { Configuration.new options }
147
+ context "Deprecated options" do
148
+ subject(:config) { described_class.new options }
152
149
 
153
- its(:js_compressor) { should be :uglify }
154
- its(:css_compressor) { should be :sass }
150
+ context "compress" do
151
+ let :options do
152
+ { :compress => { :js => "uglify", :css => "sass" } }
155
153
  end
156
154
 
157
- context "cache_assets" do
158
- let(:options) { { :cache_assets => true } }
155
+ its(:js_compressor) { should be :uglify }
156
+ its(:css_compressor) { should be :sass }
157
+ end
158
+
159
+ context "cache_assets" do
160
+ let(:options) { { :cache_assets => true } }
159
161
 
160
- it "should set `cache` value" do
161
- config = Configuration.new options
162
- config.cache_assets?.should be_true
163
- end
162
+ it "should set `cache` value" do
163
+ config.cache_assets?.should be_true
164
164
  end
165
165
  end
166
166
  end