jekyll-assets 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/Guardfile CHANGED
@@ -1,3 +1,5 @@
1
+ notification :off
2
+
1
3
  guard 'rspec' do
2
4
  watch(%r{^spec/.+_spec\.rb$})
3
5
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
data/HISTORY.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 0.5.4 (2103-07-07)
2
+
3
+ * Rename configuration options `compress.js` and `compress.css` into
4
+ `js_compressor` and `css_compressor` respectively.
5
+ * Rename configureation option `cache_assets` into `cache`.
6
+ * Allow specify custom compilation cache path.
7
+ * Invalidate cache upon config changes.
8
+
9
+
1
10
  ### 0.5.3 (2013-05-25)
2
11
 
3
12
  * Assets cache disable by default, in order to avoid "unpredictable" behavior.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Aleksey V Zapparov (http://ixti.net/)
1
+ Copyright (c) 2012-2013 Aleksey V Zapparov (http://ixti.net/)
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -216,19 +216,13 @@ To improve build time, you can enabled compiled assets cache:
216
216
 
217
217
  ``` yaml
218
218
  assets:
219
- cache_assets: true
219
+ cache: true
220
220
  ```
221
221
 
222
- In this case you might want to clean cache time after time:
223
-
224
- $ jekyll assets:cleanup
225
-
226
- Also you will need to add `.jekyll-assets-cache` path under source of your
227
- jekyll site into exclusion list of your source control system (`.gitignore`
228
- for git).
229
-
230
- At the moment we use *FileStore* cache which keeps compiled data on file system.
231
- If you need MemCache or Redis based store, please raise a ticket.
222
+ This will keep cache of compiled assets in `.jekyll-assets-cache` under source
223
+ of your jekyl site. If you want to use different location specify it instead of
224
+ `true`, in this case it should be an absolute path or path relative to source
225
+ path of your jekyl site.
232
226
 
233
227
 
234
228
  ## Custom Vendors
@@ -421,17 +415,15 @@ assets:
421
415
  - _assets/stylesheets
422
416
  - _assets/images
423
417
  #
424
- # Sets compressors for the specific types of file: `js`, or `css`.
425
- # No compression by default.
418
+ # Sets JS compressor. No compression by default.
419
+ # Possible variants: 'yui', 'uglifier', nil
426
420
  #
427
- # Possible variants:
421
+ js_compressor: ~
428
422
  #
429
- # css => 'yui', 'sass', nil
430
- # js => 'yui', 'uglifier', nil
423
+ # Sets CSS compressor. No compression by default.
424
+ # Possible variants: 'yui', 'sass', nil
431
425
  #
432
- compress:
433
- js: ~
434
- css: ~
426
+ css_compressor: ~
435
427
  #
436
428
  # Sets cachebusting policy for generated assets.
437
429
  #
@@ -461,7 +453,7 @@ assets:
461
453
  # Whenever or not cache compiled assets (disabled by default).
462
454
  # See `Compilation Cache` section of README for details.
463
455
  #
464
- cache_assets: false
456
+ cache: false
465
457
  #
466
458
  # Specifies list of MIME types that needs to have gzipped versions.
467
459
  # You can set it to `false` to disable gzipping. Only javascripts and
@@ -492,7 +484,7 @@ write an [e-mail][e-mail]. :D
492
484
 
493
485
  ## License
494
486
 
495
- Copyright (C) 2012 Aleksey V Zapparov (http://ixti.net/)
487
+ Copyright (C) 2012-2013 Aleksey V Zapparov (http://ixti.net/)
496
488
 
497
489
  The MIT License
498
490
 
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env rake
2
-
3
1
  require "bundler/gem_tasks"
4
2
  require "rspec/core/rake_task"
5
3
 
@@ -1,35 +1,36 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/jekyll/assets_plugin/version', __FILE__)
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jekyll/assets_plugin/version'
3
5
 
4
6
 
5
- Gem::Specification.new do |gem|
6
- gem.name = "jekyll-assets"
7
- gem.version = Jekyll::AssetsPlugin::VERSION
8
- gem.homepage = "http://ixti.github.com/jekyll-assets"
9
- gem.authors = ["Aleksey V Zapparov"]
10
- gem.email = %w{ixti@member.fsf.org}
11
- gem.license = "MIT"
12
- gem.summary = "jekyll-assets-#{Jekyll::AssetsPlugin::VERSION}"
13
- gem.description = <<-DESC
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "jekyll-assets"
9
+ spec.version = Jekyll::AssetsPlugin::VERSION
10
+ spec.homepage = "http://ixti.github.com/jekyll-assets"
11
+ spec.authors = ["Aleksey V Zapparov"]
12
+ spec.email = %w{ixti@member.fsf.org}
13
+ spec.license = "MIT"
14
+ spec.summary = "jekyll-assets-#{Jekyll::AssetsPlugin::VERSION}"
15
+ spec.description = <<-DESC
14
16
  Jekyll plugin, that allows you to write javascript/css assets in
15
17
  other languages such as CoffeeScript, Sass, Less and ERB, concatenate
16
18
  them, respecting dependencies, minify and many more.
17
19
  DESC
18
20
 
19
- gem.add_dependency "jekyll", "~> 1.0"
20
- gem.add_dependency "sprockets", "~> 2.9"
21
+ spec.files = `git ls-files`.split($/)
22
+ spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
23
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
+ spec.require_paths = ["lib"]
21
25
 
22
- gem.add_development_dependency "rake"
23
- gem.add_development_dependency "rspec"
24
- gem.add_development_dependency "guard-rspec"
25
- gem.add_development_dependency "rb-inotify"
26
- gem.add_development_dependency "compass"
27
- gem.add_development_dependency "bourbon"
28
- gem.add_development_dependency "neat"
26
+ spec.add_dependency "jekyll", "~> 1.0"
27
+ spec.add_dependency "sprockets", "~> 2.10"
29
28
 
30
- gem.files = `git ls-files`.split($\)
31
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
32
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
33
-
34
- gem.require_paths = ["lib"]
29
+ spec.add_development_dependency "bundler", "~> 1.3"
30
+ spec.add_development_dependency "rake"
31
+ spec.add_development_dependency "rspec"
32
+ spec.add_development_dependency "guard-rspec"
33
+ spec.add_development_dependency "compass"
34
+ spec.add_development_dependency "bourbon"
35
+ spec.add_development_dependency "neat"
35
36
  end
@@ -2,4 +2,3 @@ require "jekyll/assets_plugin/patches"
2
2
  require "jekyll/assets_plugin/filters"
3
3
  require "jekyll/assets_plugin/tag"
4
4
  require "jekyll/assets_plugin/version"
5
- require "jekyll/assets_plugin/commands"
@@ -6,12 +6,13 @@ module Jekyll
6
6
  module AssetsPlugin
7
7
  class Configuration
8
8
  DEFAULTS = {
9
- :dirname => "assets",
10
- :sources => %w{_assets/javascripts _assets/stylesheets _assets/images},
11
- :compress => { :css => nil, :js => nil },
12
- :cachebust => :hard,
13
- :cache_assets => false,
14
- :gzip => %w{ text/css application/javascript }
9
+ :dirname => "assets",
10
+ :sources => %w{_assets/javascripts _assets/stylesheets _assets/images},
11
+ :js_compressor => nil,
12
+ :css_compressor => nil,
13
+ :cachebust => :hard,
14
+ :cache => false,
15
+ :gzip => %w{ text/css application/javascript }
15
16
  }.freeze
16
17
 
17
18
 
@@ -19,9 +20,14 @@ module Jekyll
19
20
  @data = OpenStruct.new DEFAULTS.merge(config)
20
21
 
21
22
  @data.sources = [ @data.sources ] if @data.sources.is_a? String
22
- @data.compress = OpenStruct.new @data.compress
23
23
  @data.dirname = @data.dirname.gsub(/^\/+|\/+$/, "")
24
24
 
25
+ compress = OpenStruct.new @data.compress
26
+
27
+ @data.js_compressor ||= compress.js
28
+ @data.css_compressor ||= compress.css
29
+ @data.cache ||= @data.cache_assets
30
+
25
31
  # if baseurl not given - autoguess base on dirname
26
32
  @data.baseurl ||= "/#{@data.dirname}/".squeeze '/'
27
33
  end
@@ -33,12 +39,12 @@ module Jekyll
33
39
 
34
40
 
35
41
  def js_compressor
36
- compressor @data.compress.js
42
+ compressor @data.js_compressor
37
43
  end
38
44
 
39
45
 
40
46
  def css_compressor
41
- compressor @data.compress.css
47
+ compressor @data.css_compressor
42
48
  end
43
49
 
44
50
 
@@ -48,7 +54,12 @@ module Jekyll
48
54
 
49
55
 
50
56
  def cache_assets?
51
- !!@data.cache_assets
57
+ !!@data.cache
58
+ end
59
+
60
+
61
+ def cache_path
62
+ @data.cache.is_a?(String) ? @data.cache : ".jekyll-assets-cache"
52
63
  end
53
64
 
54
65
 
@@ -26,24 +26,26 @@ module Jekyll
26
26
  @site = site
27
27
 
28
28
  # append asset paths
29
- @site.assets_config.sources.each { |p| append_path p }
29
+ site.assets_config.sources.each { |p| append_path p }
30
30
 
31
- self.js_compressor = @site.assets_config.js_compressor
32
- self.css_compressor = @site.assets_config.css_compressor
31
+ self.js_compressor = site.assets_config.js_compressor
32
+ self.css_compressor = site.assets_config.css_compressor
33
33
 
34
- if @site.assets_config.cache_assets?
34
+ if site.assets_config.cache_assets?
35
35
  self.cache = Sprockets::Cache::FileStore.new cache_path
36
36
  end
37
37
 
38
- # bind jekyll and Sprockets context together
39
- context_class.instance_variable_set :@site, @site
38
+ # reset cache if config changed
39
+ self.version = site.assets_config.marshal_dump
40
40
 
41
+ # bind jekyll and Sprockets context together
42
+ context_class.instance_variable_set :@site, site
41
43
  context_class.send :include, Patches::ContextPatch
42
44
  end
43
45
 
44
46
 
45
47
  def cache_path
46
- Pathname.new(@site.source).join ".jekyll-assets-cache"
48
+ Pathname.new(@site.source).join @site.assets_config.cache_path
47
49
  end
48
50
 
49
51
 
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module AssetsPlugin
3
- VERSION = "0.5.3"
3
+ VERSION = "0.5.4"
4
4
  end
5
5
  end
@@ -27,12 +27,12 @@ module Jekyll::AssetsPlugin
27
27
  end
28
28
 
29
29
  context "js compressor" do
30
- subject { config.compress.js }
30
+ subject { config.js_compressor }
31
31
  it { should be_nil }
32
32
  end
33
33
 
34
34
  context "css compressor" do
35
- subject { config.compress.css }
35
+ subject { config.css_compressor }
36
36
  it { should be_nil }
37
37
  end
38
38
 
@@ -46,18 +46,32 @@ module Jekyll::AssetsPlugin
46
46
  it { should be_false }
47
47
  end
48
48
 
49
+ context "cache_path" do
50
+ subject { config.cache_path }
51
+ it { should == ".jekyll-assets-cache" }
52
+ end
53
+
49
54
  end
50
55
 
51
56
  it "should override specified options and leave defaults for missing" do
52
57
  config = Configuration.new({
53
- :sources => %w{abc},
54
- :compress => { :css => "sass" }
58
+ :sources => %w{abc},
59
+ :css_compressor => "sass"
55
60
  })
56
61
 
57
- config.dirname.should == "assets"
58
- config.sources.should =~ %w{abc}
59
- config.compress.js.should be_nil
60
- config.compress.css.should == "sass"
62
+ config.dirname.should == "assets"
63
+ config.sources.should =~ %w{abc}
64
+ config.js_compressor.should be_nil
65
+ config.css_compressor.should == :sass
66
+ end
67
+
68
+ context "#cache" do
69
+ context "when specified as String" do
70
+ it "should override default cache path" do
71
+ config = Configuration.new :cache => "/tmp/jekyll-assets"
72
+ config.cache_path.should == "/tmp/jekyll-assets"
73
+ end
74
+ end
61
75
  end
62
76
 
63
77
  context "#baseurl" do
@@ -77,7 +91,7 @@ module Jekyll::AssetsPlugin
77
91
 
78
92
  context "#js_compressor" do
79
93
  context "when js compressor is given as `uglify`" do
80
- let(:config){ Configuration.new(:compress => {:js => "uglify"}) }
94
+ let(:config){ Configuration.new(:js_compressor => "uglify") }
81
95
  subject { config.js_compressor }
82
96
  it { should be :uglify }
83
97
  end
@@ -91,7 +105,7 @@ module Jekyll::AssetsPlugin
91
105
 
92
106
  context "#css_compressor" do
93
107
  context "when css compressor is given as `sass`" do
94
- let(:config){ Configuration.new(:compress => {:css => "sass"}) }
108
+ let(:config){ Configuration.new(:css_compressor => "sass") }
95
109
  subject { config.css_compressor }
96
110
  it { should be :sass }
97
111
  end
@@ -110,5 +124,27 @@ module Jekyll::AssetsPlugin
110
124
  it { should == [] }
111
125
  end
112
126
  end
127
+
128
+
129
+ context "Deprecated options" do
130
+ context "compress" do
131
+ let(:options){ { :compress => {:js => "uglify", :css => "sass"} } }
132
+
133
+ it "should set corresponding *_compressor value" do
134
+ config = Configuration.new options
135
+ config.js_compressor.should == :uglify
136
+ config.css_compressor.should == :sass
137
+ end
138
+ end
139
+
140
+ context "cache_assets" do
141
+ let(:options){ { :cache_assets => true } }
142
+
143
+ it "should set `cache` value" do
144
+ config = Configuration.new options
145
+ config.cache_assets?.should be_true
146
+ end
147
+ end
148
+ end
113
149
  end
114
150
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-25 00:00:00.000000000 Z
12
+ date: 2013-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '2.9'
37
+ version: '2.10'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,25 +42,25 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '2.9'
45
+ version: '2.10'
46
46
  - !ruby/object:Gem::Dependency
47
- name: rake
47
+ name: bundler
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - ! '>='
51
+ - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: '1.3'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - ! '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.3'
62
62
  - !ruby/object:Gem::Dependency
63
- name: rspec
63
+ name: rake
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
@@ -76,7 +76,7 @@ dependencies:
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  - !ruby/object:Gem::Dependency
79
- name: guard-rspec
79
+ name: rspec
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
@@ -92,7 +92,7 @@ dependencies:
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  - !ruby/object:Gem::Dependency
95
- name: rb-inotify
95
+ name: guard-rspec
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
@@ -181,7 +181,6 @@ files:
181
181
  - lib/jekyll-assets/neat.rb
182
182
  - lib/jekyll/assets_plugin.rb
183
183
  - lib/jekyll/assets_plugin/asset_file.rb
184
- - lib/jekyll/assets_plugin/commands.rb
185
184
  - lib/jekyll/assets_plugin/configuration.rb
186
185
  - lib/jekyll/assets_plugin/environment.rb
187
186
  - lib/jekyll/assets_plugin/filters.rb
@@ -243,7 +242,7 @@ rubyforge_project:
243
242
  rubygems_version: 1.8.23
244
243
  signing_key:
245
244
  specification_version: 3
246
- summary: jekyll-assets-0.5.3
245
+ summary: jekyll-assets-0.5.4
247
246
  test_files:
248
247
  - spec/fixtures/.gitignore
249
248
  - spec/fixtures/_assets/app.css.erb
@@ -1,16 +0,0 @@
1
- # 3rd-party
2
- require "commander"
3
-
4
-
5
- ::Commander::Runner.instance.command "assets:cleanup" do |c|
6
- c.syntax = "jekyll assets:cleanup"
7
- c.description = "Clenup jekyll-assets cache"
8
-
9
- c.option "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array,
10
- "Custom Jekyll configuration file"
11
-
12
- c.action do |_, options|
13
- assets = Jekyll::Site.new(Jekyll.configuration(options)).assets
14
- assets.cache_path.rmtree if assets.cache_path.exist?
15
- end
16
- end