jekyll-minibundle 1.3.0 → 1.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7676c0eba42d8141ef77c3fe778c401945f6bb74
4
- data.tar.gz: a22db95aa1900aa83c1ef4f1b785bf10efde371a
3
+ metadata.gz: e710ae4041aa12d52354bcfe4d26cede0a7f8c11
4
+ data.tar.gz: d50a377c564e3186c790203e8c90d71a02c66cf8
5
5
  SHA512:
6
- metadata.gz: 596712cfd61a61dd4f0524c809bfb3cf967fb5cbe451f59746f76e44efd3af907b8770db6928dda57c6c0c6e086f5ab2d1c20c4acd51ab3a392faa81b363b327
7
- data.tar.gz: 5deded83c36f011098f81208fc548fbc3e8616581a208a0df4fe31695a5ca76eb0944efed20ed348ab57daccb29827f82a635c5e702684ef5ae19aa1e6977a90
6
+ metadata.gz: dadbb64b20d2000b3f02285ed43b9d69ebcfd46201f62a034ec08cd7d24cf645cd2415265a05af1d7dc0d6c65438cf61ed1c657cd4abd02f53daff0a221d76c7
7
+ data.tar.gz: b214ee8464dc1f7ac95da50cbbf3635491fc9f990b167add78ef6f956e421770d9b8391d4b2e9572ce8f735c64eb9c796a4e08326f6b8c7d4d21c01deb851f78
@@ -1,8 +1,16 @@
1
+ # 1.4.0 / 2013-12-27
2
+
3
+ * Fix bug causing exception to be thrown when `ministamp` or
4
+ `minibundle` is called twice with same asset source argument. Allow
5
+ handling asset source files that are already static files in Jekyll
6
+ (remove the restriction introduced in 1.3.0). (@agrigg)
7
+
1
8
  # 1.3.0 / 2013-12-25
2
9
 
3
10
  * Disallow handling asset source files that are already static files
4
- in Jekyll (would potentially lead to inconsistencies in watch mode,
5
- see "Jekyll static file restriction" in README.md)
11
+ in Jekyll. Otherwise, we would potentially get to inconsistencies in
12
+ Jekyll's watch mode. See "Jekyll static file restriction" in
13
+ README.md. (@agrigg)
6
14
  * Upgrade development dependencies
7
15
 
8
16
  # 1.2.0 / 2013-09-29
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Jekyll Minibundle plugin
2
2
 
3
- A straightforward asset bundling plugin for
4
- [Jekyll](http://jekyllrb.com/), utilizing external minification tool
5
- of your choice. Provides asset concatenation for bundling and asset
6
- fingerprinting with MD5 digest for cache busting. No other runtime
7
- dependencies besides the minification tool (not even other gems).
3
+ A straightforward asset bundling plugin for [Jekyll][Jekyll],
4
+ utilizing external minification tool of your choice. It provides asset
5
+ concatenation for bundling and asset fingerprinting with MD5 digest
6
+ for cache busting. There are no other runtime dependencies besides the
7
+ minification tool (not even other gems).
8
8
 
9
- Tested with Ruby MRI 1.9.3 and 2.0.0. Ruby 1.8 is *not* supported.
9
+ Tested with Ruby MRI 1.9.3, 2.0, and 2.1. Ruby 1.8 is *not* supported.
10
10
 
11
11
  The plugin works with Jekyll's watch (auto-regeneration) mode.
12
12
 
@@ -53,6 +53,9 @@ this line:
53
53
  require 'jekyll/minibundle'
54
54
  ```
55
55
 
56
+ You must allow Jekyll to use custom plugins. In
57
+ [Jekyll's configuration][JekyllConf], do not enable `safe` setting.
58
+
56
59
  ## Asset fingerprinting
57
60
 
58
61
  Asset fingerprinting is intended to be used together with
@@ -135,27 +138,26 @@ attributes:
135
138
  And then specify the command for launching bundling in
136
139
  `$JEKYLL_MINIBUNDLE_CMD_CSS` environment variable.
137
140
 
138
- ## Jekyll static file restriction
141
+ ## Recommended directory layout
139
142
 
140
- The plugin disallows using asset source files already known to Jekyll
141
- as static files. This is because the plugin operates by adding asset
142
- files as special static files to Jekyll, allowing the plugin work
143
- nicely with Jekyll's watch (auto-regeneration) mode.
143
+ It's recommended that you exclude the files you use as asset sources
144
+ from Jekyll itself. Otherwise, you end up with duplicate files in the
145
+ output directory.
144
146
 
145
- For example, the following snippet causes the plugin to throw an
146
- exception if `assets/src.css` is not excluded from Jekyll:
147
+ For example, in the following snippet we're using `assets/src.css` as
148
+ asset source to `ministamp` tag:
147
149
 
148
150
  ``` html
149
151
  <link href="{% ministamp assets/src.css assets/dest.css %}" rel="stylesheet" media="screen, projection">
150
152
  ```
151
153
 
152
- If the restriction would not exist, there would be both `src.css` and
153
- `dest-<md5-hash>.css` files in `_site/assets/` output directory, which
154
- you probably wouldn't want to happen.
154
+ By default, Jekyll includes this file to the output directory. As a
155
+ result, there will be both `src.css` and `dest-<md5>.css` files in
156
+ `_site/assets/` directory, which you probably do not want.
155
157
 
156
- By default, Jekyll excludes directories beginning with underscore
157
- character (`_`), so you might use the following directory layout for
158
- assets:
158
+ In order to avoid this, exclude the asset source file from
159
+ Jekyll. Because Jekyll excludes directories beginning with underscore
160
+ character (`_`), consider the following directory layout:
159
161
 
160
162
  * `_assets/` for JS and CSS assets handled by the plugin that are in
161
163
  version control
@@ -163,8 +165,8 @@ assets:
163
165
  are not in version control (for example, Compass output files)
164
166
  * `assets/` for images and other assets handled by Jekyll directly
165
167
 
166
- See [Jekyll configuration](http://jekyllrb.com/docs/configuration/)
167
- for more about excluding files and directories.
168
+ See [Jekyll configuration][JekyllConf] for more about excluding files
169
+ and directories.
168
170
 
169
171
  ## Development mode
170
172
 
@@ -186,3 +188,6 @@ See the contents of `test/fixture/site` directory.
186
188
  # License
187
189
 
188
190
  MIT. See `LICENSE.txt`.
191
+
192
+ [Jekyll]: http://jekyllrb.com/
193
+ [JekyllConf]: http://jekyllrb.com/docs/configuration/
@@ -3,7 +3,7 @@ In order to release, do
3
3
  $EDITOR lib/jekyll/minibundle/version.rb # update version number
4
4
  $EDITOR CHANGELOG.md # describe a summary of changes since last release
5
5
  git diff # review the changes
6
- rake gem:build # check that tests pass
6
+ bundle exec rake gem:build # check that tests pass
7
7
  git add -p
8
8
  git commit -m 'Release <version>'
9
9
  git tag <version>
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require 'fileutils'
1
2
  require 'rake/clean'
2
3
  require 'shellwords'
3
4
 
@@ -12,6 +13,12 @@ def get_minibundle_env(overrides = {})
12
13
  }.merge(overrides)
13
14
  end
14
15
 
16
+ def run_jekyll_in_fixture_site(command)
17
+ Dir.chdir 'test/fixture/site'
18
+ FileUtils.rm_rf '_site'
19
+ sh get_minibundle_env, "jekyll #{command}"
20
+ end
21
+
15
22
  namespace :gem do
16
23
  gem_name = 'jekyll-minibundle'
17
24
 
@@ -46,12 +53,18 @@ task :test do
46
53
  sh env, cmd
47
54
  end
48
55
 
49
- desc 'Generate fixture site for debugging'
50
- task :debug do
51
- Dir.chdir 'test/fixture/site'
52
- sh(get_minibundle_env, 'jekyll')
53
- end
56
+ namespace :fixture do
57
+ CLEAN.include 'test/fixture/site/_site'
54
58
 
55
- CLEAN.include 'test/fixture/site/_site'
59
+ desc 'Generate fixture site'
60
+ task :build do
61
+ run_jekyll_in_fixture_site 'build'
62
+ end
63
+
64
+ desc 'Generate fixture site in watch mode'
65
+ task :watch do
66
+ run_jekyll_in_fixture_site 'build --watch'
67
+ end
68
+ end
56
69
 
57
70
  task :default => :test
@@ -30,7 +30,7 @@ module Jekyll::Minibundle
30
30
 
31
31
  if defined? ::Jekyll.logger # introduced in Jekyll 1.0.0
32
32
  def log(msg)
33
- ::Jekyll.logger.info 'Minibundle', msg
33
+ ::Jekyll.logger.info 'Minibundle:', msg
34
34
  end
35
35
  else
36
36
  def log(msg)
@@ -3,13 +3,9 @@ require 'fileutils'
3
3
  module Jekyll::Minibundle
4
4
  module AssetFileOperations
5
5
  def static_file!(site)
6
- check_no_existing_static_file site.static_files
7
- site.static_files << self
8
- end
9
-
10
- def check_no_existing_static_file(static_files)
11
- found = static_files.find { |f| f.path == path }
12
- raise "Minibundle cannot handle static file already handled by Jekyll: #{path}" if found
6
+ unless site.static_files.include? self
7
+ site.static_files << self
8
+ end
13
9
  end
14
10
 
15
11
  def write_destination(site_destination_dir)
@@ -21,7 +21,7 @@ module Jekyll::Minibundle
21
21
  end
22
22
 
23
23
  def modified?
24
- last_mtime_of(path) != mtime
24
+ stamped_at != mtime
25
25
  end
26
26
  end
27
27
  end
@@ -7,14 +7,6 @@ module Jekyll::Minibundle
7
7
  class BundleFile
8
8
  include AssetFileOperations
9
9
 
10
- def self.clear_cache
11
- @@mtimes = {}
12
- @@writes_after_rebundling = Hash.new false
13
- @@asset_bundles = {}
14
- end
15
-
16
- clear_cache
17
-
18
10
  def initialize(config)
19
11
  @type = config['type']
20
12
  @site_source_dir = config['site_dir']
@@ -22,12 +14,22 @@ module Jekyll::Minibundle
22
14
  @assets = config['assets'].map { |asset_path| File.join asset_source_dir, "#{asset_path}.#{@type}" }
23
15
  @destination_path = config['destination_path']
24
16
  @attributes = config['attributes']
17
+ @stamped_at = nil
18
+ @is_modified = false
25
19
  end
26
20
 
27
21
  def markup
28
22
  # we must rebundle here, if at all, in order to make sure the
29
23
  # markup and generated file have the same fingerprint
30
- rebundle_assets if modified?
24
+ if modified?
25
+ @stamped_at = mtime
26
+ @is_modified = true
27
+ @_asset_stamp = nil
28
+ asset_bundle.make_bundle
29
+ else
30
+ @is_modified = false
31
+ end
32
+
31
33
  AssetTagMarkup.make_markup @type, asset_destination_path, @attributes
32
34
  end
33
35
 
@@ -35,11 +37,6 @@ module Jekyll::Minibundle
35
37
  asset_bundle.path
36
38
  end
37
39
 
38
- def check_no_existing_static_file(static_files)
39
- existing = @assets & static_files.map(&:path)
40
- raise "Minibundle cannot handle static file already handled by Jekyll: #{existing.first}" unless existing.empty?
41
- end
42
-
43
40
  def asset_destination_path
44
41
  "#{@destination_path}-#{asset_stamp}.#{@type}"
45
42
  end
@@ -53,43 +50,26 @@ module Jekyll::Minibundle
53
50
  end
54
51
 
55
52
  def modified?
56
- @@mtimes[asset_destination_canonical_path] != mtime
53
+ @stamped_at != mtime
57
54
  end
58
55
 
59
56
  def write(site_destination_dir)
60
- if File.exists?(destination(site_destination_dir)) && destination_written_after_rebundling?
57
+ if File.exists?(destination(site_destination_dir)) && !@is_modified
61
58
  false
62
59
  else
63
60
  write_destination site_destination_dir
64
- @@writes_after_rebundling[asset_destination_canonical_path] = true
65
61
  true
66
62
  end
67
63
  end
68
64
 
69
65
  private
70
66
 
71
- def asset_destination_canonical_path
72
- "#{@destination_path}.#{@type}"
73
- end
74
-
75
67
  def asset_stamp
76
- @asset_stamp ||= AssetStamp.from_file path
68
+ @_asset_stamp ||= AssetStamp.from_file path
77
69
  end
78
70
 
79
71
  def asset_bundle
80
- @@asset_bundles[asset_destination_canonical_path] ||= AssetBundle.new(@type, @assets, @site_source_dir)
81
- end
82
-
83
- def rebundle_assets
84
- p = asset_destination_canonical_path
85
- @@writes_after_rebundling[p] = false
86
- @@mtimes[p] = mtime
87
- @asset_stamp = nil
88
- asset_bundle.make_bundle
89
- end
90
-
91
- def destination_written_after_rebundling?
92
- @@writes_after_rebundling[asset_destination_canonical_path]
72
+ @_asset_bundle ||= AssetBundle.new(@type, @assets, @site_source_dir)
93
73
  end
94
74
  end
95
75
  end
@@ -6,25 +6,20 @@ module Jekyll::Minibundle
6
6
  include AssetFileOperations
7
7
  include AssetFilePaths
8
8
 
9
- @@mtimes = {}
10
-
11
- attr_reader :asset_source_path, :asset_destination_dir, :asset_destination_basename
9
+ attr_reader :asset_source_path, :asset_destination_dir, :asset_destination_basename, :stamped_at
12
10
 
13
11
  def initialize(asset_source_path, asset_destination_path)
14
12
  @asset_source_path = asset_source_path
15
13
  @asset_destination_dir = File.dirname asset_destination_path
16
14
  @asset_destination_basename = File.basename asset_destination_path
17
- end
18
-
19
- def last_mtime_of(path)
20
- @@mtimes[path]
15
+ @stamped_at = nil
21
16
  end
22
17
 
23
18
  def write(site_destination_dir)
24
19
  if destination_exists?(site_destination_dir) && !modified?
25
20
  false
26
21
  else
27
- @@mtimes[path] = mtime
22
+ @stamped_at = mtime
28
23
  write_destination site_destination_dir
29
24
  true
30
25
  end
@@ -1,7 +1,5 @@
1
1
  require 'yaml'
2
- require 'jekyll/minibundle/bundle_file'
3
- require 'jekyll/minibundle/development_file_collection'
4
- require 'jekyll/minibundle/environment'
2
+ require 'jekyll/minibundle/asset_file_registry'
5
3
 
6
4
  module Jekyll::Minibundle
7
5
  class MiniBundleBlock < Liquid::Block
@@ -12,7 +10,8 @@ module Jekyll::Minibundle
12
10
 
13
11
  def render(context)
14
12
  site = context.registers[:site]
15
- file = get_file get_current_config(YAML.load(super), site)
13
+ config = get_current_config YAML.load(super), site
14
+ file = AssetFileRegistry.bundle_file config
16
15
  file.static_file! site
17
16
  file.markup
18
17
  end
@@ -33,14 +32,6 @@ module Jekyll::Minibundle
33
32
  merge(user_config).
34
33
  merge({ 'type' => @type, 'site_dir' => site.source })
35
34
  end
36
-
37
- def get_file(config)
38
- if Environment.development?
39
- DevelopmentFileCollection.new config
40
- else
41
- BundleFile.new config
42
- end
43
- end
44
35
  end
45
36
  end
46
37
 
@@ -1,4 +1,4 @@
1
- require 'jekyll/minibundle/stamp_file'
1
+ require 'jekyll/minibundle/asset_file_registry'
2
2
 
3
3
  module Jekyll::Minibundle
4
4
  class MiniStampTag < Liquid::Tag
@@ -9,20 +9,10 @@ module Jekyll::Minibundle
9
9
 
10
10
  def render(context)
11
11
  site = context.registers[:site]
12
- file = StampFile.new(File.join(site.source, @asset_source), @asset_destination, &get_basenamer)
12
+ file = AssetFileRegistry.stamp_file File.join(site.source, @asset_source), @asset_destination
13
13
  file.static_file! site
14
14
  file.markup
15
15
  end
16
-
17
- private
18
-
19
- def get_basenamer
20
- if Environment.development?
21
- ->(base, ext, _) { base + ext }
22
- else
23
- ->(base, ext, stamper) { "#{base}-#{stamper.call}#{ext}" }
24
- end
25
- end
26
16
  end
27
17
  end
28
18
 
@@ -7,9 +7,7 @@ module Jekyll::Minibundle
7
7
  include AssetFileOperations
8
8
  include AssetFilePaths
9
9
 
10
- @@mtimes = {}
11
-
12
- attr_reader :asset_source_path, :asset_destination_dir
10
+ attr_reader :asset_source_path, :asset_destination_dir, :stamped_at
13
11
 
14
12
  def initialize(asset_source_path, asset_destination_path, &basenamer)
15
13
  @basenamer = basenamer
@@ -17,7 +15,8 @@ module Jekyll::Minibundle
17
15
  @asset_destination_dir = File.dirname asset_destination_path
18
16
  @asset_destination_extension = File.extname asset_destination_path
19
17
  @asset_destination_base_prefix = File.basename(asset_destination_path)[0 .. -(@asset_destination_extension.size + 1)]
20
- @was_modified = false
18
+ @stamped_at = nil
19
+ @is_modified = false
21
20
  end
22
21
 
23
22
  def markup
@@ -25,22 +24,18 @@ module Jekyll::Minibundle
25
24
  # to make sure the markup and generated file have the same
26
25
  # fingerprint
27
26
  if modified?
28
- @asset_stamp = nil
29
- @@mtimes[path] = mtime
30
- @was_modified = true
27
+ @stamped_at = mtime
28
+ @is_modified = true
29
+ @_asset_stamp = nil
31
30
  else
32
- @was_modified = false
31
+ @is_modified = false
33
32
  end
34
33
 
35
34
  asset_destination_path
36
35
  end
37
36
 
38
- def last_mtime_of(path)
39
- @@mtimes[path]
40
- end
41
-
42
37
  def write(site_destination_dir)
43
- if destination_exists?(site_destination_dir) && !@was_modified
38
+ if destination_exists?(site_destination_dir) && !@is_modified
44
39
  false
45
40
  else
46
41
  write_destination site_destination_dir
@@ -55,7 +50,7 @@ module Jekyll::Minibundle
55
50
  end
56
51
 
57
52
  def asset_stamp
58
- @asset_stamp ||= AssetStamp.from_file(path)
53
+ @_asset_stamp ||= AssetStamp.from_file(path)
59
54
  end
60
55
  end
61
56
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Minibundle
3
- VERSION = '1.3.0'
3
+ VERSION = '1.4.0'
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- /* comment to be removed in bundling */
1
+ /* asset file, handled by Minibundle */
2
2
  (function(root, dependency) {
3
3
  if (!dependency) throw new Error("missing dependency");
4
4
  root.app = {};
@@ -1,4 +1,4 @@
1
- /* comment to be removed in bundling */
1
+ /* asset file, handled by Minibundle */
2
2
  (function(root) {
3
3
  root.dependency = {};
4
4
  })(window)
@@ -1,2 +1,2 @@
1
- /* comment to be removed in bundling */
1
+ /* asset file, handled by Minibundle */
2
2
  p { margin: 0; }
@@ -1,2 +1,2 @@
1
- /* comment to be removed in bundling */
1
+ /* asset file, handled by Minibundle */
2
2
  html { margin: 0; }
@@ -1,2 +1,3 @@
1
+ /* asset file, handled by Minibundle */
1
2
  html { margin: 0; }
2
3
  p { margin: 2px; }
@@ -1,31 +1,4 @@
1
1
  ---
2
- layout: nil
2
+ layout: default
3
+ title: Index
3
4
  ---
4
-
5
- <!DOCTYPE html>
6
- <html>
7
- <head>
8
- <link rel="stylesheet" href="{% ministamp _tmp/site.css assets/screen.css %}" media="screen">
9
- {% minibundle css %}
10
- source_dir: _assets/styles
11
- destination_path: assets/site
12
- assets:
13
- - reset
14
- - common
15
- attributes:
16
- id: my-styles
17
- media: projection
18
- {% endminibundle %}
19
- </head>
20
- <body>
21
- {% minibundle js %}
22
- source_dir: _assets/scripts
23
- destination_path: assets/site
24
- assets:
25
- - dependency
26
- - app
27
- attributes:
28
- id: my-scripts
29
- {% endminibundle %}
30
- </body>
31
- </html>
@@ -45,7 +45,7 @@ module Jekyll::Minibundle::Test
45
45
 
46
46
  refute_equal File.read(destination), File.read(source)
47
47
 
48
- generate_site :development
48
+ generate_site :development, clear_cache: false
49
49
 
50
50
  assert_equal File.read(destination), File.read(source)
51
51
  end
@@ -60,7 +60,7 @@ module Jekyll::Minibundle::Test
60
60
 
61
61
  refute_equal File.read(destination), File.read(source)
62
62
 
63
- generate_site :development
63
+ generate_site :development, clear_cache: false
64
64
 
65
65
  assert_equal File.read(destination), File.read(source)
66
66
  end
@@ -77,8 +77,8 @@ module Jekyll::Minibundle::Test
77
77
  assert_equal 'assets/site/common.css', find_css_paths_from_index.last
78
78
  assert_equal 'assets/site/app.js', find_js_paths_from_index.last
79
79
 
80
- find_and_gsub_in_file source_path('index.html'), 'destination_path: assets/site', 'destination_path: /assets/site'
81
- generate_site :development
80
+ find_and_gsub_in_file source_path('_layouts/default.html'), 'destination_path: assets/site', 'destination_path: /assets/site'
81
+ generate_site :development, clear_cache: false
82
82
 
83
83
  assert File.exists?(expected_css_path)
84
84
  assert File.exists?(expected_js_path)
@@ -102,12 +102,12 @@ module Jekyll::Minibundle::Test
102
102
  expected_js_path = destination_path JS_BUNDLE_DESTINATION_PATH, 'app.js'
103
103
  org_mtime = mtime_of expected_js_path
104
104
  ensure_file_mtime_changes { File.write source_path(JS_BUNDLE_SOURCE_DIR, 'dependency.js'), '(function() {})()' }
105
- generate_site :development
105
+ generate_site :development, clear_cache: false
106
106
 
107
107
  assert_equal org_mtime, mtime_of(expected_js_path)
108
108
 
109
109
  ensure_file_mtime_changes { FileUtils.touch 'index.html' }
110
- generate_site :development
110
+ generate_site :development, clear_cache: false
111
111
 
112
112
  assert_equal org_mtime, mtime_of(expected_js_path)
113
113
  end
@@ -128,8 +128,8 @@ module Jekyll::Minibundle::Test
128
128
  assert_equal EXPECTED_CSS_BUNDLE_PATH, find_css_path_from_index
129
129
  assert_equal EXPECTED_JS_BUNDLE_PATH, find_js_path_from_index
130
130
 
131
- find_and_gsub_in_file source_path('index.html'), 'destination_path: assets/site', 'destination_path: /assets/site'
132
- generate_site :production
131
+ find_and_gsub_in_file source_path('_layouts/default.html'), 'destination_path: assets/site', 'destination_path: /assets/site'
132
+ generate_site :production, clear_cache: false
133
133
 
134
134
  assert File.exists?(expected_css_path)
135
135
  assert File.exists?(expected_js_path)
@@ -34,11 +34,16 @@ module Jekyll::Minibundle::Test
34
34
  def test_change_asset_file
35
35
  with_site do
36
36
  generate_site :production
37
+
37
38
  assert File.exists?(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH))
38
- File.write source_path(STAMP_SOURCE_PATH), 'h1 {}'
39
- generate_site :production
39
+
40
+ ensure_file_mtime_changes { File.write source_path(STAMP_SOURCE_PATH), 'h1 {}' }
41
+ generate_site :production, clear_cache: false
42
+
40
43
  refute File.exists?(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH))
44
+
41
45
  expected_new_path = 'assets/screen-0f5dbd1e527a2bee267e85007b08d2a5.css'
46
+
42
47
  assert_equal expected_new_path, find_css_path_from_index
43
48
  assert File.exists?(destination_path(expected_new_path))
44
49
  end
@@ -52,9 +57,8 @@ module Jekyll::Minibundle::Test
52
57
  assert File.exists?(expected_path)
53
58
  assert_equal STAMP_DESTINATION_FINGERPRINT_PATH, find_css_path_from_index
54
59
 
55
- find_and_gsub_in_file(source_path('index.html'), %r{assets/screen.css}, '/\0')
56
-
57
- generate_site :production
60
+ find_and_gsub_in_file(source_path('_layouts/default.html'), %r{assets/screen.css}, '/\0')
61
+ generate_site :production, clear_cache: false
58
62
 
59
63
  assert File.exists?(expected_path)
60
64
  assert_equal "/#{STAMP_DESTINATION_FINGERPRINT_PATH}", find_css_path_from_index
@@ -67,12 +71,12 @@ module Jekyll::Minibundle::Test
67
71
  expected_path = destination_path STAMP_DESTINATION_FINGERPRINT_PATH
68
72
  org_mtime = mtime_of expected_path
69
73
  ensure_file_mtime_changes { File.write source_path(JS_BUNDLE_SOURCE_DIR, 'dependency.js'), '(function() {})()' }
70
- generate_site :production
74
+ generate_site :production, clear_cache: false
71
75
 
72
76
  assert_equal org_mtime, mtime_of(expected_path)
73
77
 
74
78
  ensure_file_mtime_changes { FileUtils.touch 'index.html' }
75
- generate_site :production
79
+ generate_site :production, clear_cache: false
76
80
 
77
81
  assert_equal org_mtime, mtime_of(expected_path)
78
82
  end
@@ -2,7 +2,7 @@ module Jekyll::Minibundle::Test
2
2
  module FixtureConfig
3
3
  STAMP_SOURCE_PATH = '_tmp/site.css'
4
4
  STAMP_DESTINATION_PATH = 'assets/screen.css'
5
- STAMP_DESTINATION_FINGERPRINT_PATH = 'assets/screen-390be921ee0eff063817bb5ef2954300.css'
5
+ STAMP_DESTINATION_FINGERPRINT_PATH = 'assets/screen-d57c1404fe726e66d57128a1bd190cbb.css'
6
6
 
7
7
  CSS_BUNDLE_DESTINATION_PATH = 'assets/site'
8
8
  CSS_BUNDLE_SOURCE_DIR = '_assets/styles'
@@ -104,7 +104,7 @@ module Jekyll::Minibundle::Test
104
104
  end
105
105
 
106
106
  def _generate_site(test_options)
107
- BundleFile.clear_cache if test_options[:clear_cache]
107
+ AssetFileRegistry.clear if test_options[:clear_cache]
108
108
 
109
109
  capture_io do
110
110
  Jekyll::Site.new(Jekyll.configuration(TestCase.site_generation_jekyll_options)).process
@@ -7,8 +7,6 @@ module Jekyll::Minibundle::Test
7
7
  include FixtureConfig
8
8
 
9
9
  def test_consistent_fingerprint_in_file_and_markup
10
- BundleFile.clear_cache
11
-
12
10
  with_site do
13
11
  with_env 'JEKYLL_MINIBUNDLE_CMD_JS' => cmd_to_remove_comments_and_count do
14
12
  bundle_file = BundleFile.new({
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-minibundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tuomas Kareinen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-25 00:00:00.000000000 Z
11
+ date: 2013-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll