jekyll-minibundle 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e710ae4041aa12d52354bcfe4d26cede0a7f8c11
4
- data.tar.gz: d50a377c564e3186c790203e8c90d71a02c66cf8
3
+ metadata.gz: 53e069cbc2278b08d8cf93fc9598882f24a56b7f
4
+ data.tar.gz: 3fa82515fa89f2d632c5428f29adb233663e5f8f
5
5
  SHA512:
6
- metadata.gz: dadbb64b20d2000b3f02285ed43b9d69ebcfd46201f62a034ec08cd7d24cf645cd2415265a05af1d7dc0d6c65438cf61ed1c657cd4abd02f53daff0a221d76c7
7
- data.tar.gz: b214ee8464dc1f7ac95da50cbbf3635491fc9f990b167add78ef6f956e421770d9b8391d4b2e9572ce8f735c64eb9c796a4e08326f6b8c7d4d21c01deb851f78
6
+ metadata.gz: 158f82d5e10ea274b76d353b159fbed84b81d12c82cbd6339d3829056edda0adb473f7700336c24e18c765b0f632797e0227ce0e5ae488f01383989a4022f90c
7
+ data.tar.gz: 8380c680bda3674dfd760c32aa6b5cbb69f7d9a88ca9b1825d97f20c7d03f1be9bb2bf2334e418fcf1ab01be5fd2188881c3b145d917f73d40a5017cc3f6276a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.4.1 / 2013-12-27
2
+
3
+ * Add missing files to gem package
4
+
1
5
  # 1.4.0 / 2013-12-27
2
6
 
3
7
  * Fix bug causing exception to be thrown when `ministamp` or
@@ -11,10 +11,10 @@ Gem::Specification.new do |s|
11
11
 
12
12
  s.description = <<-END
13
13
  A straightforward asset bundling plugin for Jekyll, utilizing external
14
- minification tool of your choice. Provides asset concatenation for
15
- bundling and asset fingerprinting with MD5 digest for cache busting. No
16
- other runtime dependencies besides the minification tool (not even
17
- other gems).
14
+ minification tool of your choice. It provides asset concatenation for
15
+ bundling and asset fingerprinting with MD5 digest for cache
16
+ busting. There are no other runtime dependencies besides the
17
+ minification tool (not even other gems).
18
18
  END
19
19
 
20
20
  s.files = %w{
@@ -24,9 +24,11 @@ other gems).
24
24
  RELEASING.txt
25
25
  Rakefile
26
26
  jekyll-minibundle.gemspec
27
+ lib/jekyll/minibundle.rb
27
28
  lib/jekyll/minibundle/asset_bundle.rb
28
29
  lib/jekyll/minibundle/asset_file_operations.rb
29
30
  lib/jekyll/minibundle/asset_file_paths.rb
31
+ lib/jekyll/minibundle/asset_file_registry.rb
30
32
  lib/jekyll/minibundle/asset_stamp.rb
31
33
  lib/jekyll/minibundle/asset_tag_markup.rb
32
34
  lib/jekyll/minibundle/bundle_file.rb
@@ -37,7 +39,6 @@ other gems).
37
39
  lib/jekyll/minibundle/mini_stamp_tag.rb
38
40
  lib/jekyll/minibundle/stamp_file.rb
39
41
  lib/jekyll/minibundle/version.rb
40
- lib/jekyll/minibundle.rb
41
42
  }
42
43
 
43
44
  s.test_files = %w{
@@ -47,15 +48,21 @@ other gems).
47
48
  test/fixture/site/_assets/styles/reset.css
48
49
  test/fixture/site/_bin/remove_comments
49
50
  test/fixture/site/_bin/with_count
51
+ test/fixture/site/_config.yml
52
+ test/fixture/site/_layouts/default.html
50
53
  test/fixture/site/_plugins/minibundle.rb
51
54
  test/fixture/site/_tmp/site.css
55
+ test/fixture/site/about.html
56
+ test/fixture/site/assets/styles/reset.css
52
57
  test/fixture/site/index.html
53
58
  test/integration/minibundle_development_mode_test.rb
54
59
  test/integration/minibundle_production_mode_test.rb
55
60
  test/integration/ministamp_test.rb
61
+ test/integration/static_files_as_asset_sources_test.rb
56
62
  test/support/fixture_config.rb
57
63
  test/support/test_case.rb
58
64
  test/unit/asset_bundle_test.rb
65
+ test/unit/asset_file_registry_test.rb
59
66
  test/unit/asset_tag_markup_test.rb
60
67
  test/unit/bundle_file_test.rb
61
68
  test/unit/stamp_file_test.rb
@@ -0,0 +1,49 @@
1
+ require 'jekyll/minibundle/environment'
2
+ require 'jekyll/minibundle/development_file_collection'
3
+ require 'jekyll/minibundle/bundle_file'
4
+ require 'jekyll/minibundle/stamp_file'
5
+
6
+ module Jekyll::Minibundle
7
+ module AssetFileRegistry
8
+ def self.clear
9
+ @@_instances = {}
10
+ end
11
+
12
+ clear
13
+
14
+ def self.bundle_file(config)
15
+ asset_destination_path = "#{config['destination_path']}.#{config['type']}"
16
+ @@_instances[asset_destination_path] ||= register_bundle_file config
17
+ end
18
+
19
+ def self.stamp_file(asset_source_path, asset_destination_path)
20
+ @@_instances[asset_destination_path] ||= register_stamp_file asset_source_path, asset_destination_path
21
+ end
22
+
23
+ def self.register_bundle_file(config)
24
+ if Environment.development?
25
+ DevelopmentFileCollection.new config
26
+ else
27
+ BundleFile.new config
28
+ end
29
+ end
30
+
31
+ private_class_method :register_bundle_file
32
+
33
+ def self.register_stamp_file(asset_source_path, asset_destination_path)
34
+ StampFile.new(asset_source_path, asset_destination_path, &get_stamp_file_basenamer)
35
+ end
36
+
37
+ private_class_method :register_stamp_file
38
+
39
+ def self.get_stamp_file_basenamer
40
+ if Environment.development?
41
+ ->(base, ext, _) { base + ext }
42
+ else
43
+ ->(base, ext, stamper) { "#{base}-#{stamper.call}#{ext}" }
44
+ end
45
+ end
46
+
47
+ private_class_method :get_stamp_file_basenamer
48
+ end
49
+ end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Minibundle
3
- VERSION = '1.4.0'
3
+ VERSION = '1.4.1'
4
4
  end
5
5
  end
@@ -0,0 +1 @@
1
+ safe: false
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <link rel="stylesheet" href="{% ministamp _tmp/site.css assets/screen.css %}" media="screen">
5
+ {% minibundle css %}
6
+ source_dir: _assets/styles
7
+ destination_path: assets/site
8
+ assets:
9
+ - reset
10
+ - common
11
+ attributes:
12
+ id: my-styles
13
+ media: projection
14
+ {% endminibundle %}
15
+ </head>
16
+ <body>
17
+ {% minibundle js %}
18
+ source_dir: _assets/scripts
19
+ destination_path: assets/site
20
+ assets:
21
+ - dependency
22
+ - app
23
+ attributes:
24
+ id: my-scripts
25
+ {% endminibundle %}
26
+ </body>
27
+ <title>{{ page.title }}</title>
28
+ </html>
@@ -0,0 +1,4 @@
1
+ ---
2
+ layout: default
3
+ title: About
4
+ ---
@@ -0,0 +1,2 @@
1
+ /* static file, handled by Jekyll */
2
+ html { margin: 0; }
@@ -0,0 +1,55 @@
1
+ require 'support/test_case'
2
+
3
+ module Jekyll::Minibundle::Test
4
+ class StaticFilesAsAssetSourcesTest < TestCase
5
+ [:development, :production].each do |env|
6
+ define_method :"test_ministamp_allows_using_static_file_as_asset_source_in_#{env}_mode" do
7
+ with_site do
8
+ contents = 'h2 {}'
9
+ File.write source_path('assets/shared.css'), contents
10
+ find_and_gsub_in_file(source_path('_layouts/default.html'), 'ministamp _tmp/site.css', 'ministamp assets/shared.css')
11
+ generate_site env
12
+
13
+ asset_files = Dir[destination_path('assets') + '/screen*.css']
14
+
15
+ assert_equal 1, asset_files.size
16
+ assert_equal contents, File.read(destination_path('assets/shared.css'))
17
+ assert_equal contents, File.read(asset_files.first)
18
+ end
19
+ end
20
+ end
21
+
22
+ def test_minibundle_allows_using_static_file_as_asset_source_in_development_mode
23
+ with_site do
24
+ dep_contents = 'console.log("lol")'
25
+ app_contents = 'console.log("balal")'
26
+ File.write source_path('assets/dependency.js'), dep_contents
27
+ File.write source_path('assets/app.js'), app_contents
28
+ find_and_gsub_in_file(source_path('_layouts/default.html'), 'source_dir: _assets/scripts', 'source_dir: assets')
29
+ generate_site :development
30
+
31
+ assert_equal dep_contents, File.read(destination_path('assets/dependency.js'))
32
+ assert_equal app_contents, File.read(destination_path('assets/app.js'))
33
+ end
34
+ end
35
+
36
+ def test_minibundle_allows_using_static_file_as_asset_source_in_production_mode
37
+ with_site do
38
+ dep_contents = 'console.log("lol")'
39
+ app_contents = 'console.log("balal")'
40
+ bundled_contents = "#{dep_contents};\n#{app_contents};\n"
41
+ File.write source_path('assets/dependency.js'), dep_contents
42
+ File.write source_path('assets/app.js'), app_contents
43
+ find_and_gsub_in_file(source_path('_layouts/default.html'), 'source_dir: _assets/scripts', 'source_dir: assets')
44
+ generate_site :production
45
+
46
+ asset_files = Dir[destination_path('assets') + '/site-*.js']
47
+
48
+ assert_equal 1, asset_files.size
49
+ assert_equal dep_contents, File.read(destination_path('assets/dependency.js'))
50
+ assert_equal app_contents, File.read(destination_path('assets/app.js'))
51
+ assert_equal bundled_contents, File.read(asset_files.first)
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,50 @@
1
+ require 'support/test_case'
2
+ require 'support/fixture_config'
3
+ require 'jekyll/minibundle/asset_file_registry'
4
+
5
+ module Jekyll::Minibundle::Test
6
+ class AssetFileRegistryTest < TestCase
7
+ include FixtureConfig
8
+
9
+ def setup
10
+ AssetFileRegistry.clear
11
+ end
12
+
13
+ def test_returns_same_instance_for_same_stamp_file_config
14
+ first = AssetFileRegistry.stamp_file STAMP_SOURCE_PATH, STAMP_DESTINATION_PATH
15
+ second = AssetFileRegistry.stamp_file STAMP_SOURCE_PATH, STAMP_DESTINATION_PATH
16
+ assert_same first, second
17
+ assert_equal 1, asset_file_registry_size
18
+ end
19
+
20
+ def test_returns_same_instance_for_same_bundle_file_config
21
+ first = AssetFileRegistry.bundle_file bundle_config
22
+ second = AssetFileRegistry.bundle_file bundle_config
23
+ assert_same first, second
24
+ assert_equal 1, asset_file_registry_size
25
+ end
26
+
27
+ def test_bundle_files_allow_same_path_for_different_types
28
+ AssetFileRegistry.bundle_file bundle_config.merge('type' => :css)
29
+ AssetFileRegistry.bundle_file bundle_config.merge('type' => :js)
30
+ assert_equal 2, asset_file_registry_size
31
+ end
32
+
33
+ private
34
+
35
+ def bundle_config
36
+ {
37
+ 'type' => :css,
38
+ 'site_dir' => '.',
39
+ 'source_dir' => JS_BUNDLE_SOURCE_DIR,
40
+ 'assets' => %w{dependency app},
41
+ 'destination_path' => JS_BUNDLE_DESTINATION_PATH,
42
+ 'attributes' => {}
43
+ }
44
+ end
45
+
46
+ def asset_file_registry_size
47
+ AssetFileRegistry.class_variable_get(:@@_instances).size
48
+ end
49
+ end
50
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-minibundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tuomas Kareinen
@@ -68,10 +68,10 @@ dependencies:
68
68
  version: 10.1.1
69
69
  description: |
70
70
  A straightforward asset bundling plugin for Jekyll, utilizing external
71
- minification tool of your choice. Provides asset concatenation for
72
- bundling and asset fingerprinting with MD5 digest for cache busting. No
73
- other runtime dependencies besides the minification tool (not even
74
- other gems).
71
+ minification tool of your choice. It provides asset concatenation for
72
+ bundling and asset fingerprinting with MD5 digest for cache
73
+ busting. There are no other runtime dependencies besides the
74
+ minification tool (not even other gems).
75
75
  email: tkareine@gmail.com
76
76
  executables: []
77
77
  extensions: []
@@ -83,9 +83,11 @@ files:
83
83
  - RELEASING.txt
84
84
  - Rakefile
85
85
  - jekyll-minibundle.gemspec
86
+ - lib/jekyll/minibundle.rb
86
87
  - lib/jekyll/minibundle/asset_bundle.rb
87
88
  - lib/jekyll/minibundle/asset_file_operations.rb
88
89
  - lib/jekyll/minibundle/asset_file_paths.rb
90
+ - lib/jekyll/minibundle/asset_file_registry.rb
89
91
  - lib/jekyll/minibundle/asset_stamp.rb
90
92
  - lib/jekyll/minibundle/asset_tag_markup.rb
91
93
  - lib/jekyll/minibundle/bundle_file.rb
@@ -96,22 +98,27 @@ files:
96
98
  - lib/jekyll/minibundle/mini_stamp_tag.rb
97
99
  - lib/jekyll/minibundle/stamp_file.rb
98
100
  - lib/jekyll/minibundle/version.rb
99
- - lib/jekyll/minibundle.rb
100
101
  - test/fixture/site/_assets/scripts/app.js
101
102
  - test/fixture/site/_assets/scripts/dependency.js
102
103
  - test/fixture/site/_assets/styles/common.css
103
104
  - test/fixture/site/_assets/styles/reset.css
104
105
  - test/fixture/site/_bin/remove_comments
105
106
  - test/fixture/site/_bin/with_count
107
+ - test/fixture/site/_config.yml
108
+ - test/fixture/site/_layouts/default.html
106
109
  - test/fixture/site/_plugins/minibundle.rb
107
110
  - test/fixture/site/_tmp/site.css
111
+ - test/fixture/site/about.html
112
+ - test/fixture/site/assets/styles/reset.css
108
113
  - test/fixture/site/index.html
109
114
  - test/integration/minibundle_development_mode_test.rb
110
115
  - test/integration/minibundle_production_mode_test.rb
111
116
  - test/integration/ministamp_test.rb
117
+ - test/integration/static_files_as_asset_sources_test.rb
112
118
  - test/support/fixture_config.rb
113
119
  - test/support/test_case.rb
114
120
  - test/unit/asset_bundle_test.rb
121
+ - test/unit/asset_file_registry_test.rb
115
122
  - test/unit/asset_tag_markup_test.rb
116
123
  - test/unit/bundle_file_test.rb
117
124
  - test/unit/stamp_file_test.rb
@@ -151,15 +158,21 @@ test_files:
151
158
  - test/fixture/site/_assets/styles/reset.css
152
159
  - test/fixture/site/_bin/remove_comments
153
160
  - test/fixture/site/_bin/with_count
161
+ - test/fixture/site/_config.yml
162
+ - test/fixture/site/_layouts/default.html
154
163
  - test/fixture/site/_plugins/minibundle.rb
155
164
  - test/fixture/site/_tmp/site.css
165
+ - test/fixture/site/about.html
166
+ - test/fixture/site/assets/styles/reset.css
156
167
  - test/fixture/site/index.html
157
168
  - test/integration/minibundle_development_mode_test.rb
158
169
  - test/integration/minibundle_production_mode_test.rb
159
170
  - test/integration/ministamp_test.rb
171
+ - test/integration/static_files_as_asset_sources_test.rb
160
172
  - test/support/fixture_config.rb
161
173
  - test/support/test_case.rb
162
174
  - test/unit/asset_bundle_test.rb
175
+ - test/unit/asset_file_registry_test.rb
163
176
  - test/unit/asset_tag_markup_test.rb
164
177
  - test/unit/bundle_file_test.rb
165
178
  - test/unit/stamp_file_test.rb