middleman-core 4.1.6 → 4.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/asset_hash.feature +12 -10
- data/features/front-matter-neighbor.feature +6 -2
- data/fixtures/asset-host-app/source/images/blank0.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank10.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank100.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank101.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1010.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank102.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1020.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1021.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1022.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1023.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1024.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank103.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1030.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1031.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1032.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1033.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1034.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank104.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1043.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1054.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank2.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank20.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank21.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank22.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank23.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank24.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank3.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank30.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank31.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank32.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank33.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank34.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank4.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank43.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank54.gif +0 -0
- data/lib/middleman-core/application.rb +2 -1
- data/lib/middleman-core/core_extensions/collections.rb +28 -17
- data/lib/middleman-core/core_extensions/collections/step_context.rb +6 -2
- data/lib/middleman-core/core_extensions/data.rb +2 -0
- data/lib/middleman-core/core_extensions/i18n.rb +2 -0
- data/lib/middleman-core/core_extensions/inline_url_rewriter.rb +1 -1
- data/lib/middleman-core/extension.rb +36 -4
- data/lib/middleman-core/extensions/external_pipeline.rb +43 -10
- data/lib/middleman-core/preview_server.rb +2 -0
- data/lib/middleman-core/util/rack.rb +14 -4
- data/lib/middleman-core/version.rb +1 -1
- data/middleman-core.gemspec +3 -2
- metadata +92 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 030311fff277fca785018355eae0d3e841af713f
|
4
|
+
data.tar.gz: 7bb366e4fd42e9ca58e05fb7c28c16dfb04fdf10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36442dc7b91a3e5f0f2cc0d55ee56c9a799b9e37598f42fa9c4a3531905baf55d7bd0771d68969f21dc345dfdf832df8dc0ae0584eecdec1921bad8e73f7ee8a
|
7
|
+
data.tar.gz: d0cfb1e50a0e23f4c73aaa3bd8995209d5b42dc78af1674429a21c99a98508bdca64d16245f4030dd475cfca9532f41e0bc19cdcffdf130b02d456e8a27da7e0
|
data/features/asset_hash.feature
CHANGED
@@ -111,28 +111,29 @@ Feature: Assets get file hashes appended to them and references to them are upda
|
|
111
111
|
Given a fixture app "asset-hash-host-app"
|
112
112
|
And a file named "config.rb" with:
|
113
113
|
"""
|
114
|
+
set :sass_source_maps, false
|
114
115
|
activate :asset_hash
|
115
116
|
activate :directory_indexes
|
116
117
|
activate :asset_host, host: 'http://middlemanapp.com'
|
117
118
|
"""
|
118
119
|
Given the Server is running at "asset-hash-host-app"
|
119
120
|
When I go to "/"
|
120
|
-
Then I should see 'href="http://middlemanapp.com/stylesheets/site-
|
121
|
-
Then I should see 'href="http://middlemanapp.com/stylesheets/fragment-
|
121
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/site-7474cadd.css"'
|
122
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/fragment-2902933e.css"'
|
122
123
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
|
123
124
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?test"'
|
124
125
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?#test"'
|
125
126
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg#test"'
|
126
127
|
When I go to "/subdir/"
|
127
|
-
Then I should see 'href="http://middlemanapp.com/stylesheets/site-
|
128
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/site-7474cadd.css"'
|
128
129
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
|
129
130
|
When I go to "/other/"
|
130
|
-
Then I should see 'href="http://middlemanapp.com/stylesheets/site-
|
131
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/site-7474cadd.css"'
|
131
132
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
|
132
133
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?test"'
|
133
134
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?#test"'
|
134
135
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg#test"'
|
135
|
-
When I go to "/stylesheets/fragment-
|
136
|
+
When I go to "/stylesheets/fragment-2902933e.css"
|
136
137
|
And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg");'
|
137
138
|
And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg?test");'
|
138
139
|
And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg?#test");'
|
@@ -142,28 +143,29 @@ Feature: Assets get file hashes appended to them and references to them are upda
|
|
142
143
|
Given a fixture app "asset-hash-host-app"
|
143
144
|
And a file named "config.rb" with:
|
144
145
|
"""
|
146
|
+
set :sass_source_maps, false
|
145
147
|
activate :asset_host, host: 'http://middlemanapp.com'
|
146
148
|
activate :directory_indexes
|
147
149
|
activate :asset_hash
|
148
150
|
"""
|
149
151
|
Given the Server is running at "asset-hash-host-app"
|
150
152
|
When I go to "/"
|
151
|
-
Then I should see 'href="http://middlemanapp.com/stylesheets/site-
|
152
|
-
Then I should see 'href="http://middlemanapp.com/stylesheets/fragment-
|
153
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/site-7474cadd.css"'
|
154
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/fragment-2902933e.css"'
|
153
155
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
|
154
156
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?test"'
|
155
157
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?#test"'
|
156
158
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg#test"'
|
157
159
|
When I go to "/subdir/"
|
158
|
-
Then I should see 'href="http://middlemanapp.com/stylesheets/site-
|
160
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/site-7474cadd.css"'
|
159
161
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
|
160
162
|
When I go to "/other/"
|
161
|
-
Then I should see 'href="http://middlemanapp.com/stylesheets/site-
|
163
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/site-7474cadd.css"'
|
162
164
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
|
163
165
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?test"'
|
164
166
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?#test"'
|
165
167
|
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg#test"'
|
166
|
-
When I go to "/stylesheets/fragment-
|
168
|
+
When I go to "/stylesheets/fragment-2902933e.css"
|
167
169
|
And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg")'
|
168
170
|
And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg?test")'
|
169
171
|
And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg?#test")'
|
@@ -22,7 +22,7 @@ Feature: Neighboring YAML Front Matter
|
|
22
22
|
Then I should not see "---"
|
23
23
|
When I go to "/raw-front-matter.php.frontmatter"
|
24
24
|
Then I should see "File Not Found"
|
25
|
-
|
25
|
+
|
26
26
|
Scenario: YAML not on first line, with encoding
|
27
27
|
Given the Server is running at "frontmatter-neighbor-app"
|
28
28
|
When I go to "/front-matter-encoding.html"
|
@@ -35,7 +35,7 @@ Feature: Neighboring YAML Front Matter
|
|
35
35
|
Given the Server is running at "frontmatter-neighbor-app"
|
36
36
|
And the file "source/front-matter-change.html.erb" has the contents
|
37
37
|
"""
|
38
|
-
<%= current_page.data.title %>
|
38
|
+
FileA <%= current_page.data.title %>
|
39
39
|
"""
|
40
40
|
And the file "source/front-matter-change.html.erb.frontmatter" has the contents
|
41
41
|
"""
|
@@ -43,6 +43,8 @@ Feature: Neighboring YAML Front Matter
|
|
43
43
|
title: Hello World
|
44
44
|
layout: false
|
45
45
|
---
|
46
|
+
|
47
|
+
FileB
|
46
48
|
"""
|
47
49
|
When I go to "/front-matter-change.html"
|
48
50
|
Then I should see "Hello World"
|
@@ -52,6 +54,8 @@ Feature: Neighboring YAML Front Matter
|
|
52
54
|
title: Hola Mundo
|
53
55
|
layout: false
|
54
56
|
---
|
57
|
+
|
58
|
+
FileC
|
55
59
|
"""
|
56
60
|
When I go to "/front-matter-change.html"
|
57
61
|
Then I should see "Hola Mundo"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'monitor'
|
1
2
|
require 'middleman-core/core_extensions/collections/pagination'
|
2
3
|
require 'middleman-core/core_extensions/collections/step_context'
|
3
4
|
require 'middleman-core/core_extensions/collections/lazy_root'
|
@@ -41,6 +42,8 @@ module Middleman
|
|
41
42
|
@values_by_name = {}
|
42
43
|
|
43
44
|
@collector_roots = []
|
45
|
+
|
46
|
+
@lock = Monitor.new
|
44
47
|
end
|
45
48
|
|
46
49
|
def before_configuration
|
@@ -81,27 +84,35 @@ module Middleman
|
|
81
84
|
|
82
85
|
Contract ResourceList => ResourceList
|
83
86
|
def manipulate_resource_list(resources)
|
84
|
-
@
|
85
|
-
|
86
|
-
|
87
|
-
|
87
|
+
@lock.synchronize do
|
88
|
+
@collector_roots.each do |pair|
|
89
|
+
dataset = pair[:block].call(app, resources)
|
90
|
+
pair[:root].realize!(dataset)
|
91
|
+
end
|
88
92
|
|
89
|
-
|
90
|
-
|
93
|
+
ctx = StepContext.new
|
94
|
+
StepContext.current = ctx
|
91
95
|
|
92
|
-
|
93
|
-
@values_by_name[k] = v.value(ctx)
|
94
|
-
leaves.delete v
|
95
|
-
end
|
96
|
+
leaves = @leaves.dup
|
96
97
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
98
|
+
@collectors_by_name.each do |k, v|
|
99
|
+
@values_by_name[k] = v.value(ctx)
|
100
|
+
leaves.delete v
|
101
|
+
end
|
102
|
+
|
103
|
+
# Execute code paths
|
104
|
+
leaves.each do |v|
|
105
|
+
v.value(ctx)
|
106
|
+
end
|
107
|
+
|
108
|
+
# Inject descriptors
|
109
|
+
results = ctx.descriptors.reduce(resources) do |sum, d|
|
110
|
+
d.execute_descriptor(app, sum)
|
111
|
+
end
|
112
|
+
|
113
|
+
StepContext.current = nil
|
101
114
|
|
102
|
-
|
103
|
-
ctx.descriptors.reduce(resources) do |sum, d|
|
104
|
-
d.execute_descriptor(app, sum)
|
115
|
+
results
|
105
116
|
end
|
106
117
|
end
|
107
118
|
end
|
@@ -2,8 +2,12 @@ module Middleman
|
|
2
2
|
module CoreExtensions
|
3
3
|
module Collections
|
4
4
|
class StepContext
|
5
|
-
|
6
|
-
|
5
|
+
class << self
|
6
|
+
attr_accessor :current
|
7
|
+
|
8
|
+
def add_to_context(name, &func)
|
9
|
+
send(:define_method, :"_internal_#{name}", &func)
|
10
|
+
end
|
7
11
|
end
|
8
12
|
|
9
13
|
attr_reader :descriptors
|
@@ -88,6 +88,8 @@ module Middleman
|
|
88
88
|
def update_files(updated_files, removed_files)
|
89
89
|
updated_files.each(&method(:touch_file))
|
90
90
|
removed_files.each(&method(:remove_file))
|
91
|
+
|
92
|
+
@app.sitemap.rebuild_resource_list!(:touched_data_file)
|
91
93
|
end
|
92
94
|
|
93
95
|
# Update the internal cache for a given file path
|
@@ -213,6 +213,8 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
|
|
213
213
|
def on_file_changed(_updated_files, _removed_files)
|
214
214
|
::I18n.load_path |= app.files.by_type(:locales).files.map { |p| p[:full_path].to_s }
|
215
215
|
::I18n.reload!
|
216
|
+
|
217
|
+
@app.sitemap.rebuild_resource_list!(:touched_locale_file)
|
216
218
|
end
|
217
219
|
|
218
220
|
def configure_i18n
|
@@ -82,7 +82,7 @@ module Middleman
|
|
82
82
|
dirpath = ::Pathname.new(File.dirname(path))
|
83
83
|
|
84
84
|
rewritten = ::Middleman::Util.instrument 'inline_url_rewriter', path: path do
|
85
|
-
::Middleman::Util.rewrite_paths(body, path, all_asset_exts) do |asset_path|
|
85
|
+
::Middleman::Util.rewrite_paths(body, path, all_asset_exts, @middleman_app) do |asset_path|
|
86
86
|
uri = ::Addressable::URI.parse(asset_path)
|
87
87
|
|
88
88
|
relative_path = uri.host.nil?
|
@@ -490,15 +490,14 @@ module Middleman
|
|
490
490
|
class ConfigExtension < Extension
|
491
491
|
def initialize(app, config={}, &block)
|
492
492
|
@descriptors = {}
|
493
|
-
@
|
493
|
+
@ready = false
|
494
494
|
|
495
495
|
self.class.exposed_to_config.each do |k, v|
|
496
496
|
@descriptors[k] = []
|
497
497
|
|
498
498
|
define_singleton_method(:"__original_#{v}", &method(v))
|
499
499
|
define_singleton_method(v) do |*args, &b|
|
500
|
-
|
501
|
-
@app.sitemap.rebuild_resource_list!(:"first_run_change_#{v}")
|
500
|
+
proxy_method_call(k, v, args, &b)
|
502
501
|
end
|
503
502
|
end
|
504
503
|
|
@@ -506,11 +505,24 @@ module Middleman
|
|
506
505
|
end
|
507
506
|
|
508
507
|
def after_configuration
|
508
|
+
context = self
|
509
|
+
|
509
510
|
self.class.exposed_to_config.each do |k, v|
|
510
|
-
::Middleman::CoreExtensions::Collections::StepContext.add_to_context(k, &
|
511
|
+
::Middleman::CoreExtensions::Collections::StepContext.add_to_context(k) do |*args, &b|
|
512
|
+
r = context.method(:"__original_#{v}").call(*args, &b)
|
513
|
+
self.descriptors << r if r.respond_to?(:execute_descriptor)
|
514
|
+
end
|
511
515
|
end
|
512
516
|
end
|
513
517
|
|
518
|
+
def ready
|
519
|
+
@ready = true
|
520
|
+
|
521
|
+
# @descriptors.each do |k, v|
|
522
|
+
# @descriptors[k] = []
|
523
|
+
# end
|
524
|
+
end
|
525
|
+
|
514
526
|
# Update the main sitemap resource list
|
515
527
|
# @return Array<Middleman::Sitemap::Resource>
|
516
528
|
Contract ResourceList => ResourceList
|
@@ -519,5 +531,25 @@ module Middleman
|
|
519
531
|
c.execute_descriptor(app, sum)
|
520
532
|
end
|
521
533
|
end
|
534
|
+
|
535
|
+
Contract Symbol, Symbol, ArrayOf[Any], Maybe[Proc] => Any
|
536
|
+
def proxy_method_call(k, v, args, &b)
|
537
|
+
if @ready
|
538
|
+
ctx = ::Middleman::CoreExtensions::Collections::StepContext.current
|
539
|
+
r = method(:"__original_#{v}").call(*args, &b)
|
540
|
+
|
541
|
+
if r.respond_to?(:execute_descriptor)
|
542
|
+
if ctx
|
543
|
+
ctx.descriptors << r
|
544
|
+
else
|
545
|
+
@descriptors[k] << r
|
546
|
+
@app.sitemap.rebuild_resource_list!(:"first_run_change_#{v}")
|
547
|
+
end
|
548
|
+
end
|
549
|
+
else
|
550
|
+
@descriptors[k] << method(:"__original_#{v}").call(*args, &b)
|
551
|
+
@app.sitemap.rebuild_resource_list!(:"first_run_change_#{v}")
|
552
|
+
end
|
553
|
+
end
|
522
554
|
end
|
523
555
|
end
|
@@ -12,6 +12,7 @@ class Middleman::Extensions::ExternalPipeline < ::Middleman::Extension
|
|
12
12
|
|
13
13
|
return if app.mode?(:config)
|
14
14
|
|
15
|
+
require 'servolux'
|
15
16
|
require 'thread'
|
16
17
|
require 'fileutils'
|
17
18
|
|
@@ -25,31 +26,63 @@ class Middleman::Extensions::ExternalPipeline < ::Middleman::Extension
|
|
25
26
|
latency: options[:latency],
|
26
27
|
frontmatter: false
|
27
28
|
|
29
|
+
@current_thread = nil
|
30
|
+
app.reload(&method(:reload!))
|
31
|
+
|
28
32
|
logger.info "== Executing: `#{options[:command]}`"
|
29
33
|
|
30
34
|
if app.build? || options[:disable_background_execution]
|
31
|
-
watch_command!
|
35
|
+
watch_command!(false)
|
36
|
+
|
37
|
+
@watcher.poll_once!
|
32
38
|
else
|
33
|
-
|
39
|
+
watch_command!(true)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def reload!
|
44
|
+
if @current_thread
|
45
|
+
logger.info "== Stopping: `#{options[:command]}`"
|
46
|
+
|
47
|
+
@current_thread.stop
|
48
|
+
@current_thread = nil
|
34
49
|
end
|
35
50
|
end
|
36
51
|
|
37
|
-
def watch_command!
|
38
|
-
::
|
39
|
-
|
52
|
+
def watch_command!(async)
|
53
|
+
@current_thread = ::Servolux::Child.new(
|
54
|
+
command: options[:command],
|
55
|
+
suspend: 2
|
56
|
+
)
|
57
|
+
|
58
|
+
@current_thread.start
|
59
|
+
|
60
|
+
watch_thread = Thread.new do
|
61
|
+
while buf = @current_thread.io.gets
|
40
62
|
without_newline = buf.sub(/\n$/, '')
|
41
63
|
logger.info "== External: #{without_newline}" unless without_newline.empty?
|
42
64
|
end
|
43
|
-
end
|
44
65
|
|
45
|
-
|
46
|
-
|
47
|
-
|
66
|
+
@current_thread.wait
|
67
|
+
|
68
|
+
if !@current_thread.exitstatus.nil? && @current_thread.exitstatus != 0
|
69
|
+
logger.error '== External: Command failed with non-zero exit status'
|
70
|
+
exit(1)
|
71
|
+
end
|
48
72
|
end
|
49
73
|
|
50
|
-
|
74
|
+
watch_thread.join unless async
|
51
75
|
rescue ::Errno::ENOENT => e
|
52
76
|
logger.error "== External: Command failed with message: #{e.message}"
|
53
77
|
exit(1)
|
54
78
|
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def print_command(stdout)
|
83
|
+
while buf = stdout.gets
|
84
|
+
without_newline = buf.sub(/\n$/, '')
|
85
|
+
logger.info "== External: #{without_newline}" unless without_newline.empty?
|
86
|
+
end
|
87
|
+
end
|
55
88
|
end
|
@@ -20,8 +20,8 @@ module Middleman
|
|
20
20
|
result
|
21
21
|
end
|
22
22
|
|
23
|
-
Contract String, String, ArrayOf[String], Proc => String
|
24
|
-
def rewrite_paths(body,
|
23
|
+
Contract String, String, ArrayOf[String], IsA['::Middleman::Application'], Proc => String
|
24
|
+
def rewrite_paths(body, path, exts, app, &_block)
|
25
25
|
matcher = /([\'\"\(,]\s*|# sourceMappingURL=)([^\s\'\"\)\(>]+(#{::Regexp.union(exts)}))/
|
26
26
|
|
27
27
|
url_fn_prefix = 'url('
|
@@ -35,11 +35,21 @@ module Middleman
|
|
35
35
|
asset_path = asset_path[url_fn_prefix.length..-1]
|
36
36
|
end
|
37
37
|
|
38
|
+
current_resource = app.sitemap.find_resource_by_destination_path(path)
|
39
|
+
|
38
40
|
begin
|
39
41
|
uri = ::Addressable::URI.parse(asset_path)
|
40
42
|
|
41
|
-
if uri.relative? && uri.host.nil? && !(asset_path =~ /^[^\/].*[a-z]+\.[a-z]+\/.*/)
|
42
|
-
|
43
|
+
if uri.relative? && uri.host.nil? && !(asset_path =~ /^[^\/].*[a-z]+\.[a-z]+\/.*/)
|
44
|
+
dest_path = ::Middleman::Util.url_for(app, asset_path, relative: false, current_resource: current_resource)
|
45
|
+
|
46
|
+
resource = app.sitemap.find_resource_by_destination_path(dest_path)
|
47
|
+
|
48
|
+
if resource && (result = yield(asset_path))
|
49
|
+
"#{opening_character}#{result}"
|
50
|
+
else
|
51
|
+
match
|
52
|
+
end
|
43
53
|
else
|
44
54
|
match
|
45
55
|
end
|
data/middleman-core.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_dependency('erubis')
|
26
26
|
s.add_dependency('fast_blank')
|
27
27
|
s.add_dependency('parallel')
|
28
|
+
s.add_dependency('servolux')
|
28
29
|
|
29
30
|
# Helpers
|
30
31
|
s.add_dependency('activesupport', ['~> 4.2'])
|
@@ -41,13 +42,13 @@ Gem::Specification.new do |s|
|
|
41
42
|
s.add_dependency('i18n', ['~> 0.7.0'])
|
42
43
|
|
43
44
|
# Automatic Image Sizes
|
44
|
-
s.add_dependency('fastimage', ['~>
|
45
|
+
s.add_dependency('fastimage', ['~> 2.0'])
|
45
46
|
|
46
47
|
# Minify CSS
|
47
48
|
s.add_dependency('sass', ['>= 3.4'])
|
48
49
|
|
49
50
|
# Minify JS
|
50
|
-
s.add_dependency('uglifier', ['~>
|
51
|
+
s.add_dependency('uglifier', ['~> 3.0'])
|
51
52
|
s.add_dependency('execjs', ['~> 2.0'])
|
52
53
|
|
53
54
|
# Testing
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.7
|
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-
|
13
|
+
date: 2016-04-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -102,6 +102,20 @@ dependencies:
|
|
102
102
|
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: servolux
|
107
|
+
requirement: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
type: :runtime
|
113
|
+
prerelease: false
|
114
|
+
version_requirements: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
105
119
|
- !ruby/object:Gem::Dependency
|
106
120
|
name: activesupport
|
107
121
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,14 +206,14 @@ dependencies:
|
|
192
206
|
requirements:
|
193
207
|
- - "~>"
|
194
208
|
- !ruby/object:Gem::Version
|
195
|
-
version: '
|
209
|
+
version: '2.0'
|
196
210
|
type: :runtime
|
197
211
|
prerelease: false
|
198
212
|
version_requirements: !ruby/object:Gem::Requirement
|
199
213
|
requirements:
|
200
214
|
- - "~>"
|
201
215
|
- !ruby/object:Gem::Version
|
202
|
-
version: '
|
216
|
+
version: '2.0'
|
203
217
|
- !ruby/object:Gem::Dependency
|
204
218
|
name: sass
|
205
219
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,14 +234,14 @@ dependencies:
|
|
220
234
|
requirements:
|
221
235
|
- - "~>"
|
222
236
|
- !ruby/object:Gem::Version
|
223
|
-
version: '
|
237
|
+
version: '3.0'
|
224
238
|
type: :runtime
|
225
239
|
prerelease: false
|
226
240
|
version_requirements: !ruby/object:Gem::Requirement
|
227
241
|
requirements:
|
228
242
|
- - "~>"
|
229
243
|
- !ruby/object:Gem::Version
|
230
|
-
version: '
|
244
|
+
version: '3.0'
|
231
245
|
- !ruby/object:Gem::Dependency
|
232
246
|
name: execjs
|
233
247
|
requirement: !ruby/object:Gem::Requirement
|
@@ -459,6 +473,42 @@ files:
|
|
459
473
|
- fixtures/asset-host-app/source/.htaccess
|
460
474
|
- fixtures/asset-host-app/source/asset_host.html.erb
|
461
475
|
- fixtures/asset-host-app/source/images/blank.gif
|
476
|
+
- fixtures/asset-host-app/source/images/blank0.gif
|
477
|
+
- fixtures/asset-host-app/source/images/blank1.gif
|
478
|
+
- fixtures/asset-host-app/source/images/blank10.gif
|
479
|
+
- fixtures/asset-host-app/source/images/blank100.gif
|
480
|
+
- fixtures/asset-host-app/source/images/blank101.gif
|
481
|
+
- fixtures/asset-host-app/source/images/blank1010.gif
|
482
|
+
- fixtures/asset-host-app/source/images/blank102.gif
|
483
|
+
- fixtures/asset-host-app/source/images/blank1020.gif
|
484
|
+
- fixtures/asset-host-app/source/images/blank1021.gif
|
485
|
+
- fixtures/asset-host-app/source/images/blank1022.gif
|
486
|
+
- fixtures/asset-host-app/source/images/blank1023.gif
|
487
|
+
- fixtures/asset-host-app/source/images/blank1024.gif
|
488
|
+
- fixtures/asset-host-app/source/images/blank103.gif
|
489
|
+
- fixtures/asset-host-app/source/images/blank1030.gif
|
490
|
+
- fixtures/asset-host-app/source/images/blank1031.gif
|
491
|
+
- fixtures/asset-host-app/source/images/blank1032.gif
|
492
|
+
- fixtures/asset-host-app/source/images/blank1033.gif
|
493
|
+
- fixtures/asset-host-app/source/images/blank1034.gif
|
494
|
+
- fixtures/asset-host-app/source/images/blank104.gif
|
495
|
+
- fixtures/asset-host-app/source/images/blank1043.gif
|
496
|
+
- fixtures/asset-host-app/source/images/blank1054.gif
|
497
|
+
- fixtures/asset-host-app/source/images/blank2.gif
|
498
|
+
- fixtures/asset-host-app/source/images/blank20.gif
|
499
|
+
- fixtures/asset-host-app/source/images/blank21.gif
|
500
|
+
- fixtures/asset-host-app/source/images/blank22.gif
|
501
|
+
- fixtures/asset-host-app/source/images/blank23.gif
|
502
|
+
- fixtures/asset-host-app/source/images/blank24.gif
|
503
|
+
- fixtures/asset-host-app/source/images/blank3.gif
|
504
|
+
- fixtures/asset-host-app/source/images/blank30.gif
|
505
|
+
- fixtures/asset-host-app/source/images/blank31.gif
|
506
|
+
- fixtures/asset-host-app/source/images/blank32.gif
|
507
|
+
- fixtures/asset-host-app/source/images/blank33.gif
|
508
|
+
- fixtures/asset-host-app/source/images/blank34.gif
|
509
|
+
- fixtures/asset-host-app/source/images/blank4.gif
|
510
|
+
- fixtures/asset-host-app/source/images/blank43.gif
|
511
|
+
- fixtures/asset-host-app/source/images/blank54.gif
|
462
512
|
- fixtures/asset-host-app/source/javascripts/asset_host.js
|
463
513
|
- fixtures/asset-host-app/source/stylesheets/asset_host.css.sass
|
464
514
|
- fixtures/auto-css-app/config.rb
|
@@ -1617,6 +1667,42 @@ test_files:
|
|
1617
1667
|
- fixtures/asset-host-app/source/.htaccess
|
1618
1668
|
- fixtures/asset-host-app/source/asset_host.html.erb
|
1619
1669
|
- fixtures/asset-host-app/source/images/blank.gif
|
1670
|
+
- fixtures/asset-host-app/source/images/blank0.gif
|
1671
|
+
- fixtures/asset-host-app/source/images/blank1.gif
|
1672
|
+
- fixtures/asset-host-app/source/images/blank10.gif
|
1673
|
+
- fixtures/asset-host-app/source/images/blank100.gif
|
1674
|
+
- fixtures/asset-host-app/source/images/blank101.gif
|
1675
|
+
- fixtures/asset-host-app/source/images/blank1010.gif
|
1676
|
+
- fixtures/asset-host-app/source/images/blank102.gif
|
1677
|
+
- fixtures/asset-host-app/source/images/blank1020.gif
|
1678
|
+
- fixtures/asset-host-app/source/images/blank1021.gif
|
1679
|
+
- fixtures/asset-host-app/source/images/blank1022.gif
|
1680
|
+
- fixtures/asset-host-app/source/images/blank1023.gif
|
1681
|
+
- fixtures/asset-host-app/source/images/blank1024.gif
|
1682
|
+
- fixtures/asset-host-app/source/images/blank103.gif
|
1683
|
+
- fixtures/asset-host-app/source/images/blank1030.gif
|
1684
|
+
- fixtures/asset-host-app/source/images/blank1031.gif
|
1685
|
+
- fixtures/asset-host-app/source/images/blank1032.gif
|
1686
|
+
- fixtures/asset-host-app/source/images/blank1033.gif
|
1687
|
+
- fixtures/asset-host-app/source/images/blank1034.gif
|
1688
|
+
- fixtures/asset-host-app/source/images/blank104.gif
|
1689
|
+
- fixtures/asset-host-app/source/images/blank1043.gif
|
1690
|
+
- fixtures/asset-host-app/source/images/blank1054.gif
|
1691
|
+
- fixtures/asset-host-app/source/images/blank2.gif
|
1692
|
+
- fixtures/asset-host-app/source/images/blank20.gif
|
1693
|
+
- fixtures/asset-host-app/source/images/blank21.gif
|
1694
|
+
- fixtures/asset-host-app/source/images/blank22.gif
|
1695
|
+
- fixtures/asset-host-app/source/images/blank23.gif
|
1696
|
+
- fixtures/asset-host-app/source/images/blank24.gif
|
1697
|
+
- fixtures/asset-host-app/source/images/blank3.gif
|
1698
|
+
- fixtures/asset-host-app/source/images/blank30.gif
|
1699
|
+
- fixtures/asset-host-app/source/images/blank31.gif
|
1700
|
+
- fixtures/asset-host-app/source/images/blank32.gif
|
1701
|
+
- fixtures/asset-host-app/source/images/blank33.gif
|
1702
|
+
- fixtures/asset-host-app/source/images/blank34.gif
|
1703
|
+
- fixtures/asset-host-app/source/images/blank4.gif
|
1704
|
+
- fixtures/asset-host-app/source/images/blank43.gif
|
1705
|
+
- fixtures/asset-host-app/source/images/blank54.gif
|
1620
1706
|
- fixtures/asset-host-app/source/javascripts/asset_host.js
|
1621
1707
|
- fixtures/asset-host-app/source/stylesheets/asset_host.css.sass
|
1622
1708
|
- fixtures/auto-css-app/config.rb
|