Outer
Inner
The Article Content
"
+
Scenario: A page uses an inner layout when uses an outer layout (haml)
Given the Server is running at "nested-layout-app"
When I go to "/haml-test.html"
Then I should see:
"""
- Master Haml
+ Master
New Article Title
- I am Outer
- I am Inner
+ Outer
+ Inner
The Article Content
"""
@@ -43,16 +43,13 @@ Feature: Allow nesting of layouts
Given the Server is running at "nested-layout-app"
When I go to "/data-one.html"
Then I should see "Page Number One"
- And I should see "Page #1"
- And I should see "I am Inner"
- And I should see "I am Outer"
- And I should see "Master Erb"
+ And I should see "Inner"
When I go to "/data-two.html"
Then I should see "Page Number Two"
- And I should not see "I am Inner"
+ And I should not see "Inner"
When I go to "/data-one.html"
Then I should see "Page Number One"
- And I should see "I am Inner"
+ And I should see "Inner"
When I go to "/data-two.html"
Then I should see "Page Number Two"
- And I should not see "I am Inner"
+ And I should not see "Inner"
diff --git a/middleman-core/features/page-id.feature b/middleman-core/features/page-id.feature
deleted file mode 100644
index 74d08cb5..00000000
--- a/middleman-core/features/page-id.feature
+++ /dev/null
@@ -1,72 +0,0 @@
-Feature: Page IDs
-
- Scenario: link_to works with blocks (erb)
- Given the Server is running at "page-id-app"
- When I go to "/index.html"
- Then I should see "I am: index"
- And I should see "URL1: /fm.html"
- And I should see "URL2: /2.html"
- And I should see 'URL3:
Hi'
- And I should see 'URL4:
Sym'
- And I should see 'URL5:
Imp'
- And I should see 'URL6:
Foldern'
- And I should see 'URL7:
Feed'
-
- When I go to "/fm.html"
- Then I should see "I am: frontmatter"
- When I go to "/implicit.html"
- Then I should see "I am: implicit"
- When I go to "/feed.xml"
- Then I should see "I am: feed.xml"
- When I go to "/folder/foldern.html"
- Then I should see "I am: folder/foldern"
-
- When I go to "/1.html"
- Then I should see "I am: page1"
- When I go to "/2.html"
- Then I should see "I am: page2"
- When I go to "/3.html"
- Then I should see "I am: page3"
-
- When I go to "/overwrites/from-default.html"
- Then I should see "I am: something-else"
-
- When I go to "/overwrites/from-frontmatter.html"
- Then I should see "I am: from_frontmatter"
-
- Scenario: Override page ID derivation with a proc
- Given a fixture app "page-id-app"
- And app "page-id-app" is using config "proc"
- And the Server is running at "page-id-app"
-
- When I go to "/index.html"
- Then I should see "I am: index.html-foo"
- And I should see "URL1: /fm.html"
- And I should see "URL2: /2.html"
- And I should see 'URL3:
Hi'
- And I should see 'URL4:
Sym'
- And I should see 'URL8:
Imp'
- And I should see 'URL9:
Foldern'
- And I should see 'URL10:
Feed'
-
- When I go to "/fm.html"
- Then I should see "I am: frontmatter"
- When I go to "/implicit.html"
- Then I should see "I am: implicit.html-foo"
- When I go to "/feed.xml"
- Then I should see "I am: feed.xml-foo"
- When I go to "/folder/foldern.html"
- Then I should see "I am: folder/foldern.html-foo"
-
- When I go to "/1.html"
- Then I should see "I am: page1"
- When I go to "/2.html"
- Then I should see "I am: page2"
- When I go to "/3.html"
- Then I should see "I am: page3"
-
- When I go to "/overwrites/from-default.html"
- Then I should see "I am: something-else"
-
- When I go to "/overwrites/from-frontmatter.html"
- Then I should see "I am: from_frontmatter"
diff --git a/middleman-core/features/partials.feature b/middleman-core/features/partials.feature
index 8a0154c2..86509027 100644
--- a/middleman-core/features/partials.feature
+++ b/middleman-core/features/partials.feature
@@ -5,30 +5,25 @@ Feature: Provide Sane Defaults for Partial Behavior
When I go to "/index.html"
Then I should see "Header"
And I should see "Footer"
-
+
Scenario: Finds shared partials relative to the root (sub)
Given the Server is running at "partials-app"
When I go to "/sub/index.html"
Then I should see "Header"
And I should see "Footer"
-
- Scenario: Flags error when partial is not found
- Given the Server is running at "partials-app"
- When I go to "/index_missing.html"
- Then I should see "Error: Could not locate partial"
-
+
Scenario: Prefers partials of the same engine type
Given the Server is running at "partials-app"
When I go to "/index.html"
Then I should see "ERb Main"
-
+
Scenario: Prefers partials of the same engine type
Given the Server is running at "partials-app"
When I go to "/second.html"
Then I should see "Str Main"
And I should see "Header"
And I should see "Footer"
-
+
Scenario: Finds partial relative to template
Given the Server is running at "partials-app"
When I go to "/sub/index.html"
@@ -38,7 +33,7 @@ Feature: Provide Sane Defaults for Partial Behavior
Given the Server is running at "partials-app"
When I go to "/locals.html"
Then I should see "Local var is bar"
-
+
Scenario: Partial and Layout use different engines
Given the Server is running at "different-engine-partial"
When I go to "/index.html"
@@ -55,10 +50,3 @@ Feature: Provide Sane Defaults for Partial Behavior
Then I should see "File Not Found"
When I go to "/_code_snippet.html"
Then I should see "File Not Found"
-
-Scenario: Works with blocks
- Given the Server is running at "partials-app"
- When I go to "/block.html"
- Then I should see "Start"
- And I should see "Contents"
- And I should see "End"
diff --git a/middleman-core/features/relative_assets.feature b/middleman-core/features/relative_assets.feature
index ba131396..ea6cbff0 100644
--- a/middleman-core/features/relative_assets.feature
+++ b/middleman-core/features/relative_assets.feature
@@ -120,7 +120,7 @@ Feature: Relative Assets
"""
And the Server is running at "relative-assets-app"
When I go to "/sub/image_tag.html"
- Then I should see '

'
Scenario: Relative assets should not break data URIs in image_tag
Given a fixture app "relative-assets-app"
diff --git a/middleman-core/features/relative_assets_helpers_only.feature b/middleman-core/features/relative_assets_helpers_only.feature
deleted file mode 100644
index 194c8b37..00000000
--- a/middleman-core/features/relative_assets_helpers_only.feature
+++ /dev/null
@@ -1,123 +0,0 @@
-Feature: Relative Assets (Helpers Only)
-
- Scenario: Rendering css with the feature enabled
- Given a fixture app "relative-assets-app"
- And a file named "config.rb" with:
- """
- activate :relative_assets, helpers_only: true
- """
- And a file named "source/stylesheets/relative_assets.css.sass.erb" with:
- """
- h1
- background: url("<%= asset_url('images/blank.gif') %>")
- h2
- background: url("<%= asset_url('/images/blank2.gif') %>")
- """
- And a file named "source/javascripts/application.js.erb" with:
- """
- function foo() {
- var img = document.createElement('img');
- img.src = '<%= asset_url("images/100px.jpg") %>';
- var body = document.getElementsByTagName('body')[0];
- body.insertBefore(img, body.firstChild);
- }
-
- window.onload = foo;
- """
- And a file named "source/stylesheets/fonts3.css.erb" with:
- """
- @font-face {
- font-family: 'Roboto2';
- src: url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.eot") %>);
- src: url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.eot?#iefix") %>) format('embedded-opentype'),
- url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.woff") %>) format('woff'),
- url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.ttf") %>) format('truetype'),
- url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.svg#robotoregular") %>) format('svg');
- font-weight: normal;
- font-style: normal;
- }
- """
- And the Server is running at "relative-assets-app"
- When I go to "/stylesheets/relative_assets.css"
- Then I should see 'url("../images/blank.gif'
- And I should see 'url("../images/blank2.gif'
- When I go to "/javascripts/application.js"
- Then I should not see "../"
- When I go to "/stylesheets/fonts3.css"
- Then I should see 'url(../fonts/roboto/roboto-regular-webfont.eot'
- And I should see 'url(../fonts/roboto/roboto-regular-webfont.woff'
- And I should see 'url(../fonts/roboto/roboto-regular-webfont.ttf'
- And I should see 'url(../fonts/roboto/roboto-regular-webfont.svg'
-
- Scenario: Relative css reference with directory indexes
- Given a fixture app "relative-assets-app"
- And a file named "config.rb" with:
- """
- activate :directory_indexes
- activate :relative_assets, helpers_only: true
- """
- And the Server is running at "relative-assets-app"
- When I go to "/relative_image/index.html"
- Then I should see "../stylesheets/relative_assets.css"
-
- Scenario: Relative assets via image_tag
- Given a fixture app "relative-assets-app"
- And a file named "config.rb" with:
- """
- activate :relative_assets, helpers_only: true
- """
- And a file named "source/sub/image_tag.html.erb" with:
- """
- <%= image_tag '/img/blank.gif' %>
- """
- And the Server is running at "relative-assets-app"
- When I go to "/sub/image_tag.html"
- Then I should see '

- """
- And the Server is running at "relative-assets-app"
- When I go to "/sub/image_tag.html"
- Then I should see '

'
-
- Scenario: URLs are not rewritten for rewrite ignored paths
- Given a fixture app "relative-assets-app"
- And a file named "config.rb" with:
- """
- activate :relative_assets, rewrite_ignore: [
- '/stylesheets/fonts3.css',
- ], helpers_only: true
- """
- And a file named "source/stylesheets/relative_assets.css.sass.erb" with:
- """
- h1
- background: url("<%= asset_url('images/blank.gif') %>")
- h2
- background: url("<%= asset_url('/images/blank2.gif') %>")
- """
- And a file named "source/stylesheets/fonts3.css.erb" with:
- """
- @font-face {
- font-family: 'Roboto2';
- src: url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.eot") %>);
- src: url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.eot?#iefix") %>) format('embedded-opentype'),
- url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.woff") %>) format('woff'),
- url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.ttf") %>) format('truetype'),
- url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.svg#robotoregular") %>) format('svg');
- font-weight: normal;
- font-style: normal;
- }
- """
- And the Server is running at "relative-assets-app"
- When I go to "/stylesheets/relative_assets.css"
- Then I should see 'url("../images/blank.gif'
- When I go to "/stylesheets/fonts3.css"
- Then I should see 'url(/fonts/roboto/roboto-regular-webfont.eot'
diff --git a/middleman-core/features/sass_in_slim.feature b/middleman-core/features/sass_in_slim.feature
deleted file mode 100644
index d04055e4..00000000
--- a/middleman-core/features/sass_in_slim.feature
+++ /dev/null
@@ -1,40 +0,0 @@
-Feature: Sass/SCSS support in Slim
- In order to test support of the Slim sass and scss filters
-
- Scenario: Sass filter in Slim works
- Given a fixture app "sass-in-slim-app"
- And a file named "config.rb" with:
- """
- activate :directory_indexes
- """
- And a file named "source/sass_filter.html.slim" with:
- """
- sass:
- .sass
- margin: 0
- """
- Given the Server is running at "sass-in-slim-app"
- When I go to "/sass_filter/"
- Then I should see "text/css"
- Then I should see ".sass"
- Then I should see "margin:0"
-
-
- Scenario: SCSS filter in Slim works
- Given a fixture app "sass-in-slim-app"
- And a file named "config.rb" with:
- """
- activate :directory_indexes
- """
- And a file named "source/scss_filter.html.slim" with:
- """
- scss:
- .scss {
- margin: 0;
- }
- """
- Given the Server is running at "sass-in-slim-app"
- When I go to "/scss_filter/"
- Then I should see "text/css"
- Then I should see ".scss"
- Then I should see "margin:0"
diff --git a/middleman-core/features/template-key-collision.feature b/middleman-core/features/template-key-collision.feature
deleted file mode 100644
index 9e530dc1..00000000
--- a/middleman-core/features/template-key-collision.feature
+++ /dev/null
@@ -1,26 +0,0 @@
-Feature: Don't allow template locals to overwrite template helpers
-
- Scenario: Normal Template
- Given an empty app
- And a file named "config.rb" with:
- """
- class TestExt < ::Middleman::Extension
- expose_to_template foo: :foo
-
- def foo
- "bar"
- end
- end
-
- ::Middleman::Extensions.register :test, TestExt
-
- activate :test
-
- page "/index.html", locals: { foo: false }
- """
- And a file named "source/index.html.erb" with:
- """
- <%= foo %>
- """
- Given a built app at "empty_app"
- Then the exit status should be 1
diff --git a/middleman-core/fixtures/asset-hash-minified-app/source/images/100px.jpg b/middleman-core/fixtures/asset-hash-minified-app/source/images/100px.jpg
deleted file mode 100644
index 557d0278..00000000
Binary files a/middleman-core/fixtures/asset-hash-minified-app/source/images/100px.jpg and /dev/null differ
diff --git a/middleman-core/fixtures/asset-hash-minified-app/source/stylesheets/test.css b/middleman-core/fixtures/asset-hash-minified-app/source/stylesheets/test.css
deleted file mode 100644
index 059fce9a..00000000
--- a/middleman-core/fixtures/asset-hash-minified-app/source/stylesheets/test.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.no-bug{background-image:url(/images/100px.jpg)}
-.bug{content:"";background-image:url(/images/100px.jpg)}
-.no-bug{content:""; background-image:url(/images/100px.jpg)}
diff --git a/middleman-core/fixtures/asset-hash-prefix/config.rb b/middleman-core/fixtures/asset-hash-prefix/config.rb
deleted file mode 100644
index 449a2e98..00000000
--- a/middleman-core/fixtures/asset-hash-prefix/config.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-
-activate :asset_hash,
- prefix: "myprefix-"
-
-activate :relative_assets
-
-activate :directory_indexes
diff --git a/middleman-core/fixtures/asset-hash-prefix/lib/middleware.rb b/middleman-core/fixtures/asset-hash-prefix/lib/middleware.rb
deleted file mode 100644
index 8ee825fd..00000000
--- a/middleman-core/fixtures/asset-hash-prefix/lib/middleware.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class Middleware
- def initialize(app)
- @app = app
- end
-
- def call(env)
- status, headers, response = @app.call(env)
- body = ''
- response.each {|part| body += part }
- if (env["PATH_INFO"] =~ /css$/)
- body += "\n/* Added by Rack filter */"
- status, headers, response = Rack::Response.new(body, status, headers).finish
- end
- [status, headers, response]
- end
-end
diff --git a/middleman-core/fixtures/asset-hash-prefix/source/index.html.erb b/middleman-core/fixtures/asset-hash-prefix/source/index.html.erb
deleted file mode 100644
index a88cc13f..00000000
--- a/middleman-core/fixtures/asset-hash-prefix/source/index.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<% content_for :head do %>
-
The Middleman!
-<% end %>
-
-
Testing the sitemap hashing
-
diff --git a/middleman-core/fixtures/asset-hash-prefix/source/javascripts/application.js b/middleman-core/fixtures/asset-hash-prefix/source/javascripts/application.js
deleted file mode 100644
index c72f8572..00000000
--- a/middleman-core/fixtures/asset-hash-prefix/source/javascripts/application.js
+++ /dev/null
@@ -1,2 +0,0 @@
-function foo(){var message="HEY THERE FRIEND!";var para=document.createElement("p");para.innerHTML=message;var body=document.getElementsByTagName("body")[0];body.insertBefore(para,body.firstChild)}window.onload=foo;
-//# sourceMappingURL=application.js.map
diff --git a/middleman-core/fixtures/asset-hash-prefix/source/javascripts/application.js.map b/middleman-core/fixtures/asset-hash-prefix/source/javascripts/application.js.map
deleted file mode 100644
index 6a5acd5c..00000000
--- a/middleman-core/fixtures/asset-hash-prefix/source/javascripts/application.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["source/javascripts/application.js"],"names":["foo","message","para","document","createElement","innerHTML","body","getElementsByTagName","insertBefore","firstChild","window","onload"],"mappings":"AAAA,QAASA,OACP,GAAIC,SAAU,mBACd,IAAIC,MAAOC,SAASC,cAAc,IAClCF,MAAKG,UAAYJ,OACb,IAAIK,MAAOH,SAASI,qBAAqB,QAAQ,EAC/CD,MAAKE,aAAaN,KAAMI,KAAKG,YAGpCC,OAAOC,OAASX"}
\ No newline at end of file
diff --git a/middleman-core/fixtures/asset-hash-prefix/source/layout.erb b/middleman-core/fixtures/asset-hash-prefix/source/layout.erb
deleted file mode 100644
index c8aacecf..00000000
--- a/middleman-core/fixtures/asset-hash-prefix/source/layout.erb
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
- <%= javascript_include_tag "application" %>
- <%= yield_content :head %>
-
-
-
-
-
- <%= yield %>
-
-
-
-
diff --git a/middleman-core/fixtures/asset-hash-source-map/config.rb b/middleman-core/fixtures/asset-hash-source-map/config.rb
deleted file mode 100644
index 1327d8f0..00000000
--- a/middleman-core/fixtures/asset-hash-source-map/config.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-
-activate :asset_hash
-
-activate :relative_assets
-
-activate :directory_indexes
diff --git a/middleman-core/fixtures/asset-hash-source-map/lib/middleware.rb b/middleman-core/fixtures/asset-hash-source-map/lib/middleware.rb
deleted file mode 100644
index 8ee825fd..00000000
--- a/middleman-core/fixtures/asset-hash-source-map/lib/middleware.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class Middleware
- def initialize(app)
- @app = app
- end
-
- def call(env)
- status, headers, response = @app.call(env)
- body = ''
- response.each {|part| body += part }
- if (env["PATH_INFO"] =~ /css$/)
- body += "\n/* Added by Rack filter */"
- status, headers, response = Rack::Response.new(body, status, headers).finish
- end
- [status, headers, response]
- end
-end
diff --git a/middleman-core/fixtures/asset-hash-source-map/source/index.html.erb b/middleman-core/fixtures/asset-hash-source-map/source/index.html.erb
deleted file mode 100644
index a88cc13f..00000000
--- a/middleman-core/fixtures/asset-hash-source-map/source/index.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<% content_for :head do %>
-
The Middleman!
-<% end %>
-
-
Testing the sitemap hashing
-
diff --git a/middleman-core/fixtures/asset-hash-source-map/source/javascripts/application.js b/middleman-core/fixtures/asset-hash-source-map/source/javascripts/application.js
deleted file mode 100644
index c72f8572..00000000
--- a/middleman-core/fixtures/asset-hash-source-map/source/javascripts/application.js
+++ /dev/null
@@ -1,2 +0,0 @@
-function foo(){var message="HEY THERE FRIEND!";var para=document.createElement("p");para.innerHTML=message;var body=document.getElementsByTagName("body")[0];body.insertBefore(para,body.firstChild)}window.onload=foo;
-//# sourceMappingURL=application.js.map
diff --git a/middleman-core/fixtures/asset-hash-source-map/source/javascripts/application.js.map b/middleman-core/fixtures/asset-hash-source-map/source/javascripts/application.js.map
deleted file mode 100644
index 6a5acd5c..00000000
--- a/middleman-core/fixtures/asset-hash-source-map/source/javascripts/application.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["source/javascripts/application.js"],"names":["foo","message","para","document","createElement","innerHTML","body","getElementsByTagName","insertBefore","firstChild","window","onload"],"mappings":"AAAA,QAASA,OACP,GAAIC,SAAU,mBACd,IAAIC,MAAOC,SAASC,cAAc,IAClCF,MAAKG,UAAYJ,OACb,IAAIK,MAAOH,SAASI,qBAAqB,QAAQ,EAC/CD,MAAKE,aAAaN,KAAMI,KAAKG,YAGpCC,OAAOC,OAASX"}
\ No newline at end of file
diff --git a/middleman-core/fixtures/asset-hash-source-map/source/layout.erb b/middleman-core/fixtures/asset-hash-source-map/source/layout.erb
deleted file mode 100644
index c8aacecf..00000000
--- a/middleman-core/fixtures/asset-hash-source-map/source/layout.erb
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
- <%= javascript_include_tag "application" %>
- <%= yield_content :head %>
-
-
-
-
-
- <%= yield %>
-
-
-
-
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank0.gif b/middleman-core/fixtures/asset-host-app/source/images/blank0.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank10.gif b/middleman-core/fixtures/asset-host-app/source/images/blank10.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank100.gif b/middleman-core/fixtures/asset-host-app/source/images/blank100.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank101.gif b/middleman-core/fixtures/asset-host-app/source/images/blank101.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1010.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1010.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank102.gif b/middleman-core/fixtures/asset-host-app/source/images/blank102.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1020.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1020.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1021.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1021.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1022.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1022.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1023.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1023.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1024.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1024.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank103.gif b/middleman-core/fixtures/asset-host-app/source/images/blank103.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1030.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1030.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1031.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1031.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1032.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1032.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1033.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1033.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1034.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1034.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank104.gif b/middleman-core/fixtures/asset-host-app/source/images/blank104.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1043.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1043.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank1054.gif b/middleman-core/fixtures/asset-host-app/source/images/blank1054.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank2.gif b/middleman-core/fixtures/asset-host-app/source/images/blank2.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank20.gif b/middleman-core/fixtures/asset-host-app/source/images/blank20.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank21.gif b/middleman-core/fixtures/asset-host-app/source/images/blank21.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank22.gif b/middleman-core/fixtures/asset-host-app/source/images/blank22.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank23.gif b/middleman-core/fixtures/asset-host-app/source/images/blank23.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank24.gif b/middleman-core/fixtures/asset-host-app/source/images/blank24.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank3.gif b/middleman-core/fixtures/asset-host-app/source/images/blank3.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank30.gif b/middleman-core/fixtures/asset-host-app/source/images/blank30.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank31.gif b/middleman-core/fixtures/asset-host-app/source/images/blank31.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank32.gif b/middleman-core/fixtures/asset-host-app/source/images/blank32.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank33.gif b/middleman-core/fixtures/asset-host-app/source/images/blank33.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank34.gif b/middleman-core/fixtures/asset-host-app/source/images/blank34.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank4.gif b/middleman-core/fixtures/asset-host-app/source/images/blank4.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank43.gif b/middleman-core/fixtures/asset-host-app/source/images/blank43.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/images/blank54.gif b/middleman-core/fixtures/asset-host-app/source/images/blank54.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/asset-host-app/source/javascripts/asset_host.js b/middleman-core/fixtures/asset-host-app/source/javascripts/asset_host.js
deleted file mode 100644
index 251ce693..00000000
--- a/middleman-core/fixtures/asset-host-app/source/javascripts/asset_host.js
+++ /dev/null
@@ -1,2 +0,0 @@
-var a = jQuery.css("h1", "font-size");
-console.log(a);
diff --git a/middleman-core/fixtures/dynamic-pages-app/config.rb b/middleman-core/fixtures/dynamic-pages-app/config.rb
index b195e0f9..75fab5e0 100644
--- a/middleman-core/fixtures/dynamic-pages-app/config.rb
+++ b/middleman-core/fixtures/dynamic-pages-app/config.rb
@@ -28,7 +28,3 @@ page "fake/*", locals: { glob_var: "I am one glob" }
page "fake2/*", locals: { glob_var: "I am two glob" }
page "fake3/*", locals: { glob_var: "I am three glob" }
page "fake4/*", locals: { glob_var: "I am four glob" }
-
-["tom", "dick", "harry"].each do |name|
- proxy "/about/#{name}.html", "/should_be_ignored9.html", locals: { person_name: name }, ignore: true
-end
diff --git a/middleman-core/fixtures/dynamic-pages-app/source/should_be_ignored9.html b/middleman-core/fixtures/dynamic-pages-app/source/should_be_ignored9.html
deleted file mode 100644
index 53571d5e..00000000
--- a/middleman-core/fixtures/dynamic-pages-app/source/should_be_ignored9.html
+++ /dev/null
@@ -1 +0,0 @@
-
Ignore me! 9
diff --git a/middleman-core/fixtures/external-pipeline-error/config.rb b/middleman-core/fixtures/external-pipeline-error/config.rb
deleted file mode 100644
index 96bb2b94..00000000
--- a/middleman-core/fixtures/external-pipeline-error/config.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-activate :external_pipeline,
- name: :failing,
- command: "mv does-not-exist tmp/file.js",
- source: "tmp",
- latency: 2
diff --git a/middleman-core/fixtures/external-pipeline-error/source/javascripts/file.js b/middleman-core/fixtures/external-pipeline-error/source/javascripts/file.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/nested-layout-app/source/layouts/inner.erb b/middleman-core/fixtures/nested-layout-app/source/layouts/inner.erb
index 3e29f567..62dfc12b 100644
--- a/middleman-core/fixtures/nested-layout-app/source/layouts/inner.erb
+++ b/middleman-core/fixtures/nested-layout-app/source/layouts/inner.erb
@@ -1,7 +1,4 @@
----
-inner: true
----
<% wrap_layout :outer do %>
- I am Inner
+ Inner
<%= yield %>
-<% end %>
+<% end %>
\ No newline at end of file
diff --git a/middleman-core/fixtures/nested-layout-app/source/layouts/inner_haml.haml b/middleman-core/fixtures/nested-layout-app/source/layouts/inner_haml.haml
index 5f99da1e..a8c1938d 100644
--- a/middleman-core/fixtures/nested-layout-app/source/layouts/inner_haml.haml
+++ b/middleman-core/fixtures/nested-layout-app/source/layouts/inner_haml.haml
@@ -1,7 +1,3 @@
----
-inner_haml: true
----
-
= wrap_layout :outer_haml do
- I am Inner
- = yield
+ Inner
+ = yield
\ No newline at end of file
diff --git a/middleman-core/fixtures/nested-layout-app/source/layouts/inner_slim.slim b/middleman-core/fixtures/nested-layout-app/source/layouts/inner_slim.slim
index f7d9c924..49f1ab6f 100644
--- a/middleman-core/fixtures/nested-layout-app/source/layouts/inner_slim.slim
+++ b/middleman-core/fixtures/nested-layout-app/source/layouts/inner_slim.slim
@@ -1,7 +1,3 @@
----
-inner_slim: true
----
-
= wrap_layout :outer_slim do
- h3 I am Inner
- == yield
+ h3 Inner
+ == yield
\ No newline at end of file
diff --git a/middleman-core/fixtures/nested-layout-app/source/layouts/master.erb b/middleman-core/fixtures/nested-layout-app/source/layouts/master.erb
index fc862aa4..7bd170af 100644
--- a/middleman-core/fixtures/nested-layout-app/source/layouts/master.erb
+++ b/middleman-core/fixtures/nested-layout-app/source/layouts/master.erb
@@ -1,9 +1,3 @@
----
-master: true
----
-
-Master Erb
+Master
<%= current_page.data.title %>
<%= yield %>
-
-Using Inner: <%= current_page.data.inner ? 'true' : 'false' %>
diff --git a/middleman-core/fixtures/nested-layout-app/source/layouts/master_haml.haml b/middleman-core/fixtures/nested-layout-app/source/layouts/master_haml.haml
index 3c949d5c..273f21e7 100644
--- a/middleman-core/fixtures/nested-layout-app/source/layouts/master_haml.haml
+++ b/middleman-core/fixtures/nested-layout-app/source/layouts/master_haml.haml
@@ -1,7 +1,3 @@
----
-master_haml: true
----
-
-Master Haml
+Master
%h1= current_page.data.title
= yield
diff --git a/middleman-core/fixtures/nested-layout-app/source/layouts/master_slim.slim b/middleman-core/fixtures/nested-layout-app/source/layouts/master_slim.slim
index cd5eac1d..4ade5748 100644
--- a/middleman-core/fixtures/nested-layout-app/source/layouts/master_slim.slim
+++ b/middleman-core/fixtures/nested-layout-app/source/layouts/master_slim.slim
@@ -1,7 +1,3 @@
----
-master_slim: true
----
-
-h1 Master Slim
+h1 Master
p== current_page.data.title
div== yield
diff --git a/middleman-core/fixtures/nested-layout-app/source/layouts/outer.erb b/middleman-core/fixtures/nested-layout-app/source/layouts/outer.erb
index adc4f9e2..643d8efc 100644
--- a/middleman-core/fixtures/nested-layout-app/source/layouts/outer.erb
+++ b/middleman-core/fixtures/nested-layout-app/source/layouts/outer.erb
@@ -1,8 +1,4 @@
----
-outer: true
----
-
<% wrap_layout :master do %>
- I am Outer
+ Outer
<%= yield %>
-<% end %>
+<% end %>
\ No newline at end of file
diff --git a/middleman-core/fixtures/nested-layout-app/source/layouts/outer_haml.haml b/middleman-core/fixtures/nested-layout-app/source/layouts/outer_haml.haml
index d6d4b05b..eaf1671f 100644
--- a/middleman-core/fixtures/nested-layout-app/source/layouts/outer_haml.haml
+++ b/middleman-core/fixtures/nested-layout-app/source/layouts/outer_haml.haml
@@ -1,7 +1,3 @@
----
-outer_haml: true
----
-
= wrap_layout :master_haml do
- I am Outer
+ Outer
= yield
diff --git a/middleman-core/fixtures/nested-layout-app/source/layouts/outer_slim.slim b/middleman-core/fixtures/nested-layout-app/source/layouts/outer_slim.slim
index 65eb3277..0c17185b 100644
--- a/middleman-core/fixtures/nested-layout-app/source/layouts/outer_slim.slim
+++ b/middleman-core/fixtures/nested-layout-app/source/layouts/outer_slim.slim
@@ -1,7 +1,3 @@
----
-outer_slim: true
----
-
= wrap_layout :master_slim do
- h2 I am Outer
+ h2 Outer
== yield
diff --git a/middleman-core/fixtures/page-id-app/config-proc.rb b/middleman-core/fixtures/page-id-app/config-proc.rb
deleted file mode 100644
index 03070f0e..00000000
--- a/middleman-core/fixtures/page-id-app/config-proc.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-%w(1 2 3).each do |n|
- proxy "/#{n}.html", "/index.html", id: "page#{n}"
-end
-
-page "/overwrites/*", id: :"something-else"
-
-config[:page_id_generator] = ->(path){ path + "-foo" }
diff --git a/middleman-core/fixtures/page-id-app/config.rb b/middleman-core/fixtures/page-id-app/config.rb
deleted file mode 100644
index d0475e7a..00000000
--- a/middleman-core/fixtures/page-id-app/config.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-%w(1 2 3).each do |n|
- proxy "/#{n}.html", "/index.html", id: "page#{n}"
-end
-
-page "/overwrites/*", id: :"something-else"
diff --git a/middleman-core/fixtures/page-id-app/source/feed.xml.erb b/middleman-core/fixtures/page-id-app/source/feed.xml.erb
deleted file mode 100644
index a27800bd..00000000
--- a/middleman-core/fixtures/page-id-app/source/feed.xml.erb
+++ /dev/null
@@ -1 +0,0 @@
-I am: <%= current_resource.page_id %>
diff --git a/middleman-core/fixtures/page-id-app/source/fm.html.erb b/middleman-core/fixtures/page-id-app/source/fm.html.erb
deleted file mode 100644
index 4d6d0772..00000000
--- a/middleman-core/fixtures/page-id-app/source/fm.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
----
-id: frontmatter
----
-
-I am: <%= current_resource.page_id %>
diff --git a/middleman-core/fixtures/page-id-app/source/folder/foldern.html.erb b/middleman-core/fixtures/page-id-app/source/folder/foldern.html.erb
deleted file mode 100644
index a27800bd..00000000
--- a/middleman-core/fixtures/page-id-app/source/folder/foldern.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-I am: <%= current_resource.page_id %>
diff --git a/middleman-core/fixtures/page-id-app/source/implicit.html.erb b/middleman-core/fixtures/page-id-app/source/implicit.html.erb
deleted file mode 100644
index a27800bd..00000000
--- a/middleman-core/fixtures/page-id-app/source/implicit.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-I am: <%= current_resource.page_id %>
diff --git a/middleman-core/fixtures/page-id-app/source/index.html.erb b/middleman-core/fixtures/page-id-app/source/index.html.erb
deleted file mode 100644
index 6060bc3f..00000000
--- a/middleman-core/fixtures/page-id-app/source/index.html.erb
+++ /dev/null
@@ -1,14 +0,0 @@
-I am: <%= current_resource.page_id %>
-
-URL1: <%= url_for "frontmatter" %>
-URL2: <%= url_for "page2" %>
-URL3: <%= link_to "Hi", "page3" %>
-URL4: <%= link_to "Sym", :"something-else" %>
-URL5: <%= link_to "Imp", :implicit %>
-URL6: <%= link_to "Foldern", "folder/foldern" %>
-URL7: <%= link_to "Feed", "feed.xml" %>
-
-<%# If custom proc %>
-URL8: <%= link_to "Imp", "implicit.html-foo" %>
-URL9: <%= link_to "Foldern", "folder/foldern.html-foo" %>
-URL10: <%= link_to "Feed", "feed.xml-foo" %>
diff --git a/middleman-core/fixtures/page-id-app/source/overwrites/from-default.html.erb b/middleman-core/fixtures/page-id-app/source/overwrites/from-default.html.erb
deleted file mode 100644
index a27800bd..00000000
--- a/middleman-core/fixtures/page-id-app/source/overwrites/from-default.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-I am: <%= current_resource.page_id %>
diff --git a/middleman-core/fixtures/page-id-app/source/overwrites/from-frontmatter.html.erb b/middleman-core/fixtures/page-id-app/source/overwrites/from-frontmatter.html.erb
deleted file mode 100644
index 194cf4c1..00000000
--- a/middleman-core/fixtures/page-id-app/source/overwrites/from-frontmatter.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
----
-id: from_frontmatter
----
-
-I am: <%= current_resource.page_id %>
diff --git a/middleman-core/fixtures/partials-app/source/_block.erb b/middleman-core/fixtures/partials-app/source/_block.erb
deleted file mode 100644
index 179e0c82..00000000
--- a/middleman-core/fixtures/partials-app/source/_block.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-Start
-<%= yield %>
-End
diff --git a/middleman-core/fixtures/partials-app/source/block.html.erb b/middleman-core/fixtures/partials-app/source/block.html.erb
deleted file mode 100644
index 613f7ccb..00000000
--- a/middleman-core/fixtures/partials-app/source/block.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<% partial "block" do %>
-Contents
-<% end %>
diff --git a/middleman-core/fixtures/partials-app/source/index_missing.html.erb b/middleman-core/fixtures/partials-app/source/index_missing.html.erb
deleted file mode 100755
index bcd70b82..00000000
--- a/middleman-core/fixtures/partials-app/source/index_missing.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<%= partial "shared/header" %>
-<%= partial "i_do_not_exist" %>
-<%= partial "shared/footer" %>
diff --git a/middleman-core/fixtures/relative-assets-app/source/images/blank2.gif b/middleman-core/fixtures/relative-assets-app/source/images/blank2.gif
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/fixtures/sass-in-slim-app/config.rb b/middleman-core/fixtures/sass-in-slim-app/config.rb
deleted file mode 100644
index e69de29b..00000000
diff --git a/middleman-core/lib/middleman-core.rb b/middleman-core/lib/middleman-core.rb
index 687a53e5..8170fefb 100644
--- a/middleman-core/lib/middleman-core.rb
+++ b/middleman-core/lib/middleman-core.rb
@@ -6,6 +6,9 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
# Top-level Middleman namespace
module Middleman
+ # Backwards compatibility namespace
+ module Features; end
+
autoload :Application, 'middleman-core/application'
end
diff --git a/middleman-core/lib/middleman-core/application.rb b/middleman-core/lib/middleman-core/application.rb
index 52b31c92..38c2baf4 100644
--- a/middleman-core/lib/middleman-core/application.rb
+++ b/middleman-core/lib/middleman-core/application.rb
@@ -96,10 +96,6 @@ module Middleman
# @return [String]
define_setting :source, 'source', 'Name of the source directory'
- # If we should not run the sitemap.
- # @return [Boolean]
- define_setting :disable_sitemap, false, 'If we should not run the sitemap.'
-
# If we should exit before ready event.
# @return [Boolean]
define_setting :exit_before_ready, false, 'If we should exit before ready event.'
@@ -110,7 +106,7 @@ module Middleman
# Middleman environment. Defaults to :development
# @return [String]
- define_setting :environment, ((ENV['MM_ENV'] && ENV['MM_ENV'].to_sym) || :development), 'Middleman environment. Defaults to :development', import: proc { |s| s.to_sym }
+ define_setting :environment, ((ENV['MM_ENV'] && ENV['MM_ENV'].to_sym) || :development), 'Middleman environment. Defaults to :development'
# Which file should be used for directory indexes
# @return [String]
@@ -153,17 +149,9 @@ module Middleman
define_setting :http_prefix, '/', 'Default prefix for building paths'
# Default layout name
- # @return [String]
+ # @return [String, Symbold]
define_setting :layout, :_auto_layout, 'Default layout name'
- # Which file extensions have a layout by default.
- # @return [Array.
]
- define_setting :extensions_with_layout, %w(.htm .html .xhtml .php), 'Which file extensions have a layout by default.'
-
- # Which file extensions are "assets."
- # @return [Array.]
- define_setting :asset_extensions, %w(.css .png .jpg .jpeg .webp .svg .svgz .js .gif .ttf .otf .woff .woff2 .eot .ico .map), 'Which file extensions are treated as assets.'
-
# Default string encoding for templates and output.
# @return [String]
define_setting :encoding, 'utf-8', 'Default string encoding for templates and output'
@@ -191,19 +179,16 @@ module Middleman
ignored
end,
- layout: proc do |file, app|
- file[:relative_path].to_s.start_with?('layout.', app.config[:layouts_dir] + '/')
+ layout: proc do |file, _sitemap_app|
+ file[:relative_path].to_s.start_with?('layout.', 'layouts/')
end
}, 'Callbacks that can exclude paths from the sitemap'
- define_setting :skip_build_clean, proc { |p| [/\.git/].any? { |r| p =~ r } }, 'Whether some paths should not be removed during a clean build.'
-
- define_setting :cli_options, {}, 'Options from the Command Line.'
+ define_setting :skip_build_clean, proc { |p| [/\.git/].any? { |r| r.match(p) } }, 'Whether some paths should not be removed during a clean build.'
define_setting :watcher_disable, false, 'If the Listen watcher should not run'
define_setting :watcher_force_polling, false, 'If the Listen watcher should run in polling mode'
define_setting :watcher_latency, nil, 'The Listen watcher latency'
- define_setting :watcher_wait_for_delay, 0.5, 'The Listen watcher delay between calls when changes exist'
# Delegate convenience methods off to their implementations
def_delegator :"::Middleman::Logger", :singleton, :logger
@@ -236,8 +221,7 @@ module Middleman
:before, # Before Rack requests
:before_render,
:after_render,
- :before_server,
- :reload
+ :before_server
])
@middleware = Set.new
@@ -267,8 +251,6 @@ module Middleman
# Evaluate a passed block if given
config_context.instance_exec(&block) if block_given?
- apply_cli_options
-
execute_callbacks(:before_sitemap)
# Initialize the Sitemap
@@ -291,8 +273,6 @@ module Middleman
# Run any `configure` blocks for the current mode.
execute_callbacks([:configure, config[:mode]])
- apply_cli_options
-
# Post parsing, pre-extension callback
execute_callbacks(:after_configuration_eval)
@@ -309,17 +289,6 @@ module Middleman
execute_callbacks(:ready) unless config[:exit_before_ready]
end
- def apply_cli_options
- config[:cli_options].each do |k, v|
- setting = config.setting(k.to_sym)
- next unless setting
-
- v = setting.options[:import].call(v) if setting.options[:import]
-
- config[k.to_sym] = v
- end
- end
-
# Eval config
def evaluate_configuration!
# Check for and evaluate local configuration in `config.rb`
@@ -345,11 +314,11 @@ module Middleman
# Clean up missing Tilt exts
def prune_tilt_templates!
- ::Tilt.default_mapping.lazy_map.each_key do |key|
+ ::Tilt.mappings.each do |key, _|
begin
::Tilt[".#{key}"]
rescue LoadError, NameError
- ::Tilt.default_mapping.lazy_map.delete(key)
+ ::Tilt.mappings.delete(key)
end
end
end
diff --git a/middleman-core/lib/middleman-core/builder.rb b/middleman-core/lib/middleman-core/builder.rb
index 1796d4d7..ef289d42 100644
--- a/middleman-core/lib/middleman-core/builder.rb
+++ b/middleman-core/lib/middleman-core/builder.rb
@@ -1,7 +1,6 @@
require 'pathname'
require 'fileutils'
require 'tempfile'
-require 'parallel'
require 'middleman-core/rack'
require 'middleman-core/callback_manager'
require 'middleman-core/contracts'
@@ -37,7 +36,6 @@ module Middleman
@glob = opts.fetch(:glob)
@cleaning = opts.fetch(:clean)
- @parallel = opts.fetch(:parallel, true)
rack_app = ::Middleman::Rack.new(@app).to_app
@rack = ::Rack::MockRequest.new(rack_app)
@@ -53,33 +51,18 @@ module Middleman
@has_error = false
@events = {}
- ::Middleman::Util.instrument 'builder.before' do
- @app.execute_callbacks(:before_build, [self])
- end
+ @app.execute_callbacks(:before_build, [self])
- ::Middleman::Util.instrument 'builder.queue' do
- queue_current_paths if @cleaning
- end
+ queue_current_paths if @cleaning
- ::Middleman::Util.instrument 'builder.prerender' do
- prerender_css
- end
+ prerender_css
+ output_files
- ::Middleman::Profiling.start
-
- ::Middleman::Util.instrument 'builder.output' do
- output_files
- end
+ clean! if @cleaning
::Middleman::Profiling.report('build')
- ::Middleman::Util.instrument 'builder.clean' do
- clean! if @cleaning
- end
-
- ::Middleman::Util.instrument 'builder.after' do
- @app.execute_callbacks(:after_build, [self])
- end
+ @app.execute_callbacks(:after_build, [self])
!@has_error
end
@@ -90,17 +73,14 @@ module Middleman
def prerender_css
logger.debug '== Prerendering CSS'
- css_files = ::Middleman::Util.instrument 'builder.prerender.output' do
- resources = @app.sitemap.resources.select { |resource| resource.ext == '.css' }
- output_resources(resources)
- end
+ css_files = @app.sitemap.resources
+ .select { |resource| resource.ext == '.css' }
+ .each(&method(:output_resource))
- ::Middleman::Util.instrument 'builder.prerender.check-files' do
- # Double-check for compass sprites
- unless @app.files.find_new_files!.empty?
- logger.debug '== Checking for Compass sprites'
- @app.sitemap.ensure_resource_list_updated!
- end
+ # Double-check for compass sprites
+ if @app.files.find_new_files!.length > 0
+ logger.debug '== Checking for Compass sprites'
+ @app.sitemap.ensure_resource_list_updated!
end
css_files
@@ -112,49 +92,11 @@ module Middleman
def output_files
logger.debug '== Building files'
- resources = @app.sitemap.resources
- .reject { |resource| resource.ext == '.css' }
- .sort_by { |resource| SORT_ORDER.index(resource.ext) || 100 }
-
- if @glob
- resources = resources.select do |resource|
- if defined?(::File::FNM_EXTGLOB)
- File.fnmatch(@glob, resource.destination_path, ::File::FNM_EXTGLOB)
- else
- File.fnmatch(@glob, resource.destination_path)
- end
- end
- end
-
- output_resources(resources)
- end
-
- Contract ResourceList => ResourceList
- def output_resources(resources)
- results = if @parallel
- ::Parallel.map(resources, &method(:output_resource))
- else
- resources.map(&method(:output_resource))
- end
-
- @has_error = true if results.any? { |r| r == false }
-
- if @cleaning && !@has_error
- results.each do |p|
- next unless p.exist?
-
- # handle UTF-8-MAC filename on MacOS
- cleaned_name = if RUBY_PLATFORM =~ /darwin/
- p.to_s.encode('UTF-8', 'UTF-8-MAC')
- else
- p
- end
-
- @to_clean.delete(Pathname(cleaned_name))
- end
- end
-
- resources
+ @app.sitemap.resources
+ .sort_by { |resource| SORT_ORDER.index(resource.ext) || 100 }
+ .reject { |resource| resource.ext == '.css' }
+ .select { |resource| !@glob || File.fnmatch(@glob, resource.destination_path) }
+ .each(&method(:output_resource))
end
# Figure out the correct event mode.
@@ -218,32 +160,40 @@ module Middleman
# Try to output a resource and capture errors.
# @param [Middleman::Sitemap::Resource] resource The resource.
# @return [void]
- Contract IsA['Middleman::Sitemap::Resource'] => Or[Pathname, Bool]
+ Contract IsA['Middleman::Sitemap::Resource'] => Any
def output_resource(resource)
- ::Middleman::Util.instrument 'builder.output.resource', path: File.basename(resource.destination_path) do
- output_file = @build_dir + resource.destination_path.gsub('%20', ' ')
+ output_file = @build_dir + resource.destination_path.gsub('%20', ' ')
- begin
- if resource.binary?
- export_file!(output_file, resource.file_descriptor[:full_path])
+ begin
+ if resource.binary?
+ export_file!(output_file, resource.file_descriptor[:full_path])
+ else
+ response = @rack.get(::URI.escape(resource.request_path))
+
+ # If we get a response, save it to a tempfile.
+ if response.status == 200
+ export_file!(output_file, binary_encode(response.body))
else
- response = @rack.get(::URI.escape(resource.request_path))
-
- # If we get a response, save it to a tempfile.
- if response.status == 200
- export_file!(output_file, binary_encode(response.body))
- else
- trigger(:error, output_file, response.body)
- return false
- end
+ @has_error = true
+ trigger(:error, output_file, response.body)
end
- rescue => e
- trigger(:error, output_file, "#{e}\n#{e.backtrace.join("\n")}")
- return false
end
+ rescue => e
+ @has_error = true
+ trigger(:error, output_file, "#{e}\n#{e.backtrace.join("\n")}")
+ end
+ return unless @cleaning
+ return unless output_file.exist?
+
+ # handle UTF-8-MAC filename on MacOS
+ cleaned_name = if RUBY_PLATFORM =~ /darwin/
+ output_file.to_s.encode('UTF-8', 'UTF-8-MAC')
+ else
output_file
end
+
+ @to_clean.delete(Pathname(cleaned_name))
end
# Get a list of all the paths in the destination folder and save them
diff --git a/middleman-core/lib/middleman-core/config_context.rb b/middleman-core/lib/middleman-core/config_context.rb
index 3ee98632..1f9f32f6 100644
--- a/middleman-core/lib/middleman-core/config_context.rb
+++ b/middleman-core/lib/middleman-core/config_context.rb
@@ -8,7 +8,7 @@ module Middleman
attr_reader :app
# Whitelist methods that can reach out.
- def_delegators :@app, :config, :logger, :use, :map, :mime_type, :files, :root, :build?, :server?, :environment?, :extensions
+ def_delegators :@app, :config, :logger, :use, :map, :mime_type, :files, :root, :build?, :server?, :environment?
def_delegator :"@app.extensions", :activate
def initialize(app, template_context_class)
@@ -22,10 +22,6 @@ module Middleman
app.subscribe_to_callbacks(&method(:execute_callbacks))
end
- def include(mod)
- extend(mod)
- end
-
def helpers(*helper_modules, &block)
helper_modules ||= []
diff --git a/middleman-core/lib/middleman-core/configuration.rb b/middleman-core/lib/middleman-core/configuration.rb
index c916fc90..3f889c00 100644
--- a/middleman-core/lib/middleman-core/configuration.rb
+++ b/middleman-core/lib/middleman-core/configuration.rb
@@ -40,7 +40,7 @@ module Middleman
# Allow configuration settings to be read and written via methods
def method_missing(method, *args)
- if defines_setting?(method) && args.empty?
+ if defines_setting?(method) && args.size == 0
self[method]
elsif method.to_s =~ /^(\w+)=$/ && args.size == 1
self[$1.to_sym] = args[0]
diff --git a/middleman-core/lib/middleman-core/core_extensions/collections.rb b/middleman-core/lib/middleman-core/core_extensions/collections.rb
index b915fffd..434455f1 100644
--- a/middleman-core/lib/middleman-core/core_extensions/collections.rb
+++ b/middleman-core/lib/middleman-core/core_extensions/collections.rb
@@ -1,4 +1,3 @@
-require 'monitor'
require 'middleman-core/core_extensions/collections/pagination'
require 'middleman-core/core_extensions/collections/step_context'
require 'middleman-core/core_extensions/collections/lazy_root'
@@ -42,8 +41,6 @@ module Middleman
@values_by_name = {}
@collector_roots = []
-
- @lock = Monitor.new
end
def before_configuration
@@ -84,35 +81,27 @@ module Middleman
Contract ResourceList => ResourceList
def manipulate_resource_list(resources)
- @lock.synchronize do
- @collector_roots.each do |pair|
- dataset = pair[:block].call(app, resources)
- pair[:root].realize!(dataset)
- end
+ @collector_roots.each do |pair|
+ dataset = pair[:block].call(app, resources)
+ pair[:root].realize!(dataset)
+ end
- ctx = StepContext.new(app)
- StepContext.current = ctx
+ ctx = StepContext.new
+ leaves = @leaves.dup
- leaves = @leaves.dup
+ @collectors_by_name.each do |k, v|
+ @values_by_name[k] = v.value(ctx)
+ leaves.delete v
+ end
- @collectors_by_name.each do |k, v|
- @values_by_name[k] = v.value(ctx)
- leaves.delete v
- end
+ # Execute code paths
+ leaves.each do |v|
+ v.value(ctx)
+ end
- # Execute code paths
- leaves.each do |v|
- v.value(ctx)
- end
-
- # Inject descriptors
- results = ctx.descriptors.reduce(resources) do |sum, d|
- d.execute_descriptor(app, sum)
- end
-
- StepContext.current = nil
-
- results
+ # Inject descriptors
+ ctx.descriptors.reduce(resources) do |sum, d|
+ d.execute_descriptor(app, sum)
end
end
end
diff --git a/middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb b/middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb
index 0549b826..2ce90b83 100644
--- a/middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb
+++ b/middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb
@@ -2,30 +2,23 @@ module Middleman
module CoreExtensions
module Collections
class StepContext
- class << self
- attr_accessor :current
-
- def add_to_context(name, &func)
- send(:define_method, :"_internal_#{name}", &func)
- end
+ def self.add_to_context(name, &func)
+ send(:define_method, :"_internal_#{name}", &func)
end
attr_reader :descriptors
- def initialize(app)
- @app = app
+ def initialize
@descriptors = []
end
def method_missing(name, *args, &block)
internal = :"_internal_#{name}"
- if respond_to?(internal)
- send(internal, *args, &block).tap do |r|
- @descriptors << r if r.respond_to?(:execute_descriptor)
- end
- else
- @app.config_context.send(name, *args, &block)
+ return super unless respond_to?(internal)
+
+ send(internal, *args, &block).tap do |r|
+ @descriptors << r if r.respond_to?(:execute_descriptor)
end
end
end
diff --git a/middleman-core/lib/middleman-core/core_extensions/data.rb b/middleman-core/lib/middleman-core/core_extensions/data.rb
index d711ef4f..22fdd4a2 100644
--- a/middleman-core/lib/middleman-core/core_extensions/data.rb
+++ b/middleman-core/lib/middleman-core/core_extensions/data.rb
@@ -8,7 +8,7 @@ module Middleman
class Data < Extension
attr_reader :data_store
- define_setting :data_dir, ENV['MM_DATA_DIR'] || 'data', 'The directory data files are stored in'
+ define_setting :data_dir, 'data', 'The directory data files are stored in'
# Make the internal `data_store` method available as `app.data`
expose_to_application data: :data_store
@@ -57,7 +57,6 @@ module Middleman
@app = app
@data_file_matcher = data_file_matcher
@local_data = {}
- @local_data_enhanced = nil
@local_sources = {}
@callback_sources = {}
end
@@ -67,7 +66,7 @@ module Middleman
# @param [Symbol] name Name of the data, used for namespacing
# @param [Hash] content The content for this data
# @return [Hash]
- Contract Symbol, Or[Hash, Array] => Hash
+ Contract Symbol, Hash => Hash
def store(name=nil, content=nil)
@local_sources[name.to_s] = content unless name.nil? || content.nil?
@local_sources
@@ -88,8 +87,6 @@ module Middleman
def update_files(updated_files, removed_files)
updated_files.each(&method(:touch_file))
removed_files.each(&method(:remove_file))
-
- @app.sitemap.rebuild_resource_list!(:touched_data_file)
end
# Update the internal cache for a given file path
@@ -102,13 +99,13 @@ module Middleman
extension = File.extname(data_path)
basename = File.basename(data_path, extension)
- return unless %w(.yaml .yml .json).include?(extension)
-
if %w(.yaml .yml).include?(extension)
data, postscript = ::Middleman::Util::Data.parse(file, @app.config[:frontmatter_delims], :yaml)
data[:postscript] = postscript if !postscript.nil? && data.is_a?(Hash)
elsif extension == '.json'
data, _postscript = ::Middleman::Util::Data.parse(file, @app.config[:frontmatter_delims], :json)
+ else
+ return
end
data_branch = @local_data
@@ -120,8 +117,6 @@ module Middleman
end
data_branch[basename] = data
-
- @local_data_enhanced = nil
end
# Remove a given file from the internal cache
@@ -142,15 +137,13 @@ module Middleman
end
data_branch.delete(basename) if data_branch.key?(basename)
-
- @local_data_enhanced = nil
end
# Get a hash from either internal static data or a callback
#
# @param [String, Symbol] path The name of the data namespace
# @return [Hash, nil]
- Contract Or[String, Symbol] => Maybe[Or[Array, IsA['Middleman::Util::EnhancedHash']]]
+ Contract Or[String, Symbol] => Maybe[Hash]
def data_for_path(path)
response = if store.key?(path.to_s)
store[path.to_s]
@@ -158,7 +151,8 @@ module Middleman
callbacks[path.to_s].call
end
- ::Middleman::Util.recursively_enhance(response)
+ response = ::Middleman::Util.recursively_enhance(response)
+ response
end
# "Magically" find namespaces of data if they exist
@@ -168,8 +162,7 @@ module Middleman
def method_missing(path)
if @local_data.key?(path.to_s)
# Any way to cache this?
- @local_data_enhanced ||= ::Middleman::Util.recursively_enhance(@local_data)
- return @local_data_enhanced[path.to_s]
+ return ::Middleman::Util.recursively_enhance(@local_data[path.to_s])
else
result = data_for_path(path)
return result if result
@@ -205,11 +198,11 @@ module Middleman
def to_h
data = {}
- store.each_key do |k|
+ store.each do |k, _|
data[k] = data_for_path(k)
end
- callbacks.each_key do |k|
+ callbacks.each do |k, _|
data[k] = data_for_path(k)
end
diff --git a/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb b/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb
index 774522db..745ca71c 100644
--- a/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb
+++ b/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb
@@ -1,5 +1,4 @@
require 'padrino-helpers'
-require 'middleman-core/contracts'
# Don't fail on invalid locale, that's not what our current
# users expect.
@@ -114,7 +113,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
path_options = {}
path_options[:relative] = options.delete(:relative) if options.key?(:relative)
- sources.flatten.reduce(::ActiveSupport::SafeBuffer.new) do |all, source|
+ sources.flatten.inject(::ActiveSupport::SafeBuffer.new) do |all, source|
all << tag(:link, {
href: asset_path(:css, source, path_options)
}.update(options))
@@ -128,7 +127,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
path_options = {}
path_options[:relative] = options.delete(:relative) if options.key?(:relative)
- sources.flatten.reduce(::ActiveSupport::SafeBuffer.new) do |all, source|
+ sources.flatten.inject(::ActiveSupport::SafeBuffer.new) do |all, source|
all << content_tag(:script, nil, {
src: asset_path(:js, source, path_options)
}.update(options))
@@ -153,7 +152,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
# If the basename of the request as no extension, assume we are serving a
# directory and join index_file to the path.
path = File.join(asset_dir, current_resource.path)
- path = path[0..-(File.extname(path).length + 1)] + ".#{asset_ext}"
+ path = path.sub(/#{Regexp.escape(File.extname(path))}$/, ".#{asset_ext}")
yield path if sitemap.find_resource_by_path(path)
end
@@ -192,7 +191,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
# @param [Hash] options Data to pass through.
# @return [String]
def asset_path(kind, source, options={})
- options_with_resource = {}.merge!(options).merge!(current_resource: current_resource)
+ options_with_resource = options.merge(current_resource: current_resource)
::Middleman::Util.asset_path(app, kind, source, options_with_resource)
end
@@ -203,7 +202,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
# @param [Hash] options Additional options.
# @return [String] The fully qualified asset url
def asset_url(path, prefix='', options={})
- options_with_resource = {}.merge!(options).merge!(current_resource: current_resource)
+ options_with_resource = options.merge(current_resource: current_resource)
::Middleman::Util.asset_url(app, path, prefix, options_with_resource)
end
@@ -211,7 +210,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
# or a Resource, this will produce the nice URL configured for that
# path, respecting :relative_links, directory indexes, etc.
def url_for(path_or_resource, options={})
- options_with_resource = {}.merge!(options).merge!(current_resource: current_resource)
+ options_with_resource = options.merge(current_resource: current_resource)
::Middleman::Util.url_for(app, path_or_resource, options_with_resource)
end
@@ -277,14 +276,5 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
super(path, params)
end
-
- def partial(template, options={}, &block)
- including_parent_locals = {}
- including_parent_locals.merge!(@locs || {})
- including_parent_locals.merge!(options[:locals] || {})
-
- options[:locals] = including_parent_locals
- super(template, options, &block)
- end
end
end
diff --git a/middleman-core/lib/middleman-core/core_extensions/file_watcher.rb b/middleman-core/lib/middleman-core/core_extensions/file_watcher.rb
index 6fd16ae9..82df8f73 100644
--- a/middleman-core/lib/middleman-core/core_extensions/file_watcher.rb
+++ b/middleman-core/lib/middleman-core/core_extensions/file_watcher.rb
@@ -28,7 +28,10 @@ module Middleman
super
# Setup source collection.
- @sources = ::Middleman::Sources.new(app)
+ @sources = ::Middleman::Sources.new(app,
+ disable_watcher: app.config[:watcher_disable],
+ force_polling: app.config[:watcher_force_polling],
+ latency: app.config[:watcher_latency])
# Add default ignores.
IGNORES.each do |key, value|
@@ -52,13 +55,6 @@ module Middleman
# @return [void]
Contract Any
def after_configuration
- @watcher.update_config(
- disable_watcher: app.config[:watcher_disable],
- force_polling: app.config[:watcher_force_polling],
- latency: app.config[:watcher_latency],
- wait_for_delay: app.config[:watcher_wait_for_delay]
- )
-
if @original_source_dir != app.config[:source]
@watcher.update_path(app.config[:source])
end
diff --git a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb
index 0f69c634..a59f7bb1 100644
--- a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb
+++ b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb
@@ -73,20 +73,23 @@ module Middleman::CoreExtensions
return [{}, nil] unless file
- file_path = file[:full_path].to_s
+ return @cache[file[:full_path]] if @cache.key?(file[:full_path])
- @cache[file_path] ||= begin
- ::Middleman::Util::Data.parse(
- file,
- app.config[:frontmatter_delims]
- )
+ if file[:types].include?(:no_frontmatter)
+ $stderr.puts file[:relative_path].to_s
+ require 'pry'
end
+
+ @cache[file[:full_path]] = ::Middleman::Util::Data.parse(
+ file,
+ app.config[:frontmatter_delims]
+ )
end
Contract ArrayOf[IsA['Middleman::SourceFile']], ArrayOf[IsA['Middleman::SourceFile']] => Any
def clear_data(updated_files, removed_files)
(updated_files + removed_files).each do |file|
- @cache.delete(file[:full_path].to_s)
+ @cache.delete(file[:full_path])
end
end
end
diff --git a/middleman-core/lib/middleman-core/core_extensions/i18n.rb b/middleman-core/lib/middleman-core/core_extensions/i18n.rb
index 156f2694..4b2f35b4 100644
--- a/middleman-core/lib/middleman-core/core_extensions/i18n.rb
+++ b/middleman-core/lib/middleman-core/core_extensions/i18n.rb
@@ -102,7 +102,7 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
locale_suffix = ::I18n.locale
extname = File.extname(partial_name)
- maybe_static = !extname.empty?
+ maybe_static = extname.length > 0
suffixed_partial_name = if maybe_static
partial_name.sub(extname, ".#{locale_suffix}#{extname}")
else
@@ -203,7 +203,7 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
if (options[:mount_at_root] == locale) || (options[:mount_at_root].nil? && locales[0] == locale)
'/'
else
- replacement = options[:locale_map][locale] || locale
+ replacement = options[:locale_map].fetch(locale, locale)
options[:path].sub(':locale', replacement.to_s).sub(':lang', replacement.to_s) # Backward compat
end
end
@@ -213,8 +213,6 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
def on_file_changed(_updated_files, _removed_files)
::I18n.load_path |= app.files.by_type(:locales).files.map { |p| p[:full_path].to_s }
::I18n.reload!
-
- @app.sitemap.rebuild_resource_list!(:touched_locale_file)
end
def configure_i18n
diff --git a/middleman-core/lib/middleman-core/core_extensions/inline_url_rewriter.rb b/middleman-core/lib/middleman-core/core_extensions/inline_url_rewriter.rb
index 43354e97..7d42b667 100644
--- a/middleman-core/lib/middleman-core/core_extensions/inline_url_rewriter.rb
+++ b/middleman-core/lib/middleman-core/core_extensions/inline_url_rewriter.rb
@@ -1,6 +1,6 @@
require 'rack'
require 'rack/response'
-require 'memoist'
+require 'addressable/uri'
require 'middleman-core/util'
require 'middleman-core/contracts'
@@ -11,12 +11,13 @@ module Middleman
expose_to_application rewrite_inline_urls: :add
+ IGNORE_DESCRIPTOR = Or[Regexp, RespondTo[:call], String]
REWRITER_DESCRIPTOR = {
id: Symbol,
proc: Or[Proc, Method],
url_extensions: ArrayOf[String],
source_extensions: ArrayOf[String],
- ignore: ArrayOf[::Middleman::Util::IGNORE_DESCRIPTOR],
+ ignore: ArrayOf[IGNORE_DESCRIPTOR],
after: Maybe[Symbol]
}.freeze
@@ -32,8 +33,6 @@ module Middleman
end
def after_configuration
- return if @rewriters.empty?
-
rewriters = @rewriters.values.sort do |a, b|
if b[:after] && b[:after] == a[:id]
1
@@ -46,7 +45,6 @@ module Middleman
end
class Rack
- extend Memoist
include Contracts
Contract RespondTo[:call], {
@@ -57,17 +55,6 @@ module Middleman
@rack_app = app
@middleman_app = options.fetch(:middleman_app)
@rewriters = options.fetch(:rewriters)
-
- all_source_exts = @rewriters
- .reduce([]) { |sum, rewriter| sum + rewriter[:source_extensions] }
- .flatten
- .uniq
- @source_exts_regex_text = Regexp.union(all_source_exts).to_s
-
- @all_asset_exts = @rewriters
- .reduce([]) { |sum, rewriter| sum + rewriter[:url_extensions] }
- .flatten
- .uniq
end
def call(env)
@@ -76,16 +63,27 @@ module Middleman
# Allow configuration or upstream request to skip all rewriting
return [status, headers, response] if env['bypass_inline_url_rewriter'] == 'true'
+ all_source_exts = @rewriters
+ .reduce([]) { |sum, rewriter| sum + rewriter[:source_extensions] }
+ .flatten
+ .uniq
+ source_exts_regex_text = Regexp.union(all_source_exts).to_s
+
+ all_asset_exts = @rewriters
+ .reduce([]) { |sum, rewriter| sum + rewriter[:url_extensions] }
+ .flatten
+ .uniq
+
path = ::Middleman::Util.full_path(env['PATH_INFO'], @middleman_app)
- return [status, headers, response] unless path =~ /(^\/$)|(#{@source_exts_regex_text}$)/
+ return [status, headers, response] unless path =~ /(^\/$)|(#{source_exts_regex_text}$)/
return [status, headers, response] unless body = ::Middleman::Util.extract_response_text(response)
dirpath = ::Pathname.new(File.dirname(path))
rewritten = ::Middleman::Util.instrument 'inline_url_rewriter', path: path do
- ::Middleman::Util.rewrite_paths(body, path, @all_asset_exts, @middleman_app) do |asset_path|
- uri = ::Middleman::Util.parse_uri(asset_path)
+ ::Middleman::Util.rewrite_paths(body, path, all_asset_exts) do |asset_path|
+ uri = ::Addressable::URI.parse(asset_path)
relative_path = uri.host.nil?
@@ -108,9 +106,9 @@ module Middleman
next unless source_exts.include?(::File.extname(path))
ignore = rewriter.fetch(:ignore)
- next if ignore.any? { |r| ::Middleman::Util.should_ignore?(r, full_asset_path) }
+ next if ignore.any? { |r| should_ignore?(r, full_asset_path) }
- rewrite_ignore = Array(rewriter[:rewrite_ignore] || [])
+ rewrite_ignore = Array(rewriter.fetch(:rewrite_ignore, []))
next if rewrite_ignore.any? { |i| ::Middleman::Util.path_match(i, path) }
proc = rewriter.fetch(:proc)
@@ -129,6 +127,23 @@ module Middleman
headers
).finish
end
+
+ Contract IGNORE_DESCRIPTOR, String => Bool
+ def should_ignore?(validator, value)
+ if validator.is_a? Regexp
+ # Treat as Regexp
+ !value.match(validator).nil?
+ elsif validator.respond_to? :call
+ # Treat as proc
+ validator.call(value)
+ elsif validator.is_a? String
+ # Treat as glob
+ File.fnmatch(value, validator)
+ else
+ # If some unknown thing, don't ignore
+ false
+ end
+ end
end
end
end
diff --git a/middleman-core/lib/middleman-core/core_extensions/routing.rb b/middleman-core/lib/middleman-core/core_extensions/routing.rb
index f47ac16b..089b0486 100644
--- a/middleman-core/lib/middleman-core/core_extensions/routing.rb
+++ b/middleman-core/lib/middleman-core/core_extensions/routing.rb
@@ -4,7 +4,7 @@ module Middleman
class Routing < ConfigExtension
# This should always run late, but not as late as :directory_indexes,
# so it can add metadata to any pages generated by other extensions
- self.resource_list_manipulator_priority = [10, 130]
+ self.resource_list_manipulator_priority = 10
# Expose the `page` method to config.
expose_to_config :page
@@ -25,7 +25,7 @@ module Middleman
resources
.select { |r| ::Middleman::Util.path_match(normalized_path, "/#{r.path}") }
- .each { |r| r.add_metadata(metadata, true) }
+ .each { |r| r.add_metadata(metadata) }
resources
end
@@ -52,13 +52,10 @@ module Middleman
def page(path, opts={})
options = opts.dup
- page_data = options.delete(:data) || {}
- page_data[:id] = options.delete(:id) if options.key?(:id)
-
# Default layout
metadata = {
locals: options.delete(:locals) || {},
- page: page_data,
+ page: options.delete(:data) || {},
options: options
}
diff --git a/middleman-core/lib/middleman-core/extension.rb b/middleman-core/lib/middleman-core/extension.rb
index 9805455a..1a8b8fa4 100644
--- a/middleman-core/lib/middleman-core/extension.rb
+++ b/middleman-core/lib/middleman-core/extension.rb
@@ -1,5 +1,4 @@
require 'forwardable'
-require 'memoist'
require 'active_support/core_ext/class/attribute'
require 'middleman-core/configuration'
require 'middleman-core/contracts'
@@ -67,8 +66,6 @@ module Middleman
# @see http://middlemanapp.com/advanced/custom/ Middleman Custom Extensions Documentation
class Extension
extend Forwardable
- extend Memoist
-
include Contracts
def_delegator :@app, :logger
@@ -405,11 +402,11 @@ module Middleman
ext.after_configuration if ext.respond_to?(:after_configuration)
if ext.respond_to?(:manipulate_resource_list)
- ext.app.sitemap.register_resource_list_manipulators(ext.class.ext_name, ext, ext.class.resource_list_manipulator_priority)
+ ext.app.sitemap.register_resource_list_manipulator(ext.class.ext_name, ext, ext.class.resource_list_manipulator_priority)
end
if ext.class.resources_generators && !ext.class.resources_generators.empty?
- ext.app.sitemap.register_resource_list_manipulators(
+ ext.app.sitemap.register_resource_list_manipulator(
:"#{ext.class.ext_name}_generator",
ext,
ext.class.resource_list_manipulator_priority,
@@ -435,7 +432,7 @@ module Middleman
{}
end
- sum.merge!(resource_definitions)
+ sum.merge(resource_definitions)
end
resources + generator_defs.map do |path, g|
@@ -493,14 +490,15 @@ module Middleman
class ConfigExtension < Extension
def initialize(app, config={}, &block)
@descriptors = {}
- @ready = false
+ @wrapped = {}
self.class.exposed_to_config.each do |k, v|
@descriptors[k] = []
define_singleton_method(:"__original_#{v}", &method(v))
define_singleton_method(v) do |*args, &b|
- proxy_method_call(k, v, args, &b)
+ @descriptors[k] << method(:"__original_#{v}").call(*args, &b)
+ @app.sitemap.rebuild_resource_list!(:"first_run_change_#{v}")
end
end
@@ -508,24 +506,11 @@ module Middleman
end
def after_configuration
- context = self
-
self.class.exposed_to_config.each do |k, v|
- ::Middleman::CoreExtensions::Collections::StepContext.add_to_context(k) do |*args, &b|
- r = context.method(:"__original_#{v}").call(*args, &b)
- descriptors << r if r.respond_to?(:execute_descriptor)
- end
+ ::Middleman::CoreExtensions::Collections::StepContext.add_to_context(k, &method(:"__original_#{v}"))
end
end
- def ready
- @ready = true
-
- # @descriptors.each do |k, v|
- # @descriptors[k] = []
- # end
- end
-
# Update the main sitemap resource list
# @return Array
Contract ResourceList => ResourceList
@@ -534,25 +519,5 @@ module Middleman
c.execute_descriptor(app, sum)
end
end
-
- Contract Symbol, Symbol, ArrayOf[Any], Maybe[Proc] => Any
- def proxy_method_call(k, v, args, &b)
- if @ready
- ctx = ::Middleman::CoreExtensions::Collections::StepContext.current
- r = method(:"__original_#{v}").call(*args, &b)
-
- if r.respond_to?(:execute_descriptor)
- if ctx
- ctx.descriptors << r
- else
- @descriptors[k] << r
- @app.sitemap.rebuild_resource_list!(:"first_run_change_#{v}")
- end
- end
- else
- @descriptors[k] << method(:"__original_#{v}").call(*args, &b)
- @app.sitemap.rebuild_resource_list!(:"first_run_change_#{v}")
- end
- end
end
end
diff --git a/middleman-core/lib/middleman-core/extensions.rb b/middleman-core/lib/middleman-core/extensions.rb
index 001b4344..c295efe3 100644
--- a/middleman-core/lib/middleman-core/extensions.rb
+++ b/middleman-core/lib/middleman-core/extensions.rb
@@ -52,7 +52,7 @@ module Middleman
def register(name, extension_class=nil, options={}, &block)
raise 'Extension name must be a symbol' unless name.is_a?(Symbol)
# If we've already got an extension registered under this name, bail out
- # raise "There is a already an extension registered with the name '#{name}'" if registered.key?(name)
+ raise "There is already an extension registered with the name '#{name}'" if registered.key?(name)
# If the extension is defined with a block, grab options out of the "extension_class" parameter.
if extension_class && block_given? && options.empty? && extension_class.is_a?(Hash)
diff --git a/middleman-core/lib/middleman-core/extensions/asset_hash.rb b/middleman-core/lib/middleman-core/extensions/asset_hash.rb
index 3e2a02aa..ac464b69 100644
--- a/middleman-core/lib/middleman-core/extensions/asset_hash.rb
+++ b/middleman-core/lib/middleman-core/extensions/asset_hash.rb
@@ -2,11 +2,10 @@ require 'middleman-core/util'
require 'middleman-core/rack'
class Middleman::Extensions::AssetHash < ::Middleman::Extension
- option :sources, %w(.css .htm .html .js .php .xhtml), 'List of extensions that are searched for hashable assets.'
- option :exts, nil, 'List of extensions that get asset hashes appended to them.'
+ option :sources, %w(.htm .html .php .css .js), 'List of extensions that are searched for hashable assets.'
+ option :exts, %w(.jpg .jpeg .png .gif .webp .js .css .otf .woff .woff2 .eot .ttf .svg .svgz), 'List of extensions that get asset hashes appended to them.'
option :ignore, [], 'Regexes of filenames to skip adding asset hashes to'
option :rewrite_ignore, [], 'Regexes of filenames to skip processing for path rewrites'
- option :prefix, '', 'Prefix for hash'
def initialize(app, options_hash={}, &block)
super
@@ -18,12 +17,8 @@ class Middleman::Extensions::AssetHash < ::Middleman::Extension
# Allow specifying regexes to ignore, plus always ignore apple touch icons
@ignore = Array(options.ignore) + [/^apple-touch-icon/]
- # Exclude .ico from the default list because browsers expect it
- # to be named "favicon.ico"
- @exts = options.exts || (app.config[:asset_extensions] - %w(.ico))
-
app.rewrite_inline_urls id: :asset_hash,
- url_extensions: @exts.sort.reverse,
+ url_extensions: options.exts.sort.reverse,
source_extensions: options.sources,
ignore: @ignore,
rewrite_ignore: options.rewrite_ignore,
@@ -33,7 +28,7 @@ class Middleman::Extensions::AssetHash < ::Middleman::Extension
Contract String, Or[String, Pathname], Any => Maybe[String]
def rewrite_url(asset_path, dirpath, _request_path)
- uri = ::Middleman::Util.parse_uri(asset_path)
+ uri = ::Addressable::URI.parse(asset_path)
relative_path = !uri.path.start_with?('/')
full_asset_path = if relative_path
@@ -75,7 +70,7 @@ class Middleman::Extensions::AssetHash < ::Middleman::Extension
Contract IsA['Middleman::Sitemap::Resource'] => Maybe[IsA['Middleman::Sitemap::Resource']]
def manipulate_single_resource(resource)
- return unless @exts.include?(resource.ext)
+ return unless options.exts.include?(resource.ext)
return if ignored_resource?(resource)
return if resource.ignored?
@@ -93,7 +88,7 @@ class Middleman::Extensions::AssetHash < ::Middleman::Extension
::Digest::SHA1.hexdigest(response.body)[0..7]
end
- resource.destination_path = resource.destination_path.sub(/\.(\w+)$/) { |ext| "-#{options.prefix}#{digest}#{ext}" }
+ resource.destination_path = resource.destination_path.sub(/\.(\w+)$/) { |ext| "-#{digest}#{ext}" }
resource
end
diff --git a/middleman-core/lib/middleman-core/extensions/asset_host.rb b/middleman-core/lib/middleman-core/extensions/asset_host.rb
index 7cb83d07..00d463fa 100644
--- a/middleman-core/lib/middleman-core/extensions/asset_host.rb
+++ b/middleman-core/lib/middleman-core/extensions/asset_host.rb
@@ -2,8 +2,8 @@ require 'addressable/uri'
class Middleman::Extensions::AssetHost < ::Middleman::Extension
option :host, nil, 'The asset host to use or a Proc to determine asset host', required: true
- option :exts, nil, 'List of extensions that get cache busters strings appended to them.'
- option :sources, %w(.css .htm .html .js .php .xhtml), 'List of extensions that are searched for bustable assets.'
+ option :exts, %w(.css .png .jpg .jpeg .webp .svg .svgz .js .gif), 'List of extensions that get cache busters strings appended to them.'
+ option :sources, %w(.htm .html .php .css .js), 'List of extensions that are searched for bustable assets.'
option :ignore, [], 'Regexes of filenames to skip adding query strings to'
option :rewrite_ignore, [], 'Regexes of filenames to skip processing for host rewrites'
@@ -11,7 +11,7 @@ class Middleman::Extensions::AssetHost < ::Middleman::Extension
super
app.rewrite_inline_urls id: :asset_host,
- url_extensions: options.exts || app.config[:asset_extensions],
+ url_extensions: options.exts,
source_extensions: options.sources,
ignore: options.ignore,
rewrite_ignore: options.rewrite_ignore,
@@ -20,7 +20,7 @@ class Middleman::Extensions::AssetHost < ::Middleman::Extension
Contract String, Or[String, Pathname], Any => String
def rewrite_url(asset_path, dirpath, _request_path)
- uri = ::Middleman::Util.parse_uri(asset_path)
+ uri = ::Addressable::URI.parse(asset_path)
relative_path = uri.path[0..0] != '/'
full_asset_path = if relative_path
@@ -37,5 +37,4 @@ class Middleman::Extensions::AssetHost < ::Middleman::Extension
File.join(asset_prefix, full_asset_path)
end
- memoize :rewrite_url
end
diff --git a/middleman-core/lib/middleman-core/extensions/automatic_image_sizes.rb b/middleman-core/lib/middleman-core/extensions/automatic_image_sizes.rb
index 5d12501f..5bd0f14d 100644
--- a/middleman-core/lib/middleman-core/extensions/automatic_image_sizes.rb
+++ b/middleman-core/lib/middleman-core/extensions/automatic_image_sizes.rb
@@ -19,7 +19,7 @@ class Middleman::Extensions::AutomaticImageSizes < ::Middleman::Extension
real_path = path.dup
real_path = File.join(config[:images_dir], real_path) unless real_path.start_with?('/')
- file = app.files.find(:source, real_path) || app.files.find(:source, real_path.sub(/^\//, ''))
+ file = app.files.find(:source, real_path) || app.files.find(:source, real_path.gsub(/^\//, ''))
if file && file[:full_path].exist?
begin
diff --git a/middleman-core/lib/middleman-core/extensions/cache_buster.rb b/middleman-core/lib/middleman-core/extensions/cache_buster.rb
index 2de11632..44eda9bc 100644
--- a/middleman-core/lib/middleman-core/extensions/cache_buster.rb
+++ b/middleman-core/lib/middleman-core/extensions/cache_buster.rb
@@ -1,7 +1,7 @@
# The Cache Buster extension
class Middleman::Extensions::CacheBuster < ::Middleman::Extension
- option :exts, nil, 'List of extensions that get cache busters strings appended to them.'
- option :sources, %w(.css .htm .html .js .php .xhtml), 'List of extensions that are searched for bustable assets.'
+ option :exts, %w(.css .png .jpg .jpeg .webp .svg .svgz .js .gif), 'List of extensions that get cache busters strings appended to them.'
+ option :sources, %w(.htm .html .php .css .js), 'List of extensions that are searched for bustable assets.'
option :ignore, [], 'Regexes of filenames to skip adding query strings to'
option :rewrite_ignore, [], 'Regexes of filenames to skip processing for path rewrites'
@@ -9,7 +9,7 @@ class Middleman::Extensions::CacheBuster < ::Middleman::Extension
super
app.rewrite_inline_urls id: :cache_buster,
- url_extensions: options.exts || app.config[:asset_extensions],
+ url_extensions: options.exts,
source_extensions: options.sources,
ignore: options.ignore,
rewrite_ignore: options.rewrite_ignore,
diff --git a/middleman-core/lib/middleman-core/extensions/directory_indexes.rb b/middleman-core/lib/middleman-core/extensions/directory_indexes.rb
index cef88868..171b1493 100644
--- a/middleman-core/lib/middleman-core/extensions/directory_indexes.rb
+++ b/middleman-core/lib/middleman-core/extensions/directory_indexes.rb
@@ -11,22 +11,16 @@ class Middleman::Extensions::DirectoryIndexes < ::Middleman::Extension
index_file = app.config[:index_file]
new_index_path = "/#{index_file}"
- extensions = %w(.htm .html .php .xhtml)
-
resources.each do |resource|
# Check if it would be pointless to reroute
next if resource.destination_path == index_file ||
resource.destination_path.end_with?(new_index_path) ||
- !extensions.include?(resource.ext)
+ File.extname(index_file) != resource.ext
# Check if file metadata (options set by "page" in config.rb or frontmatter) turns directory_index off
next if resource.options[:directory_index] == false
- extensions.each do |ext|
- resource.destination_path = resource.destination_path.chomp(ext)
- end
-
- resource.destination_path += new_index_path
+ resource.destination_path = resource.destination_path.chomp(File.extname(index_file)) + new_index_path
end
end
end
diff --git a/middleman-core/lib/middleman-core/extensions/external_pipeline.rb b/middleman-core/lib/middleman-core/extensions/external_pipeline.rb
index ae5e4c3c..6b51d944 100644
--- a/middleman-core/lib/middleman-core/extensions/external_pipeline.rb
+++ b/middleman-core/lib/middleman-core/extensions/external_pipeline.rb
@@ -10,79 +10,33 @@ class Middleman::Extensions::ExternalPipeline < ::Middleman::Extension
def initialize(app, config={}, &block)
super
- return if app.mode?(:config)
-
- require 'servolux'
require 'thread'
- require 'fileutils'
-
- source_path = File.expand_path(options[:source], app.root)
-
- # Make sure it exists, or `listen` will explode.
- ::FileUtils.mkdir_p(source_path)
@watcher = app.files.watch :source,
- path: source_path,
+ path: File.expand_path(options[:source], app.root),
latency: options[:latency],
frontmatter: false
- @current_thread = nil
- app.reload(&method(:reload!))
-
logger.info "== Executing: `#{options[:command]}`"
if app.build? || options[:disable_background_execution]
- watch_command!(false)
-
- @watcher.poll_once!
+ watch_command!
else
- watch_command!(true)
+ ::Thread.new { watch_command! }
end
end
- def reload!
- if @current_thread
- logger.info "== Stopping: `#{options[:command]}`"
-
- @current_thread.stop
- @current_thread = nil
- end
- end
-
- def watch_command!(async)
- @current_thread = ::Servolux::Child.new(
- command: options[:command],
- suspend: 2
- )
-
- @current_thread.start
-
- watch_thread = Thread.new do
- while buf = @current_thread.io.gets
+ def watch_command!
+ ::IO.popen(options[:command], 'r') do |pipe|
+ while buf = pipe.gets
without_newline = buf.sub(/\n$/, '')
- logger.info "== External: #{without_newline}" unless without_newline.empty?
- end
-
- @current_thread.wait
-
- if !@current_thread.exitstatus.nil? && @current_thread.exitstatus != 0
- logger.error '== External: Command failed with non-zero exit status'
- exit(1)
+ logger.info "== External: #{without_newline}" if without_newline.length > 0
end
end
- watch_thread.join unless async
+ @watcher.poll_once!
rescue ::Errno::ENOENT => e
logger.error "== External: Command failed with message: #{e.message}"
exit(1)
end
-
- private
-
- def print_command(stdout)
- while buf = stdout.gets
- without_newline = buf.sub(/\n$/, '')
- logger.info "== External: #{without_newline}" unless without_newline.empty?
- end
- end
end
diff --git a/middleman-core/lib/middleman-core/extensions/gzip.rb b/middleman-core/lib/middleman-core/extensions/gzip.rb
index 0483fe32..12079ab5 100644
--- a/middleman-core/lib/middleman-core/extensions/gzip.rb
+++ b/middleman-core/lib/middleman-core/extensions/gzip.rb
@@ -7,10 +7,10 @@
# to serve your Gzipped files whenever the normal (non-.gz) filename is requested.
#
# Pass the :exts options to customize which file extensions get zipped (defaults
-# to .css, .htm, .html, .js, and .xhtml
+# to .html, .htm, .js and .css.
#
class Middleman::Extensions::Gzip < ::Middleman::Extension
- option :exts, %w(.css .htm .html .js .svg .xhtml), 'File extensions to Gzip when building.'
+ option :exts, %w(.js .css .html .htm .svg), 'File extensions to Gzip when building.'
option :ignore, [], 'Patterns to avoid gzipping'
option :overwrite, false, 'Overwrite original files instead of adding .gz extension.'
diff --git a/middleman-core/lib/middleman-core/extensions/minify_css.rb b/middleman-core/lib/middleman-core/extensions/minify_css.rb
index aca9c60b..caf54262 100644
--- a/middleman-core/lib/middleman-core/extensions/minify_css.rb
+++ b/middleman-core/lib/middleman-core/extensions/minify_css.rb
@@ -1,5 +1,3 @@
-require 'active_support/core_ext/object/try'
-require 'memoist'
require 'middleman-core/contracts'
# Minify CSS Extension
@@ -25,14 +23,13 @@ class Middleman::Extensions::MinifyCss < ::Middleman::Extension
class SassCompressor
def self.compress(style, options={})
root_node = ::Sass::SCSS::CssParser.new(style, 'middleman-css-input', 1).parse
- root_node.options = {}.merge!(options).merge!(style: :compressed)
+ root_node.options = options.merge(style: :compressed)
root_node.render.strip
end
end
# Rack middleware to look for CSS and compress it
class Rack
- extend Memoist
include Contracts
INLINE_CSS_REGEX = /(