jekyll-minibundle 2.1.2 → 2.2.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 +4 -4
- data/CHANGELOG.md +96 -42
- data/LICENSE.txt +1 -1
- data/README.md +232 -52
- data/Rakefile +16 -0
- data/jekyll-minibundle.gemspec +7 -6
- data/lib/jekyll/minibundle/asset_bundle.rb +3 -3
- data/lib/jekyll/minibundle/asset_file_drop.rb +45 -0
- data/lib/jekyll/minibundle/asset_file_properties.rb +12 -8
- data/lib/jekyll/minibundle/asset_file_registry.rb +4 -4
- data/lib/jekyll/minibundle/asset_tag_markup.rb +21 -20
- data/lib/jekyll/minibundle/bundle_file.rb +6 -1
- data/lib/jekyll/minibundle/development_file.rb +2 -1
- data/lib/jekyll/minibundle/development_file_collection.rb +2 -2
- data/lib/jekyll/minibundle/environment.rb +13 -15
- data/lib/jekyll/minibundle/files.rb +16 -18
- data/lib/jekyll/minibundle/hashes.rb +10 -12
- data/lib/jekyll/minibundle/log.rb +5 -7
- data/lib/jekyll/minibundle/mini_bundle_block.rb +35 -12
- data/lib/jekyll/minibundle/mini_stamp_tag.rb +108 -16
- data/lib/jekyll/minibundle/stamp_file.rb +1 -0
- data/lib/jekyll/minibundle/variable_template.rb +145 -0
- data/lib/jekyll/minibundle/variable_template_registry.rb +19 -0
- data/lib/jekyll/minibundle/version.rb +1 -1
- data/test/fixture/site/_bin/with_count +1 -1
- data/test/integration/minibundle_development_mode_test.rb +146 -61
- data/test/integration/minibundle_production_mode_test.rb +271 -143
- data/test/integration/ministamp_development_mode_test.rb +66 -25
- data/test/integration/ministamp_production_mode_test.rb +129 -37
- data/test/integration/static_files_as_asset_sources_test.rb +10 -10
- data/test/support/assertions.rb +1 -1
- data/test/support/{static_file_api_config.rb → static_file_config.rb} +6 -3
- data/test/support/test_case.rb +7 -4
- data/test/unit/asset_bundle_test.rb +6 -6
- data/test/unit/asset_file_drop_test.rb +65 -0
- data/test/unit/asset_file_registry_test.rb +136 -98
- data/test/unit/asset_tag_markup_test.rb +11 -5
- data/test/unit/bundle_file_properties_test.rb +44 -23
- data/test/unit/bundle_file_writing_test.rb +50 -32
- data/test/unit/development_file_properties_test.rb +95 -0
- data/test/unit/development_file_writing_test.rb +15 -6
- data/test/unit/environment_test.rb +3 -3
- data/test/unit/files_test.rb +7 -7
- data/test/unit/hashes_test.rb +12 -12
- data/test/unit/jekyll_static_file_api_test.rb +91 -20
- data/test/unit/mini_bundle_block_test.rb +59 -9
- data/test/unit/mini_stamp_tag_test.rb +37 -6
- data/test/unit/stamp_file_properties_test.rb +47 -24
- data/test/unit/stamp_file_writing_test.rb +33 -24
- data/test/unit/variable_template_test.rb +121 -0
- metadata +27 -6
- data/test/unit/development_file_collection_properties_test.rb +0 -106
@@ -1,106 +0,0 @@
|
|
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_defaults
|
22
|
-
assert_equal({}, @@results.fetch(:dependency).fetch(:defaults))
|
23
|
-
assert_equal({}, @@results.fetch(:app).fetch(:defaults))
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_destination_rel_dir
|
27
|
-
assert_equal 'assets/site', @@results.fetch(:dependency).fetch(:destination_rel_dir)
|
28
|
-
assert_equal 'assets/site', @@results.fetch(:app).fetch(:destination_rel_dir)
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_name
|
32
|
-
assert_equal 'dependency.js', @@results.fetch(:dependency).fetch(:name)
|
33
|
-
assert_equal 'app.js', @@results.fetch(:app).fetch(:name)
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_extname
|
37
|
-
assert_equal '.js', @@results.fetch(:dependency).fetch(:extname)
|
38
|
-
assert_equal '.js', @@results.fetch(:app).fetch(:extname)
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_modified_time
|
42
|
-
assert_instance_of Time, @@results.fetch(:dependency).fetch(:modified_time)
|
43
|
-
assert_instance_of Time, @@results.fetch(:app).fetch(:modified_time)
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_mtime
|
47
|
-
dep_mtime = @@results.fetch(:dependency).fetch(:modified_time)
|
48
|
-
assert_equal dep_mtime.to_i, @@results.fetch(:dependency).fetch(:mtime)
|
49
|
-
|
50
|
-
app_mtime = @@results.fetch(:app).fetch(:modified_time)
|
51
|
-
assert_equal app_mtime.to_i, @@results.fetch(:app).fetch(:mtime)
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_path
|
55
|
-
assert_match(%r{/#{JS_BUNDLE_SOURCE_DIR}/dependency.js\z}, @@results.fetch(:dependency).fetch(:relative_path))
|
56
|
-
assert_match(%r{/#{JS_BUNDLE_SOURCE_DIR}/app.js\z}, @@results.fetch(:app).fetch(:relative_path))
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_placeholders
|
60
|
-
assert_equal({}, @@results.fetch(:dependency).fetch(:placeholders))
|
61
|
-
assert_equal({}, @@results.fetch(:app).fetch(:placeholders))
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_relative_path
|
65
|
-
assert_equal "/#{JS_BUNDLE_SOURCE_DIR}/dependency.js", @@results.fetch(:dependency).fetch(:relative_path)
|
66
|
-
assert_equal "/#{JS_BUNDLE_SOURCE_DIR}/app.js", @@results.fetch(:app).fetch(:relative_path)
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_to_liquid
|
70
|
-
hash = @@results.fetch(:dependency).fetch(:to_liquid)
|
71
|
-
assert_equal 'dependency', hash.fetch('basename')
|
72
|
-
assert_equal 'dependency.js', hash.fetch('name')
|
73
|
-
assert_equal '.js', hash.fetch('extname')
|
74
|
-
assert_instance_of Time, hash.fetch('modified_time')
|
75
|
-
assert_equal "/#{JS_BUNDLE_SOURCE_DIR}/dependency.js", hash.fetch('path')
|
76
|
-
|
77
|
-
hash = @@results.fetch(:app).fetch(:to_liquid)
|
78
|
-
assert_equal 'app', hash.fetch('basename')
|
79
|
-
assert_equal 'app.js', hash.fetch('name')
|
80
|
-
assert_equal '.js', hash.fetch('extname')
|
81
|
-
assert_instance_of Time, hash.fetch('modified_time')
|
82
|
-
assert_equal "/#{JS_BUNDLE_SOURCE_DIR}/app.js", hash.fetch('path')
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_type
|
86
|
-
assert_nil @@results.fetch(:dependency).fetch(:type)
|
87
|
-
assert_nil @@results.fetch(:app).fetch(:type)
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_write?
|
91
|
-
assert @@results.fetch(:dependency).fetch(:write?)
|
92
|
-
assert @@results.fetch(:app).fetch(:write?)
|
93
|
-
end
|
94
|
-
|
95
|
-
private
|
96
|
-
|
97
|
-
def bundle_config
|
98
|
-
{
|
99
|
-
'type' => :js,
|
100
|
-
'source_dir' => JS_BUNDLE_SOURCE_DIR,
|
101
|
-
'assets' => %w{dependency app},
|
102
|
-
'destination_path' => JS_BUNDLE_DESTINATION_PATH
|
103
|
-
}
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|