diff --git a/.rubocop.yml b/.rubocop.yml
index c92b709f..dbd74993 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -67,5 +67,3 @@ Style/MultilineBlockChain:
Enabled: false
Style/SpecialGlobalVars:
Enabled: false
-Style/FrozenStringLiteralComment:
- Enabled: false
diff --git a/.travis.yml b/.travis.yml
index ac5a7f06..42c2903d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,14 +5,17 @@ before_script:
- bundle update
rvm:
- ruby-head
- - 2.3.1
+ - 2.3.0
- 2.2.4
+ - 2.1
+ - 2.0
os:
- linux
# - osx
matrix:
fast_finish: true
allow_failures:
+ - rvm: 2.3.0
- rvm: ruby-head
env:
global:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 148aa2e2..f81321ad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,42 +1,6 @@
master
===
-# 4.1.13
-
-* Change how config options are passed to Thor. Removes new Thor warnings from #2017
-
-# 4.1.12
-
-* Fix broken `ignore { |p| true }` form.
-
-# 4.1.11
-
-* Upgrade to Rack 2.
-
-# 4.1.10
-
-* Fix unicode issues in URL deeplinks.
-* Add prefix option to asset_hash (#1949)
-
-# 4.1.9
-
-* Fix `--watcher-*` CLI flags.
-* Allow spaces in paths to work with `link_to`. Fixes #1914
-* Add support for dotenv
-* Fix asset_url with asset_hash (#1919)
-* Allow partial lookups without a current_resource (#1912)
-
-# 4.1.8
-
-* Expose `development?` and `production?` helpers to template context.
-* require the `try` core extension (#1911)
-* Fix contract for Sitemap::Store.register_resource_list_manipulator (#1907)
-* Loosen contract on Resource#source_file to Maybe[String] (#1906)
-* Let collection loops access ConfigContext for helpers. #1879
-* Use https:// to clone templates (#1901)
-* Allow numbers to be unique page_ids (#1886)
-* Prevent infinite loop when encountering files where base filename is a possible templating engine
-
# 4.1.7
* Upgrade fastimage to 2.0
diff --git a/Gemfile b/Gemfile
index db4043a0..f14eb3b1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -9,12 +9,6 @@ gem 'byebug'
gem 'aruba', '~> 0.7.4', require: false
gem 'rspec', '~> 3.0', require: false
gem 'cucumber', '~> 2.0', require: false
-gem 'addressable', '~> 2.4.0', require: false
-
-# Pry tools
-gem 'pry'
-gem 'pry-stack_explorer'
-gem 'pry-rescue'
# Optional middleman dependencies, included for tests
gem 'haml', '>= 4.0.5', require: false
@@ -24,7 +18,7 @@ gem 'kramdown', '~> 1.2', require: false
gem 'slim', '>= 2.0', require: false
gem 'liquid', '>= 2.6', require: false
gem 'stylus', '>= 1.0', require: false
-gem 'sinatra', '>= 2.0.0.beta2', require: false
+gem 'sinatra', '>= 1.4', require: false
gem 'redcarpet', '>= 3.1', require: false
# Dns server to test preview server
@@ -32,7 +26,7 @@ gem 'rubydns', '~> 1.0.1', require: false
# To test javascript
gem 'poltergeist', '~> 1.8', require: false
-gem 'phantomjs', '~> 2.1.1.0', require: false
+gem 'phantomjs', '~> 1.9.8.0', require: false
# For less, note there is no compatible JS runtime for windows
gem 'therubyrhino', '>= 2.0', platforms: :jruby
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
deleted file mode 100644
index 6d2dc0e0..00000000
--- a/ISSUE_TEMPLATE.md
+++ /dev/null
@@ -1,9 +0,0 @@
-## Expected behavior and actual behavior
-
-## Steps to reproduce the problem (from a clean middleman installation)
-
-## Additional information
-
-- Ruby version:
-- Middleman version:
-- OS version:
diff --git a/README.md b/README.md
index df4497f7..55b81cc1 100644
--- a/README.md
+++ b/README.md
@@ -121,6 +121,6 @@ Copyright (c) 2010-2015 Thomas Reynolds. MIT Licensed, see [LICENSE] for details
[codeclimate]: https://codeclimate.com/github/middleman/middleman
[gittip]: https://www.gittip.com/middleman/
[rubyinstaller]: http://rubyinstaller.org/
-[RubyInstaller-Devkit]: http://rubyinstaller.org/add-ons/devkit/
+[RubyInstaller-Devkit]: http:rubyinstaller.org/add-ons/devkit/
[rubydoc]: http://rubydoc.info/github/middleman/middleman
[LICENSE]: https://github.com/middleman/middleman/blob/master/LICENSE.md
diff --git a/middleman-cli/bin/middleman b/middleman-cli/bin/middleman
index 8b381a08..b5d1921d 100755
--- a/middleman-cli/bin/middleman
+++ b/middleman-cli/bin/middleman
@@ -9,9 +9,6 @@ end
require "middleman-core/load_paths"
Middleman.setup_load_paths
-require 'dotenv'
-::Dotenv.load
-
require 'middleman-core'
require 'middleman-core/logger'
@@ -25,10 +22,12 @@ module Middleman::Cli
if setting.default.is_a?(String) || setting.default.is_a?(NilClass)
base.class_option setting.key,
type: :string,
+ default: :undefined,
desc: setting.description
elsif setting.default.is_a?(TrueClass) || setting.default.is_a?(FalseClass)
base.class_option setting.key,
type: :boolean,
+ default: :undefined,
desc: setting.description
end
end
@@ -47,8 +46,6 @@ end
::Middleman::Logger.singleton(3)
::Middleman::Cli.config = ::Middleman::Application.new do
- #
- config[:environment] = (ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development').to_sym
config[:mode] = :config
config[:exit_before_ready] = true
config[:watcher_disable] = true
diff --git a/middleman-cli/lib/middleman-cli/build.rb b/middleman-cli/lib/middleman-cli/build.rb
index 9e521dde..7d5dd3af 100644
--- a/middleman-cli/lib/middleman-cli/build.rb
+++ b/middleman-cli/lib/middleman-cli/build.rb
@@ -10,7 +10,7 @@ module Middleman::Cli
class_option :environment,
aliases: '-e',
- default: ENV['MM_ENV'] || ENV['RACK_ENV'] || :production
+ default: :production
class_option :clean,
type: :boolean,
default: true,
@@ -29,7 +29,7 @@ module Middleman::Cli
default: false,
desc: 'Print debug messages'
class_option :instrument,
- type: :boolean,
+ type: :string,
default: false,
desc: 'Print instrument messages'
class_option :profile,
@@ -64,7 +64,7 @@ module Middleman::Cli
config[:mode] = :build
config[:show_exceptions] = false
config[:cli_options] = cli_options.each_with_object({}) do |(k, v), sum|
- sum[k] = v
+ sum[k] = v unless v == :undefined
end
end
diff --git a/middleman-cli/lib/middleman-cli/init.rb b/middleman-cli/lib/middleman-cli/init.rb
index e8e5770c..f1c1927e 100644
--- a/middleman-cli/lib/middleman-cli/init.rb
+++ b/middleman-cli/lib/middleman-cli/init.rb
@@ -113,7 +113,7 @@ module Middleman::Cli
end
def repository_path(repo)
- repo.include?('://') || repo.include?('git@') ? repo : "https://github.com/#{repo}.git"
+ repo.include?('://') || repo.include?('git@') ? repo : "git://github.com/#{repo}.git"
end
# Add to CLI
diff --git a/middleman-cli/lib/middleman-cli/server.rb b/middleman-cli/lib/middleman-cli/server.rb
index 85e75a9f..479f53bd 100644
--- a/middleman-cli/lib/middleman-cli/server.rb
+++ b/middleman-cli/lib/middleman-cli/server.rb
@@ -17,7 +17,7 @@ module Middleman::Cli
default: false,
desc: 'Print debug messages'
class_option :instrument,
- type: :boolean,
+ type: :string,
default: false,
desc: 'Print instrument messages'
class_option :profile,
diff --git a/middleman-cli/middleman-cli.gemspec b/middleman-cli/middleman-cli.gemspec
index e9447a9c..f2719efc 100644
--- a/middleman-cli/middleman-cli.gemspec
+++ b/middleman-cli/middleman-cli.gemspec
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -z -- {fixtures,features}/*`.split("\0")
s.executable = 'middleman'
s.require_path = 'lib'
- s.required_ruby_version = '>= 2.2.0'
+ s.required_ruby_version = '>= 2.0.0'
# CLI
s.add_dependency('thor', ['>= 0.17.0', '< 2.0'])
diff --git a/middleman-core/features/asset_hash.feature b/middleman-core/features/asset_hash.feature
index 7c173800..19517e3b 100644
--- a/middleman-core/features/asset_hash.feature
+++ b/middleman-core/features/asset_hash.feature
@@ -308,17 +308,3 @@ Feature: Assets get file hashes appended to them and references to them are upda
| javascripts/application.js.map |
And the file "javascripts/application-4553338c.js" should contain "//# sourceMappingURL=application.js-22cc2b5f.map"
-
- Scenario: Hashes can contain a prefix
- Given a successfully built app at "asset-hash-prefix"
- When I cd to "build"
- Then the following files should exist:
- | index.html |
- | javascripts/application-myprefix-4553338c.js |
- | javascripts/application.js-myprefix-22cc2b5f.map |
- | index.html |
- And the following files should not exist:
- | javascripts/application.js |
- | javascripts/application.js.map |
-
- And the file "javascripts/application-myprefix-4553338c.js" should contain "//# sourceMappingURL=application.js-myprefix-22cc2b5f.map"
diff --git a/middleman-core/features/asset_host.feature b/middleman-core/features/asset_host.feature
index 0433b61b..646f1154 100644
--- a/middleman-core/features/asset_host.feature
+++ b/middleman-core/features/asset_host.feature
@@ -25,8 +25,7 @@ Feature: Alternate between multiple asset hosts
And a file named "config.rb" with:
"""
activate :asset_host, host: Proc.new { |asset|
- hash = Digest::MD5.digest(asset).bytes.map!(&:ord).reduce(&:+)
- "http://assets%d.example.com" % (hash % 4)
+ "http://assets%d.example.com" % (asset.hash % 4)
}
"""
And the Server is running
diff --git a/middleman-core/features/collections.feature b/middleman-core/features/collections.feature
index 2d313a3c..e12ca0a5 100644
--- a/middleman-core/features/collections.feature
+++ b/middleman-core/features/collections.feature
@@ -144,33 +144,6 @@ Feature: Collections
And I should see 'Article: Blog3 Another Article'
And I should see 'Article: Blog2 Yet Another Article'
- Scenario: Work with local helpers
- Given a fixture app "collections-app"
- And a file named "config.rb" with:
- """
- module TestHelper
- def help_me
- "ok"
- end
- end
-
- include TestHelper
-
- data.articles.each_with_index do |a, i|
- proxy "/#{i}-#{help_me}.html", a
- end
- """
- And a file named "data/articles.yaml" with:
- """
- ---
- - "/blog1/2011-01-01-new-article.html"
- - "/blog2/2011-01-02-another-article.html"
- """
- Given the Server is running at "collections-app"
- When I go to "0-ok.html"
- Then I should see 'Newer Article Content'
- When I go to "1-ok.html"
- Then I should see 'Another Article Content'
Scenario: Collected data update with file changes
Given a fixture app "collections-app"
diff --git a/middleman-core/features/helpers_link_to.feature b/middleman-core/features/helpers_link_to.feature
index fe8e8530..90b6f08a 100644
--- a/middleman-core/features/helpers_link_to.feature
+++ b/middleman-core/features/helpers_link_to.feature
@@ -40,29 +40,19 @@ Feature: link_to helper
"""
absolute: <%= link_to "Needs Index", "/needs_index.html", relative: true %>
relative: <%= link_to "Relative", "needs_index.html", relative: true %>
-
- absolute spaces: <%= link_to "Spaces Index", "/evil spaces.html", relative: true %>
- relative spaces: <%= link_to "Spaces Relative", "evil spaces.html", relative: true %>
"""
And a file named "source/link_to/sub.html.erb" with:
"""
absolute: <%= link_to "Needs Index", "/needs_index.html", relative: true %>
relative: <%= link_to "Relative", "../needs_index.html", relative: true %>
-
- absolute spaces: <%= link_to "Spaces Index", "/evil spaces.html", relative: true %>
- relative spaces: <%= link_to "Spaces Relative", "../evil spaces.html", relative: true %>
"""
And the Server is running at "indexable-app"
When I go to "/link_to.html"
Then I should see 'absolute: Needs Index'
Then I should see 'relative: Relative'
- Then I should see 'absolute spaces: Spaces Index'
- Then I should see 'relative spaces: Spaces Relative'
When I go to "/link_to/sub.html"
Then I should see 'absolute: Needs Index'
Then I should see 'relative: Relative'
- Then I should see 'absolute spaces: Spaces Index'
- Then I should see 'relative spaces: Spaces Relative'
Scenario: link_to relative works with strip_index_file
Given a fixture app "indexable-app"
@@ -123,7 +113,7 @@ Feature: link_to helper
When I go to "/link_to/sub.html"
Then I should see 'absolute: Needs Index'
Then I should see 'relative: Relative'
-
+
Scenario: link_to knows about directory indexes
Given a fixture app "indexable-app"
And a file named "source/link_to.html.erb" with:
diff --git a/middleman-core/features/i18n_link_to.feature b/middleman-core/features/i18n_link_to.feature
index 9d3f0682..a10787c4 100644
--- a/middleman-core/features/i18n_link_to.feature
+++ b/middleman-core/features/i18n_link_to.feature
@@ -4,7 +4,7 @@ Feature: i18n Paths
Given a fixture app "empty-app"
And a file named "data/pages.yml" with:
"""
- - hello.html
+ - hello.html
"""
And a file named "locales/en.yml" with:
"""
@@ -50,24 +50,24 @@ Feature: i18n Paths
Given the Server is running at "empty-app"
When I go to "/hello.html"
Then I should see "Page: Hello"
- Then I should see 'Current Home'
- Then I should see 'Other Home'
- Then I should see 'Home: Current Block'
- Then I should see 'Home: Other Block'
- Then I should see 'Current hello.html'
- Then I should see 'Other hello.html'
- Then I should see 'Current Block'
- Then I should see 'Other Block'
+ Then I should see 'Current Home'
+ Then I should see 'Other Home'
+ Then I should see 'Home: Current Block'
+ Then I should see 'Home: Other Block'
+ Then I should see 'Current hello.html'
+ Then I should see 'Other hello.html'
+ Then I should see 'Current Block'
+ Then I should see 'Other Block'
When I go to "/es/hola.html"
Then I should see "Page: Hola"
- Then I should see 'Current Home'
- Then I should see 'Other Home'
- Then I should see 'Home: Current Block'
- Then I should see 'Home: Other Block'
- Then I should see 'Current hello.html'
- Then I should see 'Other hello.html'
- Then I should see 'Current Block'
- Then I should see 'Other Block'
+ Then I should see 'Current Home'
+ Then I should see 'Other Home'
+ Then I should see 'Home: Current Block'
+ Then I should see 'Home: Other Block'
+ Then I should see 'Current hello.html'
+ Then I should see 'Other hello.html'
+ Then I should see 'Current Block'
+ Then I should see 'Other Block'
Scenario: link_to is i18n aware and supports relative_links
Given a fixture app "empty-app"
@@ -124,30 +124,30 @@ Feature: i18n Paths
Then I should see "assets/css/main.css"
When I go to "/hello.html"
Then I should see "Page: Hello"
- Then I should see 'Current Home'
- Then I should see 'Other Home'
- Then I should see 'Home: Current Block'
- Then I should see 'Home: Other Block'
- Then I should see 'Current hello.html'
- Then I should see 'Other hello.html'
- Then I should see 'Current Block'
- Then I should see 'Other Block'
+ Then I should see 'Current Home'
+ Then I should see 'Other Home'
+ Then I should see 'Home: Current Block'
+ Then I should see 'Home: Other Block'
+ Then I should see 'Current hello.html'
+ Then I should see 'Other hello.html'
+ Then I should see 'Current Block'
+ Then I should see 'Other Block'
When I go to "/es/hola.html"
Then I should see "Page: Hola"
- Then I should see 'Current Home'
- Then I should see 'Other Home'
- Then I should see 'Home: Current Block'
- Then I should see 'Home: Other Block'
- Then I should see 'Current hello.html'
- Then I should see 'Other hello.html'
- Then I should see 'Current Block'
- Then I should see 'Other Block'
+ Then I should see 'Current Home'
+ Then I should see 'Other Home'
+ Then I should see 'Home: Current Block'
+ Then I should see 'Home: Other Block'
+ Then I should see 'Current hello.html'
+ Then I should see 'Other hello.html'
+ Then I should see 'Current Block'
+ Then I should see 'Other Block'
Scenario: url_for is i18n aware
Given a fixture app "empty-app"
And a file named "data/pages.yml" with:
"""
- - hello.html
+ - hello.html
- article.html
"""
And a file named "locales/en.yml" with:
diff --git a/middleman-core/features/markdown_redcarpet_in_slim.feature b/middleman-core/features/markdown_redcarpet_in_slim.feature
deleted file mode 100644
index 250c6857..00000000
--- a/middleman-core/features/markdown_redcarpet_in_slim.feature
+++ /dev/null
@@ -1,41 +0,0 @@
-Feature: Markdown support in Slim
- In order to test support of the Slim markdown filter
-
- Scenario: Markdown filter in Slim works
- Given a fixture app "markdown-in-slim-app"
- And a file named "config.rb" with:
- """
- set :markdown_engine, :redcarpet
- activate :directory_indexes
- """
- And a file named "source/markdown_filter.html.slim" with:
- """
- markdown:
- # H1
-
- paragraph
- """
- Given the Server is running at "markdown-in-slim-app"
- When I go to "/markdown_filter/"
- Then I should see ">H1"
- Then I should see "
paragraph
"
-
-
- Scenario: Markdown filter in Slim uses our link_to and image_tag helpers
- Given a fixture app "markdown-in-slim-app"
- And a file named "config.rb" with:
- """
- set :markdown_engine, :redcarpet
- activate :directory_indexes
- """
- And a file named "source/link_and_image.html.slim" with:
- """
- markdown:
- [A link](/link_target.html)
-
- 
- """
- Given the Server is running at "markdown-in-slim-app"
- When I go to "/link_and_image/"
- Then I should see "/link_target/"
- Then I should see 'src="/images/blank.gif"'
diff --git a/middleman-core/features/page-id.feature b/middleman-core/features/page-id.feature
index 74d08cb5..63dd6fad 100644
--- a/middleman-core/features/page-id.feature
+++ b/middleman-core/features/page-id.feature
@@ -3,60 +3,14 @@ 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"
+ Then I should see "I am: index.html"
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"
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-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/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/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/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
index 6060bc3f..8f2997b6 100644
--- a/middleman-core/fixtures/page-id-app/source/index.html.erb
+++ b/middleman-core/fixtures/page-id-app/source/index.html.erb
@@ -4,11 +4,3 @@ 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/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/application.rb b/middleman-core/lib/middleman-core/application.rb
index 52b31c92..379d1e81 100644
--- a/middleman-core/lib/middleman-core/application.rb
+++ b/middleman-core/lib/middleman-core/application.rb
@@ -203,7 +203,6 @@ module Middleman
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
@@ -267,8 +266,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
@@ -279,6 +276,8 @@ module Middleman
# Before config is parsed, before extensions get to it.
execute_callbacks(:initialized)
+ apply_cli_options
+
# Before config is parsed. Mostly used for extensions.
execute_callbacks(:before_configuration)
@@ -345,11 +344,11 @@ module Middleman
# Clean up missing Tilt exts
def prune_tilt_templates!
- ::Tilt.default_mapping.lazy_map.each_key do |key|
+ ::Tilt.mappings.each_key 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/config_context.rb b/middleman-core/lib/middleman-core/config_context.rb
index 3ee98632..d140e8ea 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)
@@ -23,7 +23,7 @@ module Middleman
end
def include(mod)
- extend(mod)
+ self.extend(mod)
end
def helpers(*helper_modules, &block)
diff --git a/middleman-core/lib/middleman-core/core_extensions/collections.rb b/middleman-core/lib/middleman-core/core_extensions/collections.rb
index b915fffd..22e6d281 100644
--- a/middleman-core/lib/middleman-core/core_extensions/collections.rb
+++ b/middleman-core/lib/middleman-core/core_extensions/collections.rb
@@ -90,7 +90,7 @@ module Middleman
pair[:root].realize!(dataset)
end
- ctx = StepContext.new(app)
+ ctx = StepContext.new
StepContext.current = ctx
leaves = @leaves.dup
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..0b17870d 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
@@ -12,20 +12,17 @@ module Middleman
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/default_helpers.rb b/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb
index 774522db..33b411e1 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.
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..49f4195f 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,18 @@ 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]
- )
- 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/inline_url_rewriter.rb b/middleman-core/lib/middleman-core/core_extensions/inline_url_rewriter.rb
index 43354e97..14cf4715 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, @middleman_app) do |asset_path|
+ uri = ::Addressable::URI.parse(asset_path)
relative_path = uri.host.nil?
@@ -108,7 +106,7 @@ 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] || [])
next if rewrite_ignore.any? { |i| ::Middleman::Util.path_match(i, path) }
@@ -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 =~ validator)
+ 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/extension.rb b/middleman-core/lib/middleman-core/extension.rb
index 9805455a..8f342e69 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
@@ -513,7 +510,7 @@ module Middleman
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)
+ self.descriptors << r if r.respond_to?(:execute_descriptor)
end
end
end
diff --git a/middleman-core/lib/middleman-core/extensions/asset_hash.rb b/middleman-core/lib/middleman-core/extensions/asset_hash.rb
index 3e2a02aa..b38bab9f 100644
--- a/middleman-core/lib/middleman-core/extensions/asset_hash.rb
+++ b/middleman-core/lib/middleman-core/extensions/asset_hash.rb
@@ -6,7 +6,6 @@ class Middleman::Extensions::AssetHash < ::Middleman::Extension
option :exts, nil, '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
@@ -33,7 +32,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
@@ -93,7 +92,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..f7c7e8fc 100644
--- a/middleman-core/lib/middleman-core/extensions/asset_host.rb
+++ b/middleman-core/lib/middleman-core/extensions/asset_host.rb
@@ -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/minify_css.rb b/middleman-core/lib/middleman-core/extensions/minify_css.rb
index aca9c60b..cc513b6c 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
@@ -32,7 +30,6 @@ class Middleman::Extensions::MinifyCss < ::Middleman::Extension
# Rack middleware to look for CSS and compress it
class Rack
- extend Memoist
include Contracts
INLINE_CSS_REGEX = /(