middleman-sprockets 4.0.0 → 4.1.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: 86865e460e1617af5a3f81e9cc930942be536fa3
4
- data.tar.gz: 802e29f35cf071c20ae0b1f1b4a5c9f3757290f5
3
+ metadata.gz: 5b05f69c2af0e939cb74267c61976401d5e5b421
4
+ data.tar.gz: 0a97406cc10465aa6c19ddc6b624a9327699accb
5
5
  SHA512:
6
- metadata.gz: 336453668799d7142aedd42254284f2669be18621fce2155a5305458d60157b3d371f0997670dbc63478d1c39f2b9339d0215e737c6d3f7722ccc697acb9eab1
7
- data.tar.gz: dee36dffef49106f12396092625551fafa3894e5a345212b7c873b09d7c42d18372f6ec6fc46adf23b13684f3c9bb9885079c72845ca82eff50c699edbd64e84
6
+ metadata.gz: d59ffb935b66a302c5d4ee3df787dfb5d69189a13547f7a74bd0270eeec410713c7518b66a6dd605017291576380babab346ff946db61791e84f4984f02c3f3d
7
+ data.tar.gz: a92202dd7d0460ea58f8bf91d192e2900bde148916d3694cf2007c7ce34cce1ed648edcc2d29dccf35f35b877649ad90f2b3ab47afef4a506586e1d59092540e
@@ -38,6 +38,11 @@ Style/RegexpLiteral:
38
38
  Style/SignalException:
39
39
  Enabled: false
40
40
 
41
+ Style/PercentLiteralDelimiters:
42
+ Enabled: true
43
+ PreferredDelimiters:
44
+ '%': '{}'
45
+ '%w': '[]'
41
46
 
42
47
  # Metrics ----------------------------------
43
48
 
@@ -55,3 +60,6 @@ Metrics/MethodLength:
55
60
 
56
61
  Lint/EndAlignment:
57
62
  AlignWith: variable
63
+
64
+ Lint/AmbiguousRegexpLiteral:
65
+ Exclude: ["features/step_definitions/**/*"]
@@ -1,3 +1,13 @@
1
+ 4.1.0
2
+ =====
3
+
4
+ **fixes**
5
+ - respect http_prefix in asset_path helper [@vvasabi](https://github.com/middleman/middleman-sprockets/pull/124)
6
+
7
+ **features**
8
+ - allow passing proc/class to `imported_asset_path` option to determine imported asset location [@vvasabi](https://github.com/middleman/middleman-sprockets/pull/123)
9
+
10
+
1
11
  4.0.0
2
12
  =====
3
13
 
data/Gemfile CHANGED
@@ -33,9 +33,7 @@ gem 'sassc', require: false
33
33
 
34
34
  # catch the version of listen
35
35
  # working around bundler not switching the dependency graph itself
36
- if RUBY_VERSION < '2.2'
37
- gem 'listen', '~> 3.0.6'
38
- end
36
+ gem 'listen', '~> 3.0.6' if RUBY_VERSION < '2.2'
39
37
 
40
38
  # Code Quality
41
39
  group :test do
@@ -43,4 +41,5 @@ group :test do
43
41
  gem 'simplecov', '~> 0.9', require: false
44
42
  gem 'coveralls', '~> 0.8', require: false
45
43
  gem 'codeclimate-test-reporter', '~> 0.3', require: false
44
+ gem 'benchmark-ips'
46
45
  end
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
- > The master branch is for a pre-released 4.x version of Middleman-Sprockets.
2
- > - For upgrading help please [read the upgrading guide](docs/upgrade-3-to-4.md)
1
+ > The master branch is the 4.x version of Middleman-Sprockets.
2
+ > - If you're upgrading from 3.x, the [upgrading guide](docs/upgrade-3-to-4.md) should get you started.
3
3
  > - For 3.x stable usage please see the [`v3-stable-real` branch](https://github.com/middleman/middleman-sprockets/tree/v3-stable-real)
4
4
 
5
5
  # Middleman-Sprockets
@@ -45,10 +45,28 @@ To configure, in `config.rb`:
45
45
 
46
46
  ```ruby
47
47
  activate :sprockets do |c|
48
- c.imported_asset_path = YOUR_PATH
48
+ c.imported_asset_path = "YOUR_PATH"
49
49
  end
50
50
  ```
51
51
 
52
+ You can also pass an object (proc/lambda/class) that responds to `#call` to `imported_asset_path` to conditionally determine where assets go.
53
+
54
+ ```ruby
55
+ activate :sprockets do |c|
56
+ c.imported_asset_path = ->(sprockets_asset) do
57
+ if sprockets_asset.logical_path =~ /\.js$/
58
+ # all files ending with .js get put in /vendor-js
59
+ File.join('vendor-js', sprockets_asset.logical_path)
60
+ else
61
+ # other assets head to /imported
62
+ File.join('imported', sprockets_asset.logical_path)
63
+ end
64
+ end
65
+ end
66
+ ```
67
+
68
+ [View the imported_asset_processor test](features/test_cases/imported_asset_processor.feature) for an example using a class.
69
+
52
70
 
53
71
  **`expose_middleman_helpers` [default: false]**
54
72
 
@@ -1,8 +1,8 @@
1
1
  Given /^a built app$/ do
2
- step %Q{I run `middleman build --verbose`}
2
+ step %{I run `middleman build --verbose`}
3
3
  end
4
4
 
5
5
  Given /^a successfully built app$/ do
6
- step %Q{a built app}
7
- step %Q{was successfully built}
6
+ step %{a built app}
7
+ step %{was successfully built}
8
8
  end
@@ -2,15 +2,17 @@ Given /^wait a second$/ do
2
2
  sleep(1)
3
3
  end
4
4
 
5
+ # rubocop:disable Lint/Debugger
5
6
  Given /^binding.pry/ do
6
7
  binding.pry
7
8
  end
9
+ # rubocop:enable Lint/Debugger
8
10
 
9
11
  Given /^the file "([^\"]*)" content is changed to\:$/ do |name, content|
10
- step %Q{a file named "#{name}" with:}, content
12
+ step %{a file named "#{name}" with:}, content
11
13
  sleep 1
12
14
  system "touch #{File.join(ENV['MM_ROOT'], name)}"
13
- step %Q{the filesystem is polled}
15
+ step %{the filesystem is polled}
14
16
  end
15
17
 
16
18
  Then /^the filesystem is polled$/ do
@@ -23,10 +25,10 @@ end
23
25
 
24
26
  Then /^sprockets paths should include "([^\"]*)"$/ do |path|
25
27
  sprockets = @server_inst.extensions[:sprockets].environment
26
- expect( sprockets.paths ).to include File.join(ENV['MM_ROOT'], path)
28
+ expect(sprockets.paths).to include File.join(ENV['MM_ROOT'], path)
27
29
  end
28
30
 
29
31
  Then /^sprockets paths should include gem path "([^\"]*)"/ do |path|
30
32
  sprockets = @server_inst.extensions[:sprockets].environment
31
- expect( sprockets.paths ).to include File.join(PROJECT_ROOT_PATH, 'fixtures', 'gems', path)
33
+ expect(sprockets.paths).to include File.join(PROJECT_ROOT_PATH, 'fixtures', 'gems', path)
32
34
  end
@@ -9,9 +9,9 @@ require 'bundler'
9
9
  Bundler.require :default, :test, :development
10
10
 
11
11
  ENV['TEST'] = 'true'
12
- ENV["AUTOLOAD_SPROCKETS"] = "true"
12
+ ENV['AUTOLOAD_SPROCKETS'] = 'true'
13
13
 
14
- require "middleman-core"
15
- require "middleman-core/step_definitions"
14
+ require 'middleman-core'
15
+ require 'middleman-core/step_definitions'
16
16
  require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-sprockets')
17
- require "erubis"
17
+ require 'erubis'
@@ -98,8 +98,8 @@ Feature: Assets get a file hash appended to their URL and references to them are
98
98
  function sprockets_sub_function() { }
99
99
  """
100
100
  When I go to "/partials/"
101
- Then I should see 'src="../javascripts/sprockets_base-b80703b7.js'
102
- When I go to "/javascripts/sprockets_base-b80703b7.js"
101
+ Then I should see 'src="../javascripts/sprockets_base-0252a861.js'
102
+ When I go to "/javascripts/sprockets_base-0252a861.js"
103
103
  Then I should see "sprockets_sub_function"
104
104
  And wait a second
105
105
  And the file "source/javascripts/sprockets_sub.js" has the contents
@@ -107,6 +107,6 @@ Feature: Assets get a file hash appended to their URL and references to them are
107
107
  function sprockets_sub2_function() { }
108
108
  """
109
109
  When I go to "/partials/"
110
- Then I should see 'src="../javascripts/sprockets_base-f624ef94.js'
111
- When I go to "/javascripts/sprockets_base-f624ef94.js"
110
+ Then I should see 'src="../javascripts/sprockets_base-5121d891.js'
111
+ When I go to "/javascripts/sprockets_base-5121d891.js"
112
112
  Then I should see "sprockets_sub2_function"
@@ -0,0 +1,56 @@
1
+ Feature: Allow http_prefix to be prepended correctly to image-url when referencing a linked asset
2
+ Background:
3
+ Given a fixture app "base-app"
4
+ And a file named "source/stylesheets/style.css.scss" with:
5
+ """
6
+ .foo {
7
+ background: image-url("logo.png");
8
+ }
9
+ """
10
+
11
+ Scenario: Assets built have the correct http_prefix prepended
12
+ Given a file named "config.rb" with:
13
+ """
14
+ activate :sprockets
15
+ config[:http_prefix] = '/foo/bar'
16
+ """
17
+ And a successfully built app
18
+
19
+ When I cd to "build"
20
+ Then the following files should exist:
21
+ | stylesheets/style.css |
22
+ | assets/logo.png |
23
+ And the file "stylesheets/style.css" should contain:
24
+ """
25
+ .foo {
26
+ background: url(/foo/bar/assets/logo.png); }
27
+ """
28
+
29
+ Scenario: When http_prefix is not set, just prepend /
30
+ Given a file named "config.rb" with:
31
+ """
32
+ activate :sprockets
33
+ """
34
+ And a successfully built app
35
+
36
+ When I cd to "build"
37
+ Then the file "stylesheets/style.css" should contain:
38
+ """
39
+ .foo {
40
+ background: url(/assets/logo.png); }
41
+ """
42
+
43
+ Scenario: relative_assets should still work
44
+ Given a file named "config.rb" with:
45
+ """
46
+ activate :sprockets
47
+ activate :relative_assets
48
+ """
49
+ And a successfully built app
50
+
51
+ When I cd to "build"
52
+ Then the file "stylesheets/style.css" should contain:
53
+ """
54
+ .foo {
55
+ background: url(../assets/logo.png); }
56
+ """
@@ -0,0 +1,89 @@
1
+ Feature: Imported assets can be placed in paths determined by a processor
2
+
3
+ Background:
4
+ Given a fixture app "base-app"
5
+ And a file named "config.rb" with:
6
+ """
7
+ config[:images_dir] = "images"
8
+ config[:fonts_dir] = "fonts"
9
+
10
+ class ImportedAssetPathProcessor
11
+ attr_reader :app
12
+
13
+ def initialize(app)
14
+ @app = app
15
+ end
16
+
17
+ def call(sprockets_asset)
18
+ directory = case sprockets_asset.logical_path
19
+ when /^images\// then app.config[:images_dir]
20
+ when /^fonts\// then app.config[:fonts_dir]
21
+ else
22
+ "imported"
23
+ end
24
+ relative_path = sprockets_asset.logical_path.sub(/^#{directory}/, '')
25
+ File.join(directory, relative_path)
26
+ end
27
+ end
28
+
29
+ activate :sprockets do |config|
30
+ config.imported_asset_path = ImportedAssetPathProcessor.new(app)
31
+ end
32
+ sprockets.append_path File.join(root, 'vendor')
33
+ """
34
+ And a file named "vendor/fonts/webfont-vendor.eot" with:
35
+ """
36
+ """
37
+ And a file named "vendor/images/vendor-image.jpg" with:
38
+ """
39
+ """
40
+ And a file named "vendor/foo/bar.jpg" with:
41
+ """
42
+ """
43
+ And a file named "source/fonts/webfont-source.eot" with:
44
+ """
45
+ """
46
+ And a file named "source/images/source-image.jpg" with:
47
+ """
48
+ """
49
+
50
+
51
+ Scenario: Assets built by being linked (fully resolved) are built in the custom path
52
+ Given a file named "source/stylesheets/manifest.css" with:
53
+ """
54
+ //= link 'webfont-vendor.eot'
55
+ //= link 'vendor-image.jpg'
56
+ //= link 'foo/bar.jpg'
57
+ """
58
+ And the Server is running
59
+
60
+ When I go to "/fonts/webfont-vendor.eot"
61
+ Then the status code should be "200"
62
+ When I go to "/fonts/webfont-source.eot"
63
+ Then the status code should be "200"
64
+ When I go to "/images/vendor-image.jpg"
65
+ Then the status code should be "200"
66
+ When I go to "/images/source-image.jpg"
67
+ Then the status code should be "200"
68
+ When I go to "/imported/foo/bar.jpg"
69
+ Then the status code should be "200"
70
+
71
+ Scenario: Assets built by being linked (minimally resolved) are built in the custom path
72
+ Given a file named "source/stylesheets/manifest.css" with:
73
+ """
74
+ //= link 'fonts/webfont-vendor.eot'
75
+ //= link 'images/vendor-image.jpg'
76
+ //= link 'foo/bar.jpg'
77
+ """
78
+ And the Server is running
79
+
80
+ When I go to "/fonts/webfont-vendor.eot"
81
+ Then the status code should be "200"
82
+ When I go to "/fonts/webfont-source.eot"
83
+ Then the status code should be "200"
84
+ When I go to "/images/vendor-image.jpg"
85
+ Then the status code should be "200"
86
+ When I go to "/images/source-image.jpg"
87
+ Then the status code should be "200"
88
+ When I go to "/imported/foo/bar.jpg"
89
+ Then the status code should be "200"
@@ -5,5 +5,3 @@ activate :asset_hash
5
5
  activate :relative_assets
6
6
 
7
7
  activate :directory_indexes
8
-
9
- #page '/foo.html', :directory_index => false
@@ -1,16 +1,14 @@
1
1
  Gem::Specification.new do |gem|
2
-
3
2
  gem.name = 'assets_gem'
4
3
  gem.version = '0.0.0'
5
4
  gem.platform = Gem::Platform::RUBY
6
5
 
7
6
  gem.summary = 'dummy gem for a fixture'
8
- gem.description = %q{ dummy gem for a fixture }
9
- gem.authors = ["Steven Sloan"]
10
- gem.email = ["stevenosloan@gmail.com"]
7
+ gem.description = 'dummy gem for a fixture'
8
+ gem.authors = ['Steven Sloan']
9
+ gem.email = ['stevenosloan@gmail.com']
11
10
  gem.license = 'MIT'
12
11
 
13
- gem.files = Dir["lib/**/*.rb", "vendor/**/*"]
14
- gem.require_path = "lib"
15
-
12
+ gem.files = Dir['lib/**/*.rb', 'vendor/**/*']
13
+ gem.require_path = 'lib'
16
14
  end
@@ -16,9 +16,9 @@ module Middleman
16
16
  expose_to_config sprockets: :environment
17
17
  expose_to_template sprockets: :environment
18
18
 
19
- option :supported_output_extensions, ['.css', '.js'], 'Output extensions sprockets should process'
20
- option :imported_asset_path, 'assets', 'Where under source imported assets should be placed.'
21
- option :expose_middleman_helpers, false, 'Whether to expose middleman helpers to sprockets.'
19
+ option :supported_output_extensions, ['.css', '.js'], 'Output extensions sprockets should process'
20
+ option :imported_asset_path, 'assets', 'Where under source imported assets should be placed.'
21
+ option :expose_middleman_helpers, false, 'Whether to expose middleman helpers to sprockets.'
22
22
 
23
23
  Contract ::Middleman::Application, Hash, Maybe[Proc] => Any
24
24
  def initialize app, options_hash={}, &block
@@ -46,43 +46,8 @@ module Middleman
46
46
  @environment.context_class.send(:define_method, :data) { the_app.data }
47
47
  @environment.context_class.send(:define_method, :env) { the_env }
48
48
 
49
- @environment.context_class.class_eval do
50
- def current_resource
51
- app.extensions[:sprockets].resources.find_by_path(filename)
52
- end
53
-
54
- def current_path
55
- current_resource.destination_path if current_resource
56
- end
57
-
58
- def asset_path path, options={}
59
- # Handle people calling with the Middleman/Padrino asset path signature
60
- if path.is_a?(::Symbol) && !options.is_a?(::Hash)
61
- kind = path
62
- path = options
63
- else
64
- kind = {
65
- image: :images,
66
- font: :fonts,
67
- javascript: :js,
68
- stylesheet: :css
69
- }.fetch(options[:type], options[:type])
70
- end
71
-
72
- if File.extname(path).empty?
73
- path << { js: '.js', css: '.css' }.fetch(kind, '')
74
- end
75
-
76
- if app.extensions[:sprockets].check_asset(path)
77
- link_asset(path)
78
- app.extensions[:sprockets].sprockets_asset_path(env[path]).sub(/^\/?/, '/')
79
- else
80
- app.asset_path(kind, path)
81
- end
82
- end
83
- end
84
-
85
- expose_app_helpers_to_sprockets! if options[:expose_middleman_helpers]
49
+ @environment.context_class.send(:include, ContextMethods)
50
+ @environment.context_class.send(:prepend, ExposeMiddlemanHelpers) if options[:expose_middleman_helpers]
86
51
  end
87
52
 
88
53
  Contract ResourceList => ResourceList
@@ -119,7 +84,11 @@ module Middleman
119
84
 
120
85
  Contract ::Sprockets::Asset => String
121
86
  def sprockets_asset_path sprockets_asset
122
- File.join(options[:imported_asset_path], sprockets_asset.logical_path)
87
+ if options[:imported_asset_path].is_a?(String)
88
+ File.join(options[:imported_asset_path], sprockets_asset.logical_path)
89
+ else
90
+ options[:imported_asset_path].call(sprockets_asset)
91
+ end
123
92
  end
124
93
 
125
94
  private
@@ -128,8 +97,8 @@ module Middleman
128
97
  @_linked_resources ||= (@resources.resources
129
98
  .map(&:sprockets_asset)
130
99
  .map(&:links)
131
- .reduce(&:merge) || Set.new())
132
- .map do |path|
100
+ .reduce(&:merge) || Set.new
101
+ ).map do |path|
133
102
  asset = environment[path]
134
103
  generate_resource(sprockets_asset_path(asset),
135
104
  asset.filename,
@@ -142,26 +111,6 @@ module Middleman
142
111
  linked_resources
143
112
  end
144
113
 
145
- def expose_app_helpers_to_sprockets!
146
- @environment.context_class.class_eval do
147
- def mm_context
148
- @_mm_context ||= app.template_context_class.new(app, current_path: current_path)
149
- end
150
-
151
- def method_missing method, *args, &block
152
- if mm_context.respond_to?(method)
153
- return mm_context.send method, *args, &block
154
- end
155
-
156
- super
157
- end
158
-
159
- def respond_to? method, include_private=false
160
- super || mm_context.respond_to?(method, include_private)
161
- end
162
- end
163
- end
164
-
165
114
  Contract ::Middleman::Sitemap::Resource => Or[::Middleman::Sitemap::Resource, Resource]
166
115
  def process_sprockets_resource resource
167
116
  ::Middleman::Util.instrument 'sprockets', name: 'process_resource', resource: resource do
@@ -215,8 +164,8 @@ module Middleman
215
164
  # Add any directories from gems with Rails-like paths to sprockets load path
216
165
  def append_paths_from_gems
217
166
  root_paths = rubygems_latest_specs.map(&:full_gem_path) << app.root
218
- base_paths = %w(assets app app/assets vendor vendor/assets lib lib/assets)
219
- asset_dirs = %w(javascripts js stylesheets css images img fonts)
167
+ base_paths = %w[assets app app/assets vendor vendor/assets lib lib/assets]
168
+ asset_dirs = %w[javascripts js stylesheets css images img fonts]
220
169
 
221
170
  root_paths.product(base_paths.product(asset_dirs)).each do |root, (base, asset)|
222
171
  path = File.join(root, base, asset)
@@ -226,3 +175,6 @@ module Middleman
226
175
  end
227
176
  end
228
177
  end
178
+
179
+ require_relative 'extension/context_methods'
180
+ require_relative 'extension/expose_middleman_helpers'
@@ -0,0 +1,44 @@
1
+ module Middleman
2
+ module Sprockets
3
+ class Extension
4
+ module ContextMethods
5
+ def current_resource
6
+ app.extensions[:sprockets].resources.find_by_path(filename)
7
+ end
8
+
9
+ def current_path
10
+ current_resource.destination_path if current_resource
11
+ end
12
+
13
+ def asset_path path, options={}
14
+ # Handle people calling with the Middleman/Padrino asset path signature
15
+ if path.is_a?(::Symbol) && !options.is_a?(::Hash)
16
+ kind = path
17
+ path = options
18
+ else
19
+ kind = {
20
+ image: :images,
21
+ font: :fonts,
22
+ javascript: :js,
23
+ stylesheet: :css
24
+ }.fetch(options[:type], options[:type])
25
+ end
26
+
27
+ if File.extname(path).empty?
28
+ path << { js: '.js', css: '.css' }.fetch(kind, '')
29
+ end
30
+
31
+ if app.extensions[:sprockets].check_asset(path)
32
+ link_asset(path)
33
+
34
+ File.join *[app.config[:http_prefix],
35
+ app.extensions[:sprockets].sprockets_asset_path(env[path])].compact
36
+ else
37
+ app.asset_path(kind, path)
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,23 @@
1
+ module Middleman
2
+ module Sprockets
3
+ class Extension
4
+ module ExposeMiddlemanHelpers
5
+ def mm_context
6
+ @_mm_context ||= app.template_context_class.new(app, current_path: current_path)
7
+ end
8
+
9
+ def method_missing method, *args, &block
10
+ if mm_context.respond_to?(method)
11
+ return mm_context.send method, *args, &block
12
+ end
13
+
14
+ super
15
+ end
16
+
17
+ def respond_to? method, include_private=false
18
+ super || mm_context.respond_to?(method, include_private)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -36,7 +36,7 @@ module Middleman
36
36
  Contract String => Bool
37
37
  def processible? filename
38
38
  file_ext, _mime = ::Sprockets::PathUtils.match_path_extname(filename, environment.config[:mime_exts])
39
- *template_exts, target_ext = Middleman::Util.collect_extensions(filename)
39
+ *_template_exts, target_ext = Middleman::Util.collect_extensions(filename)
40
40
  options[:supported_output_extensions].include?(target_ext) && extensions.include?(file_ext)
41
41
  end
42
42
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Sprockets
3
- VERSION = '4.0.0'.freeze
3
+ VERSION = '4.1.0'.freeze
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
3
  require 'middleman-sprockets/version'
4
4
 
5
5
  Gem::Specification.new do |s|
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
9
9
  s.authors = ['Thomas Reynolds', 'Ben Hollis', 'Karl Freeman']
10
10
  s.email = ['me@tdreyno.com', 'ben@benhollis.net', 'karlfreeman@gmail.com']
11
11
  s.homepage = 'https://github.com/middleman/middleman-sprockets'
12
- s.summary = %q{Sprockets support for Middleman}
13
- s.description = %q{Sprockets support for Middleman}
12
+ s.summary = 'Sprockets support for Middleman'
13
+ s.description = 'Sprockets support for Middleman'
14
14
  s.license = 'MIT'
15
15
  s.files = `git ls-files -z`.split("\0")
16
16
  s.test_files = `git ls-files -z -- {fixtures,features}/*`.split("\0")
@@ -1,6 +1,5 @@
1
1
  namespace :matrix do
2
-
3
- def with_gemfile gemfile, &block
2
+ def with_gemfile gemfile
4
3
  Bundler.with_clean_env do
5
4
  gemfile = File.expand_path(gemfile)
6
5
  ENV['BUNDLE_GEMFILE'] = gemfile
@@ -9,8 +8,8 @@ namespace :matrix do
9
8
  system "rm #{gemfile}.lock"
10
9
  end
11
10
 
12
- unless File.exist?( "#{gemfile}.lock")
13
- args = ["--quiet"]
11
+ unless File.exist?("#{gemfile}.lock")
12
+ args = ['--quiet']
14
13
  puts "bundling #{gemfile}"
15
14
  `bundle install --gemfile='#{gemfile}' #{args.join(' ')}`
16
15
  end
@@ -20,27 +19,25 @@ namespace :matrix do
20
19
  end
21
20
 
22
21
  def tracer msg
23
- puts ""
24
- puts (0..(msg.length+10)).map { |i| "=" }.join
22
+ tracer_length = msg.length + 10
23
+ puts ''
24
+ puts tracer_length.times.to_a.map { '=' }.join
25
25
  puts " #{msg}"
26
- puts (0..(msg.length+10)).map { |i| "=" }.join
26
+ puts tracer_length.times.to_a.map { '=' }.join
27
27
  end
28
28
 
29
- MATRIX = %w[ middleman-4.0 middleman-4.1 middleman-head sprockets-4.0 ]
29
+ MATRIX = %w[middleman-4.0 middleman-4.1 middleman-head sprockets-4.0].freeze
30
30
 
31
31
  MATRIX.each do |gemfile_name|
32
-
33
32
  desc "run tests with #{gemfile_name} gemfile"
34
33
  task :"#{gemfile_name}" do
35
34
  tracer "running tests with #{gemfile_name} gemfile"
36
35
  with_gemfile "gemfiles/#{gemfile_name}.gemfile" do
37
- "rake test"
36
+ 'rake test'
38
37
  end
39
38
  end
40
-
41
39
  end
42
40
 
43
- desc "run test on full matrix"
44
- task :all => MATRIX.map { |gn| "matrix:#{gn}" }
45
-
41
+ desc 'run test on full matrix'
42
+ task all: MATRIX.map { |gn| "matrix:#{gn}" }
46
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-sprockets
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-06-17 00:00:00.000000000 Z
13
+ date: 2016-10-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: middleman-core
@@ -90,8 +90,10 @@ files:
90
90
  - features/test_cases/excluded_file_extensions.feature
91
91
  - features/test_cases/file_not_found.feature
92
92
  - features/test_cases/handles_string_resource.feature
93
+ - features/test_cases/http_prefix_linked_assets.feature
93
94
  - features/test_cases/ignore_directive_is_respected.feature
94
95
  - features/test_cases/imported_asset_extensions.feature
96
+ - features/test_cases/imported_asset_processor.feature
95
97
  - features/test_cases/jst.feature
96
98
  - features/test_cases/linked_asset_addition_and_removal.feature
97
99
  - features/test_cases/long_filenames.feature
@@ -144,6 +146,8 @@ files:
144
146
  - gemfiles/sprockets-4.0.gemfile
145
147
  - lib/middleman-sprockets.rb
146
148
  - lib/middleman-sprockets/extension.rb
149
+ - lib/middleman-sprockets/extension/context_methods.rb
150
+ - lib/middleman-sprockets/extension/expose_middleman_helpers.rb
147
151
  - lib/middleman-sprockets/interface.rb
148
152
  - lib/middleman-sprockets/resource.rb
149
153
  - lib/middleman-sprockets/resource_store.rb
@@ -173,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
177
  version: '0'
174
178
  requirements: []
175
179
  rubyforge_project:
176
- rubygems_version: 2.4.8
180
+ rubygems_version: 2.5.1
177
181
  signing_key:
178
182
  specification_version: 4
179
183
  summary: Sprockets support for Middleman
@@ -191,8 +195,10 @@ test_files:
191
195
  - features/test_cases/excluded_file_extensions.feature
192
196
  - features/test_cases/file_not_found.feature
193
197
  - features/test_cases/handles_string_resource.feature
198
+ - features/test_cases/http_prefix_linked_assets.feature
194
199
  - features/test_cases/ignore_directive_is_respected.feature
195
200
  - features/test_cases/imported_asset_extensions.feature
201
+ - features/test_cases/imported_asset_processor.feature
196
202
  - features/test_cases/jst.feature
197
203
  - features/test_cases/linked_asset_addition_and_removal.feature
198
204
  - features/test_cases/long_filenames.feature
@@ -239,4 +245,3 @@ test_files:
239
245
  - fixtures/gems/assets_gem/vendor/assets/fonts/font.ttf
240
246
  - fixtures/gems/assets_gem/vendor/assets/images/logo.png
241
247
  - fixtures/gems/assets_gem/vendor/assets/javascripts/_imports/import.js
242
- has_rdoc: