middleman-core 3.0.0 → 3.0.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.cane +2 -0
- data/.cane-exclusions.yml +5 -0
- data/Rakefile +1 -1
- data/bin/middleman +9 -55
- data/features/cli_extension.feature +1 -0
- data/features/frontmatter_page_settings.feature +11 -1
- data/features/instance_vars.feature +9 -0
- data/features/step_definitions/page_layout_steps.rb +3 -3
- data/features/strip_url.feature +40 -0
- data/features/support/env.rb +1 -1
- data/fixtures/automatic-directory-matcher-app/config.rb +1 -1
- data/fixtures/basic-data-app/config.rb +1 -1
- data/fixtures/build-with-errors-app/config.rb +1 -1
- data/fixtures/clean-app/config-complications.rb +1 -1
- data/fixtures/clean-app/config.rb +1 -1
- data/fixtures/current-page-app/config.rb +1 -1
- data/fixtures/custom-layout-app/config.rb +1 -1
- data/fixtures/data-app/config.rb +1 -1
- data/fixtures/external-helpers/config.rb +1 -1
- data/fixtures/external-helpers/helpers/derp.rb +1 -1
- data/fixtures/external-helpers/helpers/four_helpers.rb +1 -1
- data/fixtures/external-helpers/helpers/one_helper.rb +1 -1
- data/fixtures/external-helpers/helpers/yet_another_thingy.rb +1 -1
- data/fixtures/external-helpers/lib/hello_helper.rb +1 -1
- data/fixtures/feature-params-app/config.rb +1 -1
- data/fixtures/frontmatter-settings-app/config.rb +3 -1
- data/fixtures/frontmatter-settings-app/source/layouts/override.erb +2 -0
- data/fixtures/frontmatter-settings-app/source/override_layout.html.erb +4 -0
- data/fixtures/frontmatter-settings-app/source/page_mentioned.html.erb +4 -0
- data/fixtures/generator-test/config.rb +10 -10
- data/fixtures/glob-app/config.rb +1 -1
- data/fixtures/instance-vars-app/config.rb +7 -0
- data/fixtures/instance-vars-app/source/content.html.erb +2 -0
- data/fixtures/instance-vars-app/source/layout.erb +1 -0
- data/fixtures/large-build-app/config.rb +1 -1
- data/fixtures/large-build-app/source/images/Child folder/regular_file(example).txt +1 -1
- data/fixtures/large-build-app/source/images/Read me (example).txt +1 -1
- data/fixtures/manual-layout-missing/config.rb +1 -1
- data/fixtures/manual-layout-override/config.rb +1 -1
- data/fixtures/manual-layout/config.rb +1 -1
- data/fixtures/page-helper-layout-block-app/config.rb +1 -1
- data/fixtures/sinatra-app/config.rb +1 -1
- data/fixtures/strip-url-app/config.rb +0 -0
- data/fixtures/strip-url-app/source/index.html.erb +1 -0
- data/fixtures/strip-url-app/source/other.html.erb +1 -0
- data/fixtures/strip-url-app/source/subdir/index.html.erb +1 -0
- data/fixtures/traversal-app/config.rb +1 -1
- data/fixtures/wildcard-app/config.rb +1 -1
- data/lib/middleman-core.rb +3 -3
- data/lib/middleman-core/application.rb +12 -11
- data/lib/middleman-core/cli.rb +23 -10
- data/lib/middleman-core/cli/build.rb +65 -54
- data/lib/middleman-core/cli/bundler.rb +7 -7
- data/lib/middleman-core/cli/extension.rb +25 -12
- data/lib/middleman-core/cli/init.rb +19 -19
- data/lib/middleman-core/cli/server.rb +25 -16
- data/lib/middleman-core/core_extensions/builder.rb +3 -3
- data/lib/middleman-core/core_extensions/data.rb +28 -28
- data/lib/middleman-core/core_extensions/extensions.rb +24 -25
- data/lib/middleman-core/core_extensions/external_helpers.rb +7 -7
- data/lib/middleman-core/core_extensions/file_watcher.rb +41 -38
- data/lib/middleman-core/core_extensions/front_matter.rb +36 -33
- data/lib/middleman-core/core_extensions/rendering.rb +49 -46
- data/lib/middleman-core/core_extensions/request.rb +34 -33
- data/lib/middleman-core/core_extensions/routing.rb +17 -17
- data/lib/middleman-core/core_extensions/ruby_encoding.rb +1 -1
- data/lib/middleman-core/core_extensions/show_exceptions.rb +5 -5
- data/lib/middleman-core/extensions.rb +4 -4
- data/lib/middleman-core/load_paths.rb +56 -0
- data/lib/middleman-core/logger.rb +29 -0
- data/lib/middleman-core/preview_server.rb +35 -34
- data/lib/middleman-core/profiling.rb +58 -0
- data/lib/middleman-core/renderers/coffee_script.rb +8 -6
- data/lib/middleman-core/renderers/erb.rb +5 -5
- data/lib/middleman-core/renderers/haml.rb +5 -5
- data/lib/middleman-core/renderers/less.rb +14 -10
- data/lib/middleman-core/renderers/liquid.rb +7 -7
- data/lib/middleman-core/renderers/markdown.rb +13 -14
- data/lib/middleman-core/renderers/redcarpet.rb +31 -11
- data/lib/middleman-core/renderers/sass.rb +38 -22
- data/lib/middleman-core/renderers/slim.rb +15 -7
- data/lib/middleman-core/sitemap.rb +25 -28
- data/lib/middleman-core/sitemap/extensions/ignores.rb +13 -13
- data/lib/middleman-core/sitemap/extensions/on_disk.rb +12 -12
- data/lib/middleman-core/sitemap/extensions/proxies.rb +26 -20
- data/lib/middleman-core/sitemap/extensions/traversal.rb +10 -10
- data/lib/middleman-core/sitemap/resource.rb +47 -50
- data/lib/middleman-core/sitemap/store.rb +38 -36
- data/lib/middleman-core/step_definitions.rb +1 -1
- data/lib/middleman-core/step_definitions/builder_steps.rb +1 -1
- data/lib/middleman-core/step_definitions/middleman_steps.rb +3 -3
- data/lib/middleman-core/step_definitions/server_steps.rb +5 -5
- data/lib/middleman-core/templates.rb +12 -12
- data/lib/middleman-core/templates/default.rb +11 -11
- data/lib/middleman-core/templates/extension/Gemfile +14 -1
- data/lib/middleman-core/templates/extension/Rakefile +3 -1
- data/lib/middleman-core/templates/extension/features/support/env.rb +1 -1
- data/lib/middleman-core/templates/extension/gitignore +2 -0
- data/lib/middleman-core/templates/extension/lib/lib.rb +11 -11
- data/lib/middleman-core/templates/extension/lib/middleman_extension.rb +1 -1
- data/lib/middleman-core/templates/html5.rb +10 -10
- data/lib/middleman-core/templates/html5/source/humans.txt +0 -0
- data/lib/middleman-core/templates/html5/source/robots.txt +0 -0
- data/lib/middleman-core/templates/local.rb +4 -4
- data/lib/middleman-core/templates/mobile.rb +3 -3
- data/lib/middleman-core/templates/mobile/source/humans.txt +0 -0
- data/lib/middleman-core/templates/mobile/source/robots.txt +0 -0
- data/lib/middleman-core/templates/shared/config.ru +1 -1
- data/lib/middleman-core/templates/shared/config.tt +10 -10
- data/lib/middleman-core/util.rb +30 -6
- data/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks.rb +19 -19
- data/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks/inheritable_attribute.rb +2 -2
- data/lib/middleman-core/vendor/hooks-0.2.0/test/hooks_test.rb +29 -29
- data/lib/middleman-core/vendor/hooks-0.2.0/test/inheritable_attribute_test.rb +11 -11
- data/lib/middleman-core/version.rb +1 -1
- data/lib/middleman/rack.rb +4 -0
- data/middleman-core-x86-mingw32.gemspec +38 -0
- data/middleman-core.gemspec +3 -2
- metadata +72 -11
data/.cane
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
style:
|
2
|
+
- lib/middleman-core/vendor/hooks-0.2.0/lib/hooks/inheritable_attribute.rb
|
3
|
+
- lib/middleman-core/vendor/hooks-0.2.0/test/hooks_test.rb
|
4
|
+
- lib/middleman-core/vendor/hooks-0.2.0/test/inheritable_attribute_test.rb
|
5
|
+
- lib/middleman-core/vendor/hooks-0.2.0/lib/hooks.rb
|
data/Rakefile
CHANGED
data/bin/middleman
CHANGED
@@ -7,65 +7,19 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
|
7
7
|
moredir = File.expand_path(File.join(File.dirname(File.dirname(libdir)), "middleman-more", "lib", "middleman-more"))
|
8
8
|
$LOAD_PATH.unshift(moredir) unless $LOAD_PATH.include?(moredir)
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
# Recursive method to find config.rb
|
14
|
-
def locate_root(cwd = Pathname.new(Dir.pwd))
|
15
|
-
return cwd.to_s if (cwd + 'config.rb').exist?
|
16
|
-
return false if cwd.root?
|
17
|
-
locate_root(cwd.parent)
|
18
|
-
end
|
19
|
-
|
20
|
-
# Only look for config.rb if MM_ROOT isn't set
|
21
|
-
if !ENV["MM_ROOT"] && found_path = locate_root
|
22
|
-
ENV["MM_ROOT"] = found_path
|
23
|
-
end
|
24
|
-
|
25
|
-
is_bundler_setup = false
|
26
|
-
|
27
|
-
# If we've found the root, try to setup Bundler
|
28
|
-
if ENV["MM_ROOT"]
|
29
|
-
|
30
|
-
root_gemfile = File.expand_path('Gemfile', ENV["MM_ROOT"])
|
31
|
-
ENV['BUNDLE_GEMFILE'] ||= root_gemfile
|
32
|
-
|
33
|
-
if !File.exists?(ENV['BUNDLE_GEMFILE'])
|
34
|
-
git_gemfile = Pathname.new(__FILE__).expand_path.parent.parent.parent + "Gemfile"
|
35
|
-
ENV['BUNDLE_GEMFILE'] = git_gemfile.to_s
|
36
|
-
end
|
37
|
-
|
38
|
-
if File.exists?(ENV['BUNDLE_GEMFILE'])
|
39
|
-
is_bundler_setup = true
|
40
|
-
require 'bundler/setup'
|
41
|
-
end
|
10
|
+
require 'middleman-core/profiling'
|
11
|
+
if ARGV.include? '--profile'
|
12
|
+
Middleman::Profiling.profiler = Middleman::Profiling::RubyProfProfiler.new
|
42
13
|
end
|
14
|
+
Middleman::Profiling.start
|
43
15
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
if is_bundler_setup
|
48
|
-
Bundler.require
|
49
|
-
else
|
50
|
-
::Middleman.load_extensions_in_path
|
51
|
-
end
|
16
|
+
require "middleman-core/load_paths"
|
17
|
+
Middleman.setup_load_paths
|
52
18
|
|
53
19
|
require "middleman-core/cli"
|
54
20
|
|
55
|
-
# Change
|
56
|
-
|
57
|
-
|
58
|
-
# Default command is server
|
59
|
-
if ARGV[0] != "help" && (ARGV.length < 1 || ARGV.first.include?("-"))
|
60
|
-
ARGV.unshift("server")
|
61
|
-
end
|
21
|
+
# Change directory to the root
|
22
|
+
Dir.chdir(ENV["MM_ROOT"]) if ENV["MM_ROOT"]
|
62
23
|
|
63
24
|
# Start the CLI
|
64
|
-
|
65
|
-
# Change directory to the root
|
66
|
-
Dir.chdir(ENV["MM_ROOT"]) do
|
67
|
-
Middleman::Cli::Base.start
|
68
|
-
end
|
69
|
-
else
|
70
|
-
Middleman::Cli::Base.start
|
71
|
-
end
|
25
|
+
Middleman::Cli::Base.start
|
@@ -6,7 +6,7 @@ Feature: Setting page settings through frontmatter
|
|
6
6
|
And the file "build/alternate_layout.html" should contain "Alternate layout"
|
7
7
|
And the following files should not exist:
|
8
8
|
| build/ignored.html |
|
9
|
-
|
9
|
+
|
10
10
|
Scenario: Setting layout, ignoring, and disabling directory indexes through frontmatter (preview)
|
11
11
|
Given the Server is running at "frontmatter-settings-app"
|
12
12
|
When I go to "/alternate_layout.html"
|
@@ -31,3 +31,13 @@ Feature: Setting page settings through frontmatter
|
|
31
31
|
"""
|
32
32
|
When I go to "/ignored.html"
|
33
33
|
Then I should see "This file is no longer ignored."
|
34
|
+
|
35
|
+
Scenario: Overriding layout through frontmatter
|
36
|
+
Given the Server is running at "frontmatter-settings-app"
|
37
|
+
When I go to "/override_layout.html"
|
38
|
+
Then I should see "Layout in use: Override"
|
39
|
+
|
40
|
+
Scenario: Setting layout through frontmatter even if page is mentioned in config
|
41
|
+
Given the Server is running at "frontmatter-settings-app"
|
42
|
+
When I go to "/page_mentioned.html"
|
43
|
+
Then I should see "Layout in use: Override"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Feature: Instance Variables
|
2
|
+
Scenario: A dynamic page template using instance variables
|
3
|
+
Given the Server is running at "instance-vars-app"
|
4
|
+
When I go to "/a.html"
|
5
|
+
Then I should see "A: 'set'"
|
6
|
+
Then I should see "B: ''"
|
7
|
+
When I go to "/b.html"
|
8
|
+
Then I should see "A: ''"
|
9
|
+
Then I should see "B: 'set'"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Given /^page "([^\"]*)" has layout "([^\"]*)"$/ do |url, layout|
|
2
2
|
@initialize_commands ||= []
|
3
|
-
@initialize_commands << lambda {
|
4
|
-
page(url, :layout => layout.to_sym)
|
3
|
+
@initialize_commands << lambda {
|
4
|
+
page(url, :layout => layout.to_sym)
|
5
5
|
}
|
6
6
|
end
|
7
7
|
|
@@ -12,4 +12,4 @@ Given /^"([^\"]*)" with_layout block has layout "([^\"]*)"$/ do |url, layout|
|
|
12
12
|
page(url)
|
13
13
|
end
|
14
14
|
}
|
15
|
-
end
|
15
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
Feature: Strip the index_file from urls
|
2
|
+
|
3
|
+
Scenario: Default behaviour, strip with trailing slash
|
4
|
+
Given the Server is running at "strip-url-app"
|
5
|
+
When I go to "/"
|
6
|
+
Then I should see "URL: '/'"
|
7
|
+
When I go to "/index.html"
|
8
|
+
Then I should see "URL: '/'"
|
9
|
+
When I go to "/other.html"
|
10
|
+
Then I should see "URL: '/other.html'"
|
11
|
+
When I go to "/subdir/index.html"
|
12
|
+
Then I should see "URL: '/subdir/'"
|
13
|
+
|
14
|
+
Scenario: Trailing slash off
|
15
|
+
Given a fixture app "strip-url-app"
|
16
|
+
And a file named "config.rb" with:
|
17
|
+
"""
|
18
|
+
set :trailing_slash, false
|
19
|
+
"""
|
20
|
+
And the Server is running
|
21
|
+
When I go to "/"
|
22
|
+
Then I should see "URL: '/'"
|
23
|
+
When I go to "/other.html"
|
24
|
+
Then I should see "URL: '/other.html'"
|
25
|
+
When I go to "/subdir/index.html"
|
26
|
+
Then I should see "URL: '/subdir'"
|
27
|
+
|
28
|
+
Scenario: Strip index off
|
29
|
+
Given a fixture app "strip-url-app"
|
30
|
+
And a file named "config.rb" with:
|
31
|
+
"""
|
32
|
+
set :strip_index_file, false
|
33
|
+
"""
|
34
|
+
And the Server is running
|
35
|
+
When I go to "/"
|
36
|
+
Then I should see "URL: '/index.html'"
|
37
|
+
When I go to "/other.html"
|
38
|
+
Then I should see "URL: '/other.html'"
|
39
|
+
When I go to "/subdir/index.html"
|
40
|
+
Then I should see "URL: '/subdir/index.html'"
|
data/features/support/env.rb
CHANGED
@@ -3,4 +3,4 @@ ENV["AUTOLOAD_SPROCKETS"] = "false"
|
|
3
3
|
|
4
4
|
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
|
5
5
|
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-core')
|
6
|
-
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-core', 'step_definitions')
|
6
|
+
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-core', 'step_definitions')
|
@@ -1 +1 @@
|
|
1
|
-
set :automatic_directory_matcher, "--"
|
1
|
+
set :automatic_directory_matcher, "--"
|
@@ -1 +1 @@
|
|
1
|
-
set :layout, false
|
1
|
+
set :layout, false
|
@@ -1 +1 @@
|
|
1
|
-
set :erb, :layout_engine => :str
|
1
|
+
set :erb, :layout_engine => :str
|
data/fixtures/data-app/config.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
###
|
1
|
+
###
|
2
2
|
# Compass
|
3
3
|
###
|
4
4
|
|
@@ -16,13 +16,13 @@
|
|
16
16
|
###
|
17
17
|
|
18
18
|
# Per-page layout changes:
|
19
|
-
#
|
19
|
+
#
|
20
20
|
# With no layout
|
21
21
|
# page "/path/to/file.html", :layout => false
|
22
|
-
#
|
22
|
+
#
|
23
23
|
# With alternative layout
|
24
24
|
# page "/path/to/file.html", :layout => :otherlayout
|
25
|
-
#
|
25
|
+
#
|
26
26
|
# A path which all have the same layout
|
27
27
|
# with_layout :admin do
|
28
28
|
# page "/admin/*"
|
@@ -60,21 +60,21 @@
|
|
60
60
|
configure :build do
|
61
61
|
# For example, change the Compass output style for deployment
|
62
62
|
# activate :minify_css
|
63
|
-
|
63
|
+
|
64
64
|
# Minify Javascript on build
|
65
65
|
# activate :minify_javascript
|
66
|
-
|
66
|
+
|
67
67
|
# Enable cache buster
|
68
68
|
# activate :cache_buster
|
69
|
-
|
69
|
+
|
70
70
|
# Use relative URLs
|
71
71
|
# activate :relative_assets
|
72
|
-
|
72
|
+
|
73
73
|
# Compress PNGs after build
|
74
74
|
# First: gem install middleman-smusher
|
75
75
|
# require "middleman-smusher"
|
76
76
|
# activate :smusher
|
77
|
-
|
77
|
+
|
78
78
|
# Or use a different image path
|
79
79
|
# set :http_path, "/Content/images/"
|
80
|
-
end
|
80
|
+
end
|
data/fixtures/glob-app/config.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
page "/index.html", :layout => false
|
1
|
+
page "/index.html", :layout => false
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -1 +1 @@
|
|
1
|
-
Regular
|
1
|
+
Regular
|
@@ -1 +1 @@
|
|
1
|
-
README
|
1
|
+
README
|
@@ -1 +1 @@
|
|
1
|
-
set :layout, :custom
|
1
|
+
set :layout, :custom
|
@@ -1 +1 @@
|
|
1
|
-
set :layout, :custom
|
1
|
+
set :layout, :custom
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
URL: '<%= current_page.url %>'
|
@@ -0,0 +1 @@
|
|
1
|
+
URL: '<%= current_page.url %>'
|