jekyll-minibundle 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -6
- data/README.md +34 -24
- data/Rakefile +19 -14
- data/jekyll-minibundle.gemspec +5 -4
- data/lib/jekyll/minibundle/asset_bundle.rb +24 -4
- data/lib/jekyll/minibundle/asset_file_operations.rb +0 -8
- data/lib/jekyll/minibundle/asset_file_properties.rb +26 -8
- data/lib/jekyll/minibundle/asset_file_registry.rb +57 -21
- data/lib/jekyll/minibundle/asset_tag_markup.rb +13 -4
- data/lib/jekyll/minibundle/bundle_file.rb +9 -6
- data/lib/jekyll/minibundle/compatibility.rb +11 -1
- data/lib/jekyll/minibundle/development_file.rb +6 -0
- data/lib/jekyll/minibundle/development_file_collection.rb +3 -16
- data/lib/jekyll/minibundle/environment.rb +5 -12
- data/lib/jekyll/minibundle/files.rb +18 -0
- data/lib/jekyll/minibundle/hashes.rb +20 -0
- data/lib/jekyll/minibundle/mini_bundle_block.rb +52 -12
- data/lib/jekyll/minibundle/mini_stamp_tag.rb +27 -8
- data/lib/jekyll/minibundle/stamp_file.rb +9 -6
- data/lib/jekyll/minibundle/version.rb +1 -1
- data/test/fixture/site/_bin/with_count +6 -5
- data/test/integration/known_caveats_test.rb +89 -0
- data/test/integration/minibundle_development_mode_test.rb +171 -26
- data/test/integration/minibundle_production_mode_test.rb +234 -42
- data/test/integration/ministamp_development_mode_test.rb +145 -0
- data/test/integration/{ministamp_test.rb → ministamp_production_mode_test.rb} +72 -23
- data/test/integration/static_files_as_asset_sources_test.rb +3 -0
- data/test/support/assertions.rb +24 -0
- data/test/support/fixture_config.rb +13 -10
- data/test/support/static_file_api_config.rb +9 -3
- data/test/support/test_case.rb +7 -6
- data/test/unit/asset_bundle_test.rb +16 -2
- data/test/unit/asset_file_registry_test.rb +117 -14
- data/test/unit/asset_tag_markup_test.rb +17 -5
- data/test/unit/bundle_file_properties_test.rb +32 -8
- data/test/unit/bundle_file_writing_test.rb +10 -11
- data/test/unit/development_file_collection_properties_test.rb +47 -15
- data/test/unit/environment_test.rb +0 -13
- data/test/unit/files_test.rb +46 -0
- data/test/unit/hashes_test.rb +41 -0
- data/test/unit/mini_bundle_block_test.rb +56 -1
- data/test/unit/mini_stamp_tag_test.rb +8 -8
- data/test/unit/stamp_file_properties_test.rb +32 -13
- data/test/unit/stamp_file_writing_test.rb +1 -5
- metadata +38 -16
- data/test/unit/development_file_collection_writing_test.rb +0 -43
- data/test/unit/jekyll_payload_test.rb +0 -64
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'support/test_case'
|
2
|
+
require 'jekyll/minibundle/files'
|
3
|
+
|
4
|
+
module Jekyll::Minibundle::Test
|
5
|
+
class FilesTest < TestCase
|
6
|
+
def test_read_last_with_non_existing_file_raises_exception
|
7
|
+
assert_raises(Errno::ENOENT) { Files.read_last('no-such-file', 4) }
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_read_last_with_empty_file_returns_empty
|
11
|
+
Tempfile.open('test') do |file|
|
12
|
+
file.close
|
13
|
+
|
14
|
+
assert_equal '', Files.read_last(file.path, 4)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_read_last_with_file_bigger_than_max_size_returns_last_bytes
|
19
|
+
Tempfile.open('test') do |file|
|
20
|
+
file.write("1\n2\n3\n4")
|
21
|
+
file.close
|
22
|
+
|
23
|
+
assert_equal "\n3\n4", Files.read_last(file.path, 4)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_read_last_with_file_smaller_than_max_size_returns_all_contents
|
28
|
+
Tempfile.open('test') do |file|
|
29
|
+
file.write("1\n2")
|
30
|
+
file.close
|
31
|
+
|
32
|
+
assert_equal "1\n2", Files.read_last(file.path, 100)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_read_last_with_max_size_zero_or_negative_returns_empty
|
37
|
+
Tempfile.open('test') do |file|
|
38
|
+
file.write("1\n2")
|
39
|
+
file.close
|
40
|
+
|
41
|
+
assert_equal '', Files.read_last(file.path, 0)
|
42
|
+
assert_equal '', Files.read_last(file.path, -1)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'support/test_case'
|
2
|
+
require 'jekyll/minibundle/hashes'
|
3
|
+
|
4
|
+
module Jekyll::Minibundle::Test
|
5
|
+
class HashesTest < TestCase
|
6
|
+
def test_dig_returns_value_when_found
|
7
|
+
assert_equal 1, Hashes.dig({top: {middle: {leaf: 1}}}, :top, :middle, :leaf)
|
8
|
+
assert_equal 1, Hashes.dig({top: [{}, {leaf: 1}]}, :top, 1, :leaf)
|
9
|
+
assert_equal 1, Hashes.dig([{}, {middle: [{}, {leaf: 1}]}], 1, :middle, 1, :leaf)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_dig_returns_same_found_object
|
13
|
+
leaf_obj = {leaf: 1}
|
14
|
+
assert_same leaf_obj, Hashes.dig({top: {middle: leaf_obj}}, :top, :middle)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_dig_returns_nil_when_not_found
|
18
|
+
assert_nil Hashes.dig({}, :no_such)
|
19
|
+
assert_nil Hashes.dig([], 0)
|
20
|
+
assert_nil Hashes.dig({top: {}}, :top, :no_such_leaf)
|
21
|
+
assert_nil Hashes.dig({top: {leaf: 1}}, :top, :no_such_leaf)
|
22
|
+
assert_nil Hashes.dig({top: []}, :top, 0)
|
23
|
+
assert_nil Hashes.dig([{leaf: 1}], 0, :no_such)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_dig_returns_nil_for_nil
|
27
|
+
assert_nil Hashes.dig(nil, :no_such_key)
|
28
|
+
assert_nil Hashes.dig(nil, 0)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_pick_returns_hash_with_specified_keys
|
32
|
+
assert_equal({}, Hashes.pick(a: 1, 'b' => 2, 'c' => 3))
|
33
|
+
assert_equal({}, Hashes.pick({}))
|
34
|
+
assert_equal({a: 1, 'c' => 3}, Hashes.pick({a: 1, 'b' => 2, 'c' => 3}, :a, 'c'))
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_pick_raises_exception_if_key_does_not_exist
|
38
|
+
assert_raises(KeyError) { Hashes.pick({}, :no_such) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -1,13 +1,68 @@
|
|
1
1
|
require 'support/test_case'
|
2
|
+
require 'support/fixture_config'
|
2
3
|
require 'jekyll/minibundle/mini_bundle_block'
|
3
4
|
|
4
5
|
module Jekyll::Minibundle::Test
|
5
6
|
class MiniBundleBlockTest < TestCase
|
7
|
+
include FixtureConfig
|
8
|
+
|
6
9
|
def test_raise_exception_if_no_type_argument
|
7
10
|
err = assert_raises(ArgumentError) do
|
8
|
-
Liquid::Template.parse(
|
11
|
+
Liquid::Template.parse('{% minibundle %} {% endminibundle %}')
|
9
12
|
end
|
10
13
|
assert_equal "No asset type for minibundle block; pass value such as 'css' or 'js' as the argument", err.to_s
|
11
14
|
end
|
15
|
+
|
16
|
+
[
|
17
|
+
{
|
18
|
+
description: 'nil_baseurl_results_in_asset_url_without_baseurl',
|
19
|
+
baseurl_config: 'baseurl:',
|
20
|
+
expected_asset_url: CSS_BUNDLE_DESTINATION_FINGERPRINT_PATH
|
21
|
+
},
|
22
|
+
{
|
23
|
+
description: 'empty_baseurl_results_in_asset_url_without_baseurl',
|
24
|
+
baseurl_config: "baseurl: ''",
|
25
|
+
expected_asset_url: CSS_BUNDLE_DESTINATION_FINGERPRINT_PATH
|
26
|
+
},
|
27
|
+
{
|
28
|
+
description: 'slash_baseurl_results_in_asset_url_with_baseurl',
|
29
|
+
baseurl_config: 'baseurl: /',
|
30
|
+
expected_asset_url: "/#{CSS_BUNDLE_DESTINATION_FINGERPRINT_PATH}"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
description: 'slash_root_baseurl_results_in_asset_url_with_baseurl',
|
34
|
+
baseurl_config: 'baseurl: /root',
|
35
|
+
expected_asset_url: "/root/#{CSS_BUNDLE_DESTINATION_FINGERPRINT_PATH}"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
description: 'slash_root_slash_baseurl_results_in_asset_url_with_baseurl',
|
39
|
+
baseurl_config: 'baseurl: /root/',
|
40
|
+
expected_asset_url: "/root/#{CSS_BUNDLE_DESTINATION_FINGERPRINT_PATH}"
|
41
|
+
}
|
42
|
+
].each do |spec|
|
43
|
+
define_method :"test_normalizing_baseurl_with_#{spec.fetch(:description)}" do
|
44
|
+
AssetFileRegistry.clear
|
45
|
+
|
46
|
+
template = Liquid::Template.parse(<<-END)
|
47
|
+
{% minibundle css %}
|
48
|
+
source_dir: _assets/styles
|
49
|
+
destination_path: assets/site
|
50
|
+
#{spec.fetch(:baseurl_config)}
|
51
|
+
assets:
|
52
|
+
- reset
|
53
|
+
- common
|
54
|
+
minifier_cmd: #{minifier_cmd_to_remove_comments}
|
55
|
+
{% endminibundle %}
|
56
|
+
END
|
57
|
+
|
58
|
+
actual_output = nil
|
59
|
+
capture_io do
|
60
|
+
actual_output = template.render({}, registers: {site: new_fake_site(site_fixture_path)})
|
61
|
+
end
|
62
|
+
expected_output = %{<link rel="stylesheet" href="#{spec.fetch(:expected_asset_url)}">\n}
|
63
|
+
|
64
|
+
assert_equal expected_output, actual_output
|
65
|
+
end
|
66
|
+
end
|
12
67
|
end
|
13
68
|
end
|
@@ -8,24 +8,24 @@ module Jekyll::Minibundle::Test
|
|
8
8
|
|
9
9
|
def test_raise_exception_if_no_asset_source_argument
|
10
10
|
err = assert_raises(ArgumentError) do
|
11
|
-
Liquid::Template.parse(
|
11
|
+
Liquid::Template.parse('{% ministamp %}')
|
12
12
|
end
|
13
|
-
assert_equal "No asset source for ministamp tag; pass value such as '
|
13
|
+
assert_equal "No asset source for ministamp tag; pass value such as '_assets/site.css' as the first argument", err.to_s
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_raise_exception_if_no_asset_destination_argument
|
17
17
|
err = assert_raises(ArgumentError) do
|
18
|
-
Liquid::Template.parse(
|
18
|
+
Liquid::Template.parse('{% ministamp /_assets/site.css %}')
|
19
19
|
end
|
20
|
-
assert_equal "No asset destination for ministamp tag; pass value such as '
|
20
|
+
assert_equal "No asset destination for ministamp tag; pass value such as 'assets/site.css' as the second argument", err.to_s
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_ignore_rest_arguments
|
24
24
|
AssetFileRegistry.clear
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
assert_equal STAMP_DESTINATION_FINGERPRINT_PATH,
|
25
|
+
output = Liquid::Template
|
26
|
+
.parse("{% ministamp #{STAMP_SOURCE_PATH} #{STAMP_DESTINATION_PATH} rest %}")
|
27
|
+
.render({}, registers: {site: new_fake_site(site_fixture_path)})
|
28
|
+
assert_equal STAMP_DESTINATION_FINGERPRINT_PATH, output
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -10,34 +10,53 @@ module Jekyll::Minibundle::Test
|
|
10
10
|
|
11
11
|
def setup
|
12
12
|
@results ||= with_fake_site do |site|
|
13
|
-
file = StampFile.new(site, STAMP_SOURCE_PATH, STAMP_DESTINATION_PATH
|
13
|
+
file = StampFile.new(site, STAMP_SOURCE_PATH, STAMP_DESTINATION_PATH)
|
14
14
|
get_send_results(file, STATIC_FILE_API_PROPERTIES)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
def test_defaults
|
19
|
+
assert_equal({}, @results.fetch(:defaults))
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_destination_rel_dir
|
23
|
+
assert_equal 'assets', @results.fetch(:destination_rel_dir)
|
23
24
|
end
|
24
25
|
|
25
26
|
def test_extname
|
26
27
|
assert_equal '.css', @results.fetch(:extname)
|
27
28
|
end
|
28
29
|
|
29
|
-
def
|
30
|
-
|
30
|
+
def test_modified_time
|
31
|
+
assert_instance_of Time, @results.fetch(:modified_time)
|
31
32
|
end
|
32
33
|
|
33
|
-
def
|
34
|
-
|
34
|
+
def test_mtime
|
35
|
+
mtime = @results.fetch(:modified_time)
|
36
|
+
assert_equal mtime.to_i, @results.fetch(:mtime)
|
35
37
|
end
|
36
38
|
|
37
|
-
|
39
|
+
def test_placeholders
|
40
|
+
assert_equal({}, @results.fetch(:placeholders))
|
41
|
+
end
|
38
42
|
|
39
|
-
def
|
40
|
-
|
43
|
+
def test_relative_path
|
44
|
+
assert_equal "/#{STAMP_SOURCE_PATH}", @results.fetch(:relative_path)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_to_liquid
|
48
|
+
hash = @results.fetch(:to_liquid)
|
49
|
+
assert_equal "/#{STAMP_SOURCE_PATH}", hash['path']
|
50
|
+
assert_instance_of Time, hash['modified_time']
|
51
|
+
assert_equal '.css', hash['extname']
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_type
|
55
|
+
assert_nil @results.fetch(:type)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_write?
|
59
|
+
assert @results.fetch(:write?)
|
41
60
|
end
|
42
61
|
end
|
43
62
|
end
|
@@ -77,11 +77,7 @@ module Jekyll::Minibundle::Test
|
|
77
77
|
private
|
78
78
|
|
79
79
|
def new_stamp_file(site)
|
80
|
-
StampFile.new(site, STAMP_SOURCE_PATH, STAMP_DESTINATION_PATH
|
81
|
-
end
|
82
|
-
|
83
|
-
def stamp_basenamer
|
84
|
-
->(base, ext, stamper) { "#{base}-#{stamper.call}#{ext}" }
|
80
|
+
StampFile.new(site, STAMP_SOURCE_PATH, STAMP_DESTINATION_PATH)
|
85
81
|
end
|
86
82
|
end
|
87
83
|
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.
|
4
|
+
version: 1.6.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:
|
11
|
+
date: 2016-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.8'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '5.
|
40
|
+
version: '5.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: nokogiri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '11.1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '11.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.38.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.38.0
|
69
83
|
description: |
|
70
84
|
A straightforward asset bundling plugin for Jekyll, utilizing external
|
71
85
|
minification tool of your choice. It provides asset concatenation for
|
@@ -94,6 +108,8 @@ files:
|
|
94
108
|
- lib/jekyll/minibundle/development_file.rb
|
95
109
|
- lib/jekyll/minibundle/development_file_collection.rb
|
96
110
|
- lib/jekyll/minibundle/environment.rb
|
111
|
+
- lib/jekyll/minibundle/files.rb
|
112
|
+
- lib/jekyll/minibundle/hashes.rb
|
97
113
|
- lib/jekyll/minibundle/mini_bundle_block.rb
|
98
114
|
- lib/jekyll/minibundle/mini_stamp_tag.rb
|
99
115
|
- lib/jekyll/minibundle/stamp_file.rb
|
@@ -110,10 +126,13 @@ files:
|
|
110
126
|
- test/fixture/site/about.html
|
111
127
|
- test/fixture/site/assets/site.css
|
112
128
|
- test/fixture/site/index.html
|
129
|
+
- test/integration/known_caveats_test.rb
|
113
130
|
- test/integration/minibundle_development_mode_test.rb
|
114
131
|
- test/integration/minibundle_production_mode_test.rb
|
115
|
-
- test/integration/
|
132
|
+
- test/integration/ministamp_development_mode_test.rb
|
133
|
+
- test/integration/ministamp_production_mode_test.rb
|
116
134
|
- test/integration/static_files_as_asset_sources_test.rb
|
135
|
+
- test/support/assertions.rb
|
117
136
|
- test/support/fixture_config.rb
|
118
137
|
- test/support/static_file_api_config.rb
|
119
138
|
- test/support/test_case.rb
|
@@ -123,9 +142,9 @@ files:
|
|
123
142
|
- test/unit/bundle_file_properties_test.rb
|
124
143
|
- test/unit/bundle_file_writing_test.rb
|
125
144
|
- test/unit/development_file_collection_properties_test.rb
|
126
|
-
- test/unit/development_file_collection_writing_test.rb
|
127
145
|
- test/unit/environment_test.rb
|
128
|
-
- test/unit/
|
146
|
+
- test/unit/files_test.rb
|
147
|
+
- test/unit/hashes_test.rb
|
129
148
|
- test/unit/jekyll_static_file_api_test.rb
|
130
149
|
- test/unit/mini_bundle_block_test.rb
|
131
150
|
- test/unit/mini_stamp_tag_test.rb
|
@@ -148,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
167
|
requirements:
|
149
168
|
- - ">="
|
150
169
|
- !ruby/object:Gem::Version
|
151
|
-
version:
|
170
|
+
version: 2.0.0
|
152
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
172
|
requirements:
|
154
173
|
- - ">="
|
@@ -156,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
175
|
version: '0'
|
157
176
|
requirements: []
|
158
177
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.
|
178
|
+
rubygems_version: 2.6.2
|
160
179
|
signing_key:
|
161
180
|
specification_version: 4
|
162
181
|
summary: A minimalistic asset bundling plugin for Jekyll
|
@@ -173,10 +192,13 @@ test_files:
|
|
173
192
|
- test/fixture/site/about.html
|
174
193
|
- test/fixture/site/assets/site.css
|
175
194
|
- test/fixture/site/index.html
|
195
|
+
- test/integration/known_caveats_test.rb
|
176
196
|
- test/integration/minibundle_development_mode_test.rb
|
177
197
|
- test/integration/minibundle_production_mode_test.rb
|
178
|
-
- test/integration/
|
198
|
+
- test/integration/ministamp_development_mode_test.rb
|
199
|
+
- test/integration/ministamp_production_mode_test.rb
|
179
200
|
- test/integration/static_files_as_asset_sources_test.rb
|
201
|
+
- test/support/assertions.rb
|
180
202
|
- test/support/fixture_config.rb
|
181
203
|
- test/support/static_file_api_config.rb
|
182
204
|
- test/support/test_case.rb
|
@@ -186,9 +208,9 @@ test_files:
|
|
186
208
|
- test/unit/bundle_file_properties_test.rb
|
187
209
|
- test/unit/bundle_file_writing_test.rb
|
188
210
|
- test/unit/development_file_collection_properties_test.rb
|
189
|
-
- test/unit/development_file_collection_writing_test.rb
|
190
211
|
- test/unit/environment_test.rb
|
191
|
-
- test/unit/
|
212
|
+
- test/unit/files_test.rb
|
213
|
+
- test/unit/hashes_test.rb
|
192
214
|
- test/unit/jekyll_static_file_api_test.rb
|
193
215
|
- test/unit/mini_bundle_block_test.rb
|
194
216
|
- test/unit/mini_stamp_tag_test.rb
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'support/test_case'
|
2
|
-
require 'support/fixture_config'
|
3
|
-
require 'jekyll/minibundle/development_file'
|
4
|
-
|
5
|
-
module Jekyll::Minibundle::Test
|
6
|
-
class DevelopmentFileCollectionWritingTest < TestCase
|
7
|
-
include FixtureConfig
|
8
|
-
|
9
|
-
def test_calling_write_before_destination_path_for_markup_writes_destination
|
10
|
-
with_fake_site do |site|
|
11
|
-
dev_files = DevelopmentFileCollection.new(site, bundle_config)
|
12
|
-
|
13
|
-
assert first_file_of(dev_files).write('_site')
|
14
|
-
|
15
|
-
destination_file = destination_path(JS_BUNDLE_DESTINATION_PATH, 'dependency.js')
|
16
|
-
|
17
|
-
assert File.exist?(destination_file)
|
18
|
-
|
19
|
-
org_mtime = mtime_of(destination_file)
|
20
|
-
dev_files.destination_path_for_markup
|
21
|
-
|
22
|
-
refute first_file_of(dev_files).write('_site')
|
23
|
-
assert_equal org_mtime, mtime_of(destination_file)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def bundle_config
|
30
|
-
{
|
31
|
-
'type' => :js,
|
32
|
-
'source_dir' => JS_BUNDLE_SOURCE_DIR,
|
33
|
-
'assets' => %w{dependency app},
|
34
|
-
'destination_path' => JS_BUNDLE_DESTINATION_PATH,
|
35
|
-
'attributes' => {}
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
def first_file_of(dev_files)
|
40
|
-
dev_files.instance_variable_get(:@files).first
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|