jekyll-minibundle 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +2 -1
- data/Rakefile +21 -11
- data/lib/jekyll/minibundle/asset_bundle.rb +1 -1
- data/lib/jekyll/minibundle/{asset_file_paths.rb → asset_file_properties.rb} +14 -2
- data/lib/jekyll/minibundle/bundle_file.rb +6 -1
- data/lib/jekyll/minibundle/development_file.rb +2 -2
- data/lib/jekyll/minibundle/environment.rb +3 -3
- data/lib/jekyll/minibundle/stamp_file.rb +2 -2
- data/lib/jekyll/minibundle/version.rb +1 -1
- data/test/support/static_file_api_config.rb +10 -0
- data/test/support/test_case.rb +7 -0
- data/test/unit/asset_bundle_test.rb +2 -2
- data/test/unit/bundle_file_properties_test.rb +50 -0
- data/test/unit/{bundle_file_test.rb → bundle_file_writing_test.rb} +1 -9
- data/test/unit/development_file_collection_properties_test.rb +60 -0
- data/test/unit/{development_file_collection_test.rb → development_file_collection_writing_test.rb} +1 -21
- data/test/unit/environment_test.rb +9 -7
- data/test/unit/stamp_file_properties_test.rb +43 -0
- data/test/unit/{stamp_file_test.rb → stamp_file_writing_test.rb} +8 -13
- metadata +18 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78d5b4816f385803fa9430a93c45b4400bdc412b
|
4
|
+
data.tar.gz: 840c54ba92488bf1f8116789267bd3a4890a0ce0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 768d946a42f110c20029d45bf50a6c5174d665adfac5dff7f56b6eef81538f2d7044f6222d2efc31bafdc1083c3f8fb0639959e8c9dc50be999f950b45832b35
|
7
|
+
data.tar.gz: 506cc7dd2bc7405b431ebb09815aab616bf786407d46d5b19b93aa510c999a552481d1ed6a6a1711817ae6e618e1252549ac8311c0b32cf751892347c65a45f0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 1.5.1 / 2015-01-29
|
2
|
+
|
3
|
+
* Improve future compatibility with Jekyll. Minibundle has classes
|
4
|
+
adhering to `Jekyll::StaticFile` interface, and some method
|
5
|
+
implementations of the interface were missing.
|
6
|
+
* Small refactorings and test improvements
|
7
|
+
|
1
8
|
# 1.5.0 / 2014-07-27
|
2
9
|
|
3
10
|
* Support minifier command specification in `_config.yml` and inside
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ for cache busting.
|
|
8
8
|
There are no runtime dependencies, except for the minification tool
|
9
9
|
used for bundling (fingerprinting has no dependencies).
|
10
10
|
|
11
|
-
Tested with Ruby MRI 1.9.3
|
11
|
+
Tested with Ruby MRI 1.9.3 and 2.x. Ruby 1.8 is *not* supported.
|
12
12
|
|
13
13
|
The plugin works with Jekyll's watch (auto-regeneration) mode.
|
14
14
|
|
@@ -216,6 +216,7 @@ For example, in the following snippet we're using `assets/src.css` as
|
|
216
216
|
asset source to `ministamp` tag:
|
217
217
|
|
218
218
|
``` html
|
219
|
+
<!-- BAD: unless assets dir is excluded, both src.css and dest.css will be copied to output directory -->
|
219
220
|
<link href="{% ministamp assets/src.css assets/dest.css %}" rel="stylesheet" media="screen, projection">
|
220
221
|
```
|
221
222
|
|
data/Rakefile
CHANGED
@@ -26,29 +26,39 @@ namespace :gem do
|
|
26
26
|
|
27
27
|
desc 'Package the software as a gem'
|
28
28
|
task :build => :test do
|
29
|
-
sh
|
29
|
+
sh "gem build #{gem_name}.gemspec"
|
30
30
|
end
|
31
31
|
|
32
32
|
desc 'Install the software as a gem'
|
33
33
|
task :install do
|
34
|
-
sh
|
34
|
+
sh "gem install #{gem_name}-#{Jekyll::Minibundle::VERSION}.gem"
|
35
35
|
end
|
36
36
|
|
37
37
|
desc 'Uninstall the gem'
|
38
38
|
task :uninstall => :clean do
|
39
|
-
sh
|
39
|
+
sh "gem uninstall #{gem_name}"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
desc 'Run tests;
|
43
|
+
desc 'Run tests; TEST=<test_suite_path>, NAME=<test_name_pattern>, DEBUG=1 to require Pry, PP, enable warnings'
|
44
44
|
task :test do
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
run_single_test = ENV.key?('TEST')
|
46
|
+
|
47
|
+
run_selected_or_all = if run_single_test
|
48
|
+
rb_file = ENV['TEST']
|
49
|
+
name_opt = ENV.key?('NAME') ? " -n #{ENV['NAME']}" : ''
|
50
|
+
"#{rb_file}#{name_opt}"
|
51
|
+
else
|
52
|
+
requirable_files = Dir['test/{unit,integration}/*_test.rb'].
|
53
|
+
map { |file| %r{^test/(.+)\.rb$}.match(file)[1] }.
|
54
|
+
shelljoin
|
55
|
+
eval = "-e 'ARGV.each { |f| require f }'"
|
56
|
+
"#{eval} #{requirable_files}"
|
57
|
+
end
|
58
|
+
|
59
|
+
extra_opts = ENV['DEBUG'] ? '-w -rpp -rpry ' : ''
|
60
|
+
|
61
|
+
sh "ruby -I lib:test #{extra_opts}#{run_selected_or_all}"
|
52
62
|
end
|
53
63
|
|
54
64
|
namespace :fixture do
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Jekyll::Minibundle
|
2
|
-
module
|
2
|
+
module AssetFileProperties
|
3
3
|
def path
|
4
4
|
asset_source_path
|
5
5
|
end
|
@@ -16,6 +16,10 @@ module Jekyll::Minibundle
|
|
16
16
|
File.join(site_destination_dir, asset_destination_path)
|
17
17
|
end
|
18
18
|
|
19
|
+
def extname
|
20
|
+
File.extname(relative_path)
|
21
|
+
end
|
22
|
+
|
19
23
|
def mtime
|
20
24
|
File.stat(path).mtime.to_i
|
21
25
|
end
|
@@ -24,12 +28,20 @@ module Jekyll::Minibundle
|
|
24
28
|
stamped_at != mtime
|
25
29
|
end
|
26
30
|
|
31
|
+
def destination_rel_dir
|
32
|
+
asset_destination_dir
|
33
|
+
end
|
34
|
+
|
27
35
|
def to_liquid
|
28
36
|
{
|
29
37
|
'path' => relative_path,
|
30
38
|
'modified_time' => mtime.to_s,
|
31
|
-
'extname' =>
|
39
|
+
'extname' => extname
|
32
40
|
}
|
33
41
|
end
|
42
|
+
|
43
|
+
def write?
|
44
|
+
true
|
45
|
+
end
|
34
46
|
end
|
35
47
|
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
require 'jekyll/minibundle/asset_bundle'
|
2
2
|
require 'jekyll/minibundle/asset_file_operations'
|
3
|
+
require 'jekyll/minibundle/asset_file_properties'
|
3
4
|
require 'jekyll/minibundle/asset_stamp'
|
4
5
|
require 'jekyll/minibundle/asset_tag_markup'
|
5
6
|
|
6
7
|
module Jekyll::Minibundle
|
7
8
|
class BundleFile
|
8
9
|
include AssetFileOperations
|
9
|
-
include
|
10
|
+
include AssetFileProperties
|
10
11
|
|
11
12
|
attr_reader :stamped_at
|
12
13
|
|
@@ -39,6 +40,10 @@ module Jekyll::Minibundle
|
|
39
40
|
asset_bundle.path
|
40
41
|
end
|
41
42
|
|
43
|
+
def asset_destination_dir
|
44
|
+
File.dirname(@destination_path)
|
45
|
+
end
|
46
|
+
|
42
47
|
def asset_destination_path
|
43
48
|
"#{@destination_path}-#{asset_stamp}.#{@type}"
|
44
49
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'jekyll/minibundle/asset_file_operations'
|
2
|
-
require 'jekyll/minibundle/
|
2
|
+
require 'jekyll/minibundle/asset_file_properties'
|
3
3
|
|
4
4
|
module Jekyll::Minibundle
|
5
5
|
class DevelopmentFile
|
6
6
|
include AssetFileOperations
|
7
|
-
include
|
7
|
+
include AssetFileProperties
|
8
8
|
|
9
9
|
attr_reader :asset_source_path, :asset_destination_dir, :asset_destination_basename, :stamped_at
|
10
10
|
|
@@ -12,15 +12,15 @@ module Jekyll::Minibundle
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def find_site_config(site, keys, type)
|
15
|
-
value =
|
15
|
+
value = traverse_keys(site.config, keys)
|
16
16
|
if value && !value.is_a?(type)
|
17
17
|
fail "Invalid site configuration for key #{keys.join('.')}; expecting type #{type}"
|
18
18
|
end
|
19
19
|
value
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
23
|
-
value =
|
22
|
+
def traverse_keys(obj, keys)
|
23
|
+
value = obj
|
24
24
|
keys.each do |key|
|
25
25
|
return nil unless value
|
26
26
|
value = value[key]
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'jekyll/minibundle/asset_file_operations'
|
2
|
-
require 'jekyll/minibundle/
|
2
|
+
require 'jekyll/minibundle/asset_file_properties'
|
3
3
|
require 'jekyll/minibundle/asset_stamp'
|
4
4
|
|
5
5
|
module Jekyll::Minibundle
|
6
6
|
class StampFile
|
7
7
|
include AssetFileOperations
|
8
|
-
include
|
8
|
+
include AssetFileProperties
|
9
9
|
|
10
10
|
attr_reader :asset_source_path, :asset_destination_dir, :stamped_at
|
11
11
|
|
data/test/support/test_case.rb
CHANGED
@@ -114,6 +114,13 @@ module Jekyll::Minibundle::Test
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
+
def get_send_results(obj, method_names)
|
118
|
+
method_names.reduce({}) do |acc, method_name|
|
119
|
+
acc[method_name] = obj.send(method_name)
|
120
|
+
acc
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
117
124
|
private
|
118
125
|
|
119
126
|
def _copy_fixture_site_dir(dir)
|
@@ -5,8 +5,8 @@ module Jekyll::Minibundle::Test
|
|
5
5
|
class AssetBundleTest < TestCase
|
6
6
|
def test_raise_exception_if_bundle_command_fails
|
7
7
|
capture_io do
|
8
|
-
err = assert_raises(RuntimeError) { make_bundle('false') }
|
9
|
-
assert_equal 'Bundling js assets failed with exit status 1, command: false', err.to_s
|
8
|
+
err = assert_raises(RuntimeError) { make_bundle('read _ignore ; false') }
|
9
|
+
assert_equal 'Bundling js assets failed with exit status 1, command: read _ignore ; false', err.to_s
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'support/test_case'
|
2
|
+
require 'support/fixture_config'
|
3
|
+
require 'support/static_file_api_config'
|
4
|
+
require 'jekyll/minibundle/bundle_file'
|
5
|
+
|
6
|
+
module Jekyll::Minibundle::Test
|
7
|
+
class BundleFilePropertiesTest < TestCase
|
8
|
+
include FixtureConfig
|
9
|
+
include StaticFileAPIConfig
|
10
|
+
|
11
|
+
def setup
|
12
|
+
@results ||= with_fake_site do |site|
|
13
|
+
file = BundleFile.new(site, bundle_config(minifier_cmd_to_remove_comments))
|
14
|
+
get_send_results(file, STATIC_FILE_API_PROPERTIES)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_to_liquid
|
19
|
+
hash = @results.fetch(:to_liquid)
|
20
|
+
assert_match(%r{/jekyll-minibundle-.+\.js\z}, hash['path'])
|
21
|
+
refute_empty hash['modified_time']
|
22
|
+
assert_equal '.js', hash['extname']
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_extname
|
26
|
+
assert_equal '.js', @results.fetch(:extname)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_destination_rel_dir
|
30
|
+
assert_equal 'assets', @results.fetch(:destination_rel_dir)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_write?
|
34
|
+
assert @results.fetch(:write?)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def bundle_config(minifier_cmd)
|
40
|
+
{
|
41
|
+
'type' => :js,
|
42
|
+
'source_dir' => JS_BUNDLE_SOURCE_DIR,
|
43
|
+
'assets' => %w{dependency app},
|
44
|
+
'destination_path' => JS_BUNDLE_DESTINATION_PATH,
|
45
|
+
'attributes' => {},
|
46
|
+
'minifier_cmd' => minifier_cmd
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -3,7 +3,7 @@ require 'support/fixture_config'
|
|
3
3
|
require 'jekyll/minibundle/bundle_file'
|
4
4
|
|
5
5
|
module Jekyll::Minibundle::Test
|
6
|
-
class
|
6
|
+
class BundleFileWritingTest < TestCase
|
7
7
|
include FixtureConfig
|
8
8
|
|
9
9
|
def test_calling_markup_determines_fingerprint_and_destination_write
|
@@ -84,14 +84,6 @@ module Jekyll::Minibundle::Test
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
def test_to_liquid
|
88
|
-
with_fake_site do |site|
|
89
|
-
hash = BundleFile.new(site, bundle_config(minifier_cmd_to_remove_comments)).to_liquid
|
90
|
-
assert_match(/jekyll-minibundle-js-/, hash['path'])
|
91
|
-
refute_empty hash['modified_time']
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
87
|
private
|
96
88
|
|
97
89
|
def bundle_config(minifier_cmd)
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'support/test_case'
|
2
|
+
require 'support/fixture_config'
|
3
|
+
require 'support/static_file_api_config'
|
4
|
+
require 'jekyll/minibundle/development_file'
|
5
|
+
|
6
|
+
module Jekyll::Minibundle::Test
|
7
|
+
class DevelopmentFileCollectionPropertiesTest < TestCase
|
8
|
+
include FixtureConfig
|
9
|
+
include StaticFileAPIConfig
|
10
|
+
|
11
|
+
def setup
|
12
|
+
@results ||= with_fake_site do |site|
|
13
|
+
files = DevelopmentFileCollection.new(site, bundle_config).instance_variable_get('@files')
|
14
|
+
{
|
15
|
+
dependency: get_send_results(files[0], STATIC_FILE_API_PROPERTIES),
|
16
|
+
app: get_send_results(files[1], STATIC_FILE_API_PROPERTIES)
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_to_liquid
|
22
|
+
hash = @results.fetch(:dependency).fetch(:to_liquid)
|
23
|
+
assert_equal "/#{JS_BUNDLE_SOURCE_DIR}/dependency.js", hash['path']
|
24
|
+
refute_empty hash['modified_time']
|
25
|
+
assert_equal '.js', hash['extname']
|
26
|
+
|
27
|
+
hash = @results.fetch(:app).fetch(:to_liquid)
|
28
|
+
assert_equal "/#{JS_BUNDLE_SOURCE_DIR}/app.js", hash['path']
|
29
|
+
refute_empty hash['modified_time']
|
30
|
+
assert_equal '.js', hash['extname']
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_extname
|
34
|
+
assert_equal '.js', @results.fetch(:dependency).fetch(:extname)
|
35
|
+
assert_equal '.js', @results.fetch(:app).fetch(:extname)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_destination_rel_dir
|
39
|
+
assert_equal 'assets/site', @results.fetch(:dependency).fetch(:destination_rel_dir)
|
40
|
+
assert_equal 'assets/site', @results.fetch(:app).fetch(:destination_rel_dir)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_write?
|
44
|
+
assert @results.fetch(:dependency).fetch(:write?)
|
45
|
+
assert @results.fetch(:app).fetch(:write?)
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def bundle_config
|
51
|
+
{
|
52
|
+
'type' => :js,
|
53
|
+
'source_dir' => JS_BUNDLE_SOURCE_DIR,
|
54
|
+
'assets' => %w{dependency app},
|
55
|
+
'destination_path' => JS_BUNDLE_DESTINATION_PATH,
|
56
|
+
'attributes' => {}
|
57
|
+
}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/test/unit/{development_file_collection_test.rb → development_file_collection_writing_test.rb}
RENAMED
@@ -3,7 +3,7 @@ require 'support/fixture_config'
|
|
3
3
|
require 'jekyll/minibundle/development_file'
|
4
4
|
|
5
5
|
module Jekyll::Minibundle::Test
|
6
|
-
class
|
6
|
+
class DevelopmentFileCollectionWritingTest < TestCase
|
7
7
|
include FixtureConfig
|
8
8
|
|
9
9
|
def test_calling_write_before_destination_path_for_markup_writes_destination
|
@@ -24,26 +24,6 @@ module Jekyll::Minibundle::Test
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def test_to_liquid
|
28
|
-
with_fake_site do |site|
|
29
|
-
files = DevelopmentFileCollection.new(site, bundle_config).
|
30
|
-
instance_variable_get('@files').
|
31
|
-
sort_by { |f| f.path }
|
32
|
-
|
33
|
-
hash = files[0].to_liquid
|
34
|
-
|
35
|
-
assert_equal "/#{JS_BUNDLE_SOURCE_DIR}/app.js", hash['path']
|
36
|
-
refute_empty hash['modified_time']
|
37
|
-
assert_equal '.js', hash['extname']
|
38
|
-
|
39
|
-
hash = files[1].to_liquid
|
40
|
-
|
41
|
-
assert_equal "/#{JS_BUNDLE_SOURCE_DIR}/dependency.js", hash['path']
|
42
|
-
refute_empty hash['modified_time']
|
43
|
-
assert_equal '.js', hash['extname']
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
27
|
private
|
48
28
|
|
49
29
|
def bundle_config
|
@@ -3,15 +3,17 @@ require 'jekyll/minibundle/environment'
|
|
3
3
|
|
4
4
|
module Jekyll::Minibundle::Test
|
5
5
|
class EnvironmentTest < TestCase
|
6
|
-
def
|
7
|
-
assert_equal 1, Environment.
|
8
|
-
assert_equal({leaf: 1}, Environment.
|
6
|
+
def test_traverse_keys_returns_value_when_found
|
7
|
+
assert_equal 1, Environment.traverse_keys({top: {middle: {leaf: 1}}}, [:top, :middle, :leaf])
|
8
|
+
assert_equal({leaf: 1}, Environment.traverse_keys({top: {middle: {leaf: 1}}}, [:top, :middle]))
|
9
|
+
assert_equal 1, Environment.traverse_keys({top: [{}, {leaf: 1}]}, [:top, 1, :leaf])
|
9
10
|
end
|
10
11
|
|
11
|
-
def
|
12
|
-
assert_nil Environment.
|
13
|
-
assert_nil Environment.
|
14
|
-
assert_nil Environment.
|
12
|
+
def test_traverse_keys_returns_nil_when_not_found
|
13
|
+
assert_nil Environment.traverse_keys({}, [:top, :no_such_leaf])
|
14
|
+
assert_nil Environment.traverse_keys({top: {}}, [:top, :no_such_leaf])
|
15
|
+
assert_nil Environment.traverse_keys({top: {leaf: 1}}, [:top, :no_such_leaf])
|
16
|
+
assert_nil Environment.traverse_keys({top: []}, [:top, 0])
|
15
17
|
end
|
16
18
|
|
17
19
|
def test_find_site_config_returns_value_when_found
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'support/test_case'
|
2
|
+
require 'support/fixture_config'
|
3
|
+
require 'support/static_file_api_config'
|
4
|
+
require 'jekyll/minibundle/stamp_file'
|
5
|
+
|
6
|
+
module Jekyll::Minibundle::Test
|
7
|
+
class StampFilePropertiesTest < TestCase
|
8
|
+
include FixtureConfig
|
9
|
+
include StaticFileAPIConfig
|
10
|
+
|
11
|
+
def setup
|
12
|
+
@results ||= with_fake_site do |site|
|
13
|
+
file = StampFile.new(site, STAMP_SOURCE_PATH, STAMP_DESTINATION_PATH, &stamp_basenamer)
|
14
|
+
get_send_results(file, STATIC_FILE_API_PROPERTIES)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_to_liquid
|
19
|
+
hash = @results.fetch(:to_liquid)
|
20
|
+
assert_equal "/#{STAMP_SOURCE_PATH}", hash['path']
|
21
|
+
refute_empty hash['modified_time']
|
22
|
+
assert_equal '.css', hash['extname']
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_extname
|
26
|
+
assert_equal '.css', @results.fetch(:extname)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_destination_rel_dir
|
30
|
+
assert_equal 'assets', @results.fetch(:destination_rel_dir)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_write?
|
34
|
+
assert @results.fetch(:write?)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def stamp_basenamer
|
40
|
+
->(base, ext, stamper) { "#{base}-#{stamper.call}#{ext}" }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -3,12 +3,12 @@ require 'support/fixture_config'
|
|
3
3
|
require 'jekyll/minibundle/stamp_file'
|
4
4
|
|
5
5
|
module Jekyll::Minibundle::Test
|
6
|
-
class
|
6
|
+
class StampFileWritingTest < TestCase
|
7
7
|
include FixtureConfig
|
8
8
|
|
9
9
|
def test_calling_destination_path_for_markup_determines_fingerprint_and_destination_write
|
10
10
|
with_fake_site do |site|
|
11
|
-
stamp_file =
|
11
|
+
stamp_file = new_stamp_file(site)
|
12
12
|
source = source_path(STAMP_SOURCE_PATH)
|
13
13
|
old_destination = destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)
|
14
14
|
org_markup = stamp_file.destination_path_for_markup
|
@@ -40,7 +40,7 @@ module Jekyll::Minibundle::Test
|
|
40
40
|
|
41
41
|
def test_many_consecutive_destination_path_for_markup_calls_trigger_one_destination_write
|
42
42
|
with_fake_site do |site|
|
43
|
-
stamp_file =
|
43
|
+
stamp_file = new_stamp_file(site)
|
44
44
|
source = source_path(STAMP_SOURCE_PATH)
|
45
45
|
destination = destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)
|
46
46
|
org_markup = stamp_file.destination_path_for_markup
|
@@ -62,7 +62,7 @@ module Jekyll::Minibundle::Test
|
|
62
62
|
|
63
63
|
def test_calling_write_before_destination_path_for_markup_has_no_effect
|
64
64
|
with_fake_site do |site|
|
65
|
-
stamp_file =
|
65
|
+
stamp_file = new_stamp_file(site)
|
66
66
|
|
67
67
|
refute stamp_file.write('_site')
|
68
68
|
assert_empty Dir[destination_path('assets/*.css')]
|
@@ -74,17 +74,12 @@ module Jekyll::Minibundle::Test
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
def test_to_liquid
|
78
|
-
with_fake_site do |site|
|
79
|
-
hash = StampFile.new(site, STAMP_SOURCE_PATH, STAMP_DESTINATION_PATH, &stamp_basenamer).to_liquid
|
80
|
-
assert_equal "/#{STAMP_SOURCE_PATH}", hash['path']
|
81
|
-
refute_empty hash['modified_time']
|
82
|
-
assert_equal '.css', hash['extname']
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
77
|
private
|
87
78
|
|
79
|
+
def new_stamp_file(site)
|
80
|
+
StampFile.new(site, STAMP_SOURCE_PATH, STAMP_DESTINATION_PATH, &stamp_basenamer)
|
81
|
+
end
|
82
|
+
|
88
83
|
def stamp_basenamer
|
89
84
|
->(base, ext, stamper) { "#{base}-#{stamper.call}#{ext}" }
|
90
85
|
end
|
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.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tuomas Kareinen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -85,7 +85,7 @@ files:
|
|
85
85
|
- lib/jekyll/minibundle.rb
|
86
86
|
- lib/jekyll/minibundle/asset_bundle.rb
|
87
87
|
- lib/jekyll/minibundle/asset_file_operations.rb
|
88
|
-
- lib/jekyll/minibundle/
|
88
|
+
- lib/jekyll/minibundle/asset_file_properties.rb
|
89
89
|
- lib/jekyll/minibundle/asset_file_registry.rb
|
90
90
|
- lib/jekyll/minibundle/asset_stamp.rb
|
91
91
|
- lib/jekyll/minibundle/asset_tag_markup.rb
|
@@ -115,18 +115,22 @@ files:
|
|
115
115
|
- test/integration/ministamp_test.rb
|
116
116
|
- test/integration/static_files_as_asset_sources_test.rb
|
117
117
|
- test/support/fixture_config.rb
|
118
|
+
- test/support/static_file_api_config.rb
|
118
119
|
- test/support/test_case.rb
|
119
120
|
- test/unit/asset_bundle_test.rb
|
120
121
|
- test/unit/asset_file_registry_test.rb
|
121
122
|
- test/unit/asset_tag_markup_test.rb
|
122
|
-
- test/unit/
|
123
|
-
- test/unit/
|
123
|
+
- test/unit/bundle_file_properties_test.rb
|
124
|
+
- test/unit/bundle_file_writing_test.rb
|
125
|
+
- test/unit/development_file_collection_properties_test.rb
|
126
|
+
- test/unit/development_file_collection_writing_test.rb
|
124
127
|
- test/unit/environment_test.rb
|
125
128
|
- test/unit/jekyll_payload_test.rb
|
126
129
|
- test/unit/jekyll_static_file_api_test.rb
|
127
130
|
- test/unit/mini_bundle_block_test.rb
|
128
131
|
- test/unit/mini_stamp_tag_test.rb
|
129
|
-
- test/unit/
|
132
|
+
- test/unit/stamp_file_properties_test.rb
|
133
|
+
- test/unit/stamp_file_writing_test.rb
|
130
134
|
homepage: https://github.com/tkareine/jekyll-minibundle
|
131
135
|
licenses:
|
132
136
|
- MIT
|
@@ -152,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
156
|
version: '0'
|
153
157
|
requirements: []
|
154
158
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.4.
|
159
|
+
rubygems_version: 2.4.5
|
156
160
|
signing_key:
|
157
161
|
specification_version: 4
|
158
162
|
summary: A minimalistic asset bundling plugin for Jekyll
|
@@ -174,15 +178,19 @@ test_files:
|
|
174
178
|
- test/integration/ministamp_test.rb
|
175
179
|
- test/integration/static_files_as_asset_sources_test.rb
|
176
180
|
- test/support/fixture_config.rb
|
181
|
+
- test/support/static_file_api_config.rb
|
177
182
|
- test/support/test_case.rb
|
178
183
|
- test/unit/asset_bundle_test.rb
|
179
184
|
- test/unit/asset_file_registry_test.rb
|
180
185
|
- test/unit/asset_tag_markup_test.rb
|
181
|
-
- test/unit/
|
182
|
-
- test/unit/
|
186
|
+
- test/unit/bundle_file_properties_test.rb
|
187
|
+
- test/unit/bundle_file_writing_test.rb
|
188
|
+
- test/unit/development_file_collection_properties_test.rb
|
189
|
+
- test/unit/development_file_collection_writing_test.rb
|
183
190
|
- test/unit/environment_test.rb
|
184
191
|
- test/unit/jekyll_payload_test.rb
|
185
192
|
- test/unit/jekyll_static_file_api_test.rb
|
186
193
|
- test/unit/mini_bundle_block_test.rb
|
187
194
|
- test/unit/mini_stamp_tag_test.rb
|
188
|
-
- test/unit/
|
195
|
+
- test/unit/stamp_file_properties_test.rb
|
196
|
+
- test/unit/stamp_file_writing_test.rb
|