middleman 2.0.0.rc8 → 2.0.0.rc91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -1
- data/bin/mm-server +1 -1
- data/features/asset_host.feature +2 -0
- data/features/automatic_image_sizes.feature +2 -0
- data/features/builder.feature +4 -1
- data/features/cache_buster.feature +4 -0
- data/features/coffee-script.feature +6 -1
- data/features/dynamic_pages.feature +24 -0
- data/features/minify_css.feature +2 -0
- data/features/minify_javascript.feature +3 -0
- data/features/page_alias_and_layouts.feature +5 -0
- data/features/relative_assets.feature +33 -1
- data/features/step_definitions/asset_host_steps.rb +4 -6
- data/features/step_definitions/builder_steps.rb +5 -0
- data/features/step_definitions/middleman_steps.rb +11 -8
- data/features/step_definitions/page_layout_steps.rb +7 -11
- data/features/tiny_src.feature +2 -0
- data/fixtures/test-app/config.rb +10 -0
- data/fixtures/test-app/source/images/Child folder/regular_file(example).txt +1 -0
- data/fixtures/test-app/source/images/Read me (example).txt +1 -0
- data/fixtures/test-app/source/img/blank.gif +0 -0
- data/fixtures/test-app/source/javascripts/broken-coffee.js.coffee +3 -0
- data/fixtures/test-app/source/real.html +1 -0
- data/fixtures/test-app/source/real/index.html.erb +5 -0
- data/fixtures/test-app/source/relative_image.html.erb +1 -0
- data/fixtures/test-app/source/spaces in file.html.erb +1 -0
- data/lib/middleman/base.rb +9 -6
- data/lib/middleman/builder.rb +7 -4
- data/lib/middleman/core_extensions/compass.rb +45 -16
- data/lib/middleman/core_extensions/front_matter.rb +2 -1
- data/lib/middleman/core_extensions/routing.rb +21 -9
- data/lib/middleman/features/asset_host.rb +2 -2
- data/lib/middleman/features/blog.rb +8 -5
- data/lib/middleman/features/cache_buster.rb +8 -10
- data/lib/middleman/features/minify_css.rb +2 -2
- data/lib/middleman/guard.rb +8 -2
- data/lib/middleman/templates.rb +3 -6
- data/lib/middleman/templates/blog.rb +17 -0
- data/lib/middleman/templates/blog/config.ru +9 -0
- data/lib/middleman/templates/blog/config.tt +18 -0
- data/lib/middleman/templates/blog/source/2011/01/01/new-article.html.markdown +6 -0
- data/lib/middleman/templates/blog/source/archives/index.html.erb +10 -0
- data/lib/middleman/templates/blog/source/feed.xml.builder +23 -0
- data/lib/middleman/templates/blog/source/index.html.erb +9 -0
- data/lib/middleman/templates/blog/source/layout.erb +30 -0
- data/lib/middleman/templates/default.rb +6 -4
- data/lib/middleman/templates/default/source/index.html.erb +5 -0
- data/lib/middleman/templates/default/source/layout.erb +19 -0
- data/lib/middleman/templates/default/source/stylesheets/site.css.scss +36 -0
- data/lib/middleman/templates/html5.rb +6 -3
- data/lib/middleman/templates/html5/source/404.html +28 -18
- data/lib/middleman/templates/html5/source/apple-touch-icon-114x114-precomposed.png +0 -0
- data/lib/middleman/templates/html5/source/apple-touch-icon-57x57-precomposed.png +0 -0
- data/lib/middleman/templates/html5/source/apple-touch-icon-72x72-precomposed.png +0 -0
- data/lib/middleman/templates/html5/source/apple-touch-icon-precomposed.png +0 -0
- data/lib/middleman/templates/html5/source/apple-touch-icon.png +0 -0
- data/lib/middleman/templates/html5/source/crossdomain.xml +0 -0
- data/lib/middleman/templates/html5/source/css/handheld.css +0 -0
- data/lib/middleman/templates/html5/source/css/style.css +40 -36
- data/lib/middleman/templates/html5/source/favicon.ico +0 -0
- data/lib/middleman/templates/html5/source/humans.txt +0 -0
- data/lib/middleman/templates/html5/source/{images → img}/.gitignore +0 -0
- data/lib/middleman/templates/html5/source/index.html +26 -27
- data/lib/middleman/templates/html5/source/js/libs/dd_belatedpng.js +0 -0
- data/lib/middleman/templates/html5/source/js/libs/{jquery-1.5.0.js → jquery-1.5.1.js} +549 -409
- data/lib/middleman/templates/html5/source/js/libs/jquery-1.5.1.min.js +16 -0
- data/lib/middleman/templates/html5/source/js/libs/modernizr-1.7.min.js +2 -0
- data/lib/middleman/templates/html5/source/js/mylibs/.gitignore +0 -0
- data/lib/middleman/templates/html5/source/js/plugins.js +3 -1
- data/lib/middleman/templates/html5/source/js/script.js +0 -0
- data/lib/middleman/templates/html5/source/robots.txt +0 -0
- data/lib/middleman/templates/html5/source/test/index.html +31 -0
- data/lib/middleman/templates/html5/source/test/qunit/qunit.css +148 -0
- data/lib/middleman/templates/html5/source/test/qunit/qunit.js +1265 -0
- data/lib/middleman/templates/html5/source/test/tests.js +27 -0
- data/lib/middleman/templates/{default → shared}/config.ru +0 -0
- data/lib/middleman/templates/{default → shared}/config.tt +36 -8
- data/lib/middleman/version.rb +1 -1
- data/middleman.gemspec +6 -6
- metadata +188 -35
- data/.document +0 -5
- data/.gitmodules +0 -0
- data/lib/middleman/templates/compass.rb +0 -18
- data/lib/middleman/templates/default/source/index.html.haml +0 -4
- data/lib/middleman/templates/default/source/layout.haml +0 -21
- data/lib/middleman/templates/default/source/stylesheets/site.css.sass +0 -34
- data/lib/middleman/templates/html5/config.ru +0 -4
- data/lib/middleman/templates/html5/config.tt +0 -53
- data/lib/middleman/templates/html5/source/js/libs/jquery-1.5.0.min.js +0 -16
- data/lib/middleman/templates/html5/source/js/libs/modernizr-1.6.min.js +0 -30
- data/lib/middleman/templates/xhtml.rb +0 -16
- data/lib/middleman/templates/xhtml/config.ru +0 -4
- data/lib/middleman/templates/xhtml/config.tt +0 -68
- data/lib/middleman/templates/xhtml/source/index.html.haml +0 -4
- data/lib/middleman/templates/xhtml/source/layout.haml +0 -13
- data/lib/middleman/templates/xhtml/source/stylesheets/site.css.sass +0 -34
data/CHANGELOG
CHANGED
|
@@ -7,4 +7,6 @@
|
|
|
7
7
|
- Refactored Dynamically Reloadable Core
|
|
8
8
|
- Combine views/ and public/ into a single source/ folder.
|
|
9
9
|
- Support YAML front-matter
|
|
10
|
-
-
|
|
10
|
+
- Added callback to run code after Compass is configured
|
|
11
|
+
- Added support for a compass.config file which is passed directly to Compass
|
|
12
|
+
- Blog-aware Feature (and project template)
|
data/bin/mm-server
CHANGED
|
@@ -15,7 +15,7 @@ module Middleman
|
|
|
15
15
|
|
|
16
16
|
class_option :port, :aliases => "-p", :default => "4567"
|
|
17
17
|
class_option :"livereload-port", :default => "35729"
|
|
18
|
-
class_option :"livereload", :default =>
|
|
18
|
+
class_option :"livereload", :default => false, :type => :boolean
|
|
19
19
|
|
|
20
20
|
def start_guard
|
|
21
21
|
if !File.exists?("config.rb")
|
data/features/asset_host.feature
CHANGED
|
@@ -3,10 +3,12 @@ Feature: Alternate between multiple asset hosts
|
|
|
3
3
|
|
|
4
4
|
Scenario: Rendering css with the feature enabled
|
|
5
5
|
Given I am using an asset host
|
|
6
|
+
And the Server is running
|
|
6
7
|
When I go to "/stylesheets/asset_host.css"
|
|
7
8
|
Then I should see "http://assets"
|
|
8
9
|
|
|
9
10
|
Scenario: Rendering html with the feature enabled
|
|
10
11
|
Given I am using an asset host
|
|
12
|
+
And the Server is running
|
|
11
13
|
When I go to "/asset_host.html"
|
|
12
14
|
Then I should see "http://assets"
|
|
@@ -3,12 +3,14 @@ Feature: Automatically detect and insert image dimensions into tags
|
|
|
3
3
|
|
|
4
4
|
Scenario: Rendering an image with the feature disabled
|
|
5
5
|
Given "automatic_image_sizes" feature is "disabled"
|
|
6
|
+
And the Server is running
|
|
6
7
|
When I go to "/auto-image-sizes.html"
|
|
7
8
|
Then I should not see "width="
|
|
8
9
|
And I should not see "height="
|
|
9
10
|
|
|
10
11
|
Scenario: Rendering an image with the feature enabled
|
|
11
12
|
Given "automatic_image_sizes" feature is "enabled"
|
|
13
|
+
And the Server is running
|
|
12
14
|
When I go to "/auto-image-sizes.html"
|
|
13
15
|
Then I should see "width="
|
|
14
16
|
And I should see "height="
|
data/features/builder.feature
CHANGED
|
@@ -12,9 +12,12 @@ Feature: Builder
|
|
|
12
12
|
Then "stylesheets/site_scss.css" should exist and include "html, body, div, span"
|
|
13
13
|
Then "stylesheets/static.css" should exist and include "body"
|
|
14
14
|
Then "_partial.html" should not exist
|
|
15
|
+
Then "spaces in file.html" should exist and include "spaces"
|
|
16
|
+
Then "images/Read me (example).txt" should exist
|
|
17
|
+
Then "images/Child folder/regular_file(example).txt" should exist
|
|
15
18
|
And cleanup built test app
|
|
16
19
|
|
|
17
20
|
Scenario: Force relative assets
|
|
18
21
|
Given a built test app with flags "--relative"
|
|
19
|
-
Then "stylesheets/
|
|
22
|
+
Then "stylesheets/relative_assets.css" should exist and include "../"
|
|
20
23
|
And cleanup built test app
|
|
@@ -3,20 +3,24 @@ Feature: Generate mtime-based query string for busting browser caches
|
|
|
3
3
|
|
|
4
4
|
Scenario: Rendering css with the feature disabled
|
|
5
5
|
Given "cache_buster" feature is "disabled"
|
|
6
|
+
And the Server is running
|
|
6
7
|
When I go to "/stylesheets/relative_assets.css"
|
|
7
8
|
Then I should not see "?"
|
|
8
9
|
|
|
9
10
|
Scenario: Rendering html with the feature disabled
|
|
10
11
|
Given "cache_buster" feature is "disabled"
|
|
12
|
+
And the Server is running
|
|
11
13
|
When I go to "/cache-buster.html"
|
|
12
14
|
Then I should not see "?"
|
|
13
15
|
|
|
14
16
|
Scenario: Rendering css with the feature enabled
|
|
15
17
|
Given "cache_buster" feature is "enabled"
|
|
18
|
+
And the Server is running
|
|
16
19
|
When I go to "/stylesheets/relative_assets.css"
|
|
17
20
|
Then I should see "?"
|
|
18
21
|
|
|
19
22
|
Scenario: Rendering html with the feature enabled
|
|
20
23
|
Given "cache_buster" feature is "enabled"
|
|
24
|
+
And the Server is running
|
|
21
25
|
When I go to "/cache-buster.html"
|
|
22
26
|
Then I should not see "?"
|
|
@@ -9,4 +9,9 @@ Feature: Support coffee-script
|
|
|
9
9
|
Scenario: Rendering coffee-script with :coffeescript haml-filter
|
|
10
10
|
Given the Server is running
|
|
11
11
|
When I go to "/inline-coffeescript.html"
|
|
12
|
-
Then I should see "Array.prototype.slice"
|
|
12
|
+
Then I should see "Array.prototype.slice"
|
|
13
|
+
|
|
14
|
+
Scenario: Rendering broken coffee
|
|
15
|
+
Given the Server is running
|
|
16
|
+
When I go to "/javascripts/broken-coffee.js"
|
|
17
|
+
Then I should see "Reserved word"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Feature: Dynamic Pages
|
|
2
|
+
In order to use a single view to generate multiple output files
|
|
3
|
+
|
|
4
|
+
Scenario: Checking built folder for content
|
|
5
|
+
Given a built test app
|
|
6
|
+
Then "fake.html" should exist and include "I am real"
|
|
7
|
+
Then "fake/one.html" should exist and include "I am real: one"
|
|
8
|
+
Then "fake/two.html" should exist and include "I am real: two"
|
|
9
|
+
And cleanup built test app
|
|
10
|
+
|
|
11
|
+
Scenario: Preview basic proxy
|
|
12
|
+
Given the Server is running
|
|
13
|
+
When I go to "/fake.html"
|
|
14
|
+
Then I should see "I am real"
|
|
15
|
+
|
|
16
|
+
Scenario: Preview proxy with variable one
|
|
17
|
+
Given the Server is running
|
|
18
|
+
When I go to "/fake/one.html"
|
|
19
|
+
Then I should see "I am real: one"
|
|
20
|
+
|
|
21
|
+
Scenario: Preview proxy with variable two
|
|
22
|
+
Given the Server is running
|
|
23
|
+
When I go to "/fake/two.html"
|
|
24
|
+
Then I should see "I am real: two"
|
data/features/minify_css.feature
CHANGED
|
@@ -8,6 +8,7 @@ Feature: Minify CSS
|
|
|
8
8
|
|
|
9
9
|
Scenario: Rendering external css with the feature disabled
|
|
10
10
|
Given "minify_css" feature is "disabled"
|
|
11
|
+
And the Server is running
|
|
11
12
|
When I go to "/stylesheets/site.css"
|
|
12
13
|
Then I should see "55" lines
|
|
13
14
|
|
|
@@ -18,5 +19,6 @@ Feature: Minify CSS
|
|
|
18
19
|
|
|
19
20
|
Scenario: Rendering external css with the feature enabled
|
|
20
21
|
Given "minify_css" feature is "enabled"
|
|
22
|
+
And the Server is running
|
|
21
23
|
When I go to "/stylesheets/site.css"
|
|
22
24
|
Then I should see "1" lines
|
|
@@ -6,15 +6,18 @@ Feature: Minify Javascript
|
|
|
6
6
|
|
|
7
7
|
Scenario: Rendering inline js with the feature disabled
|
|
8
8
|
Given "minify_javascript" feature is "disabled"
|
|
9
|
+
And the Server is running
|
|
9
10
|
When I go to "/inline-js.html"
|
|
10
11
|
Then I should see "10" lines
|
|
11
12
|
|
|
12
13
|
Scenario: Rendering inline js with the feature enabled
|
|
13
14
|
Given "minify_javascript" feature is "enabled"
|
|
15
|
+
And the Server is running
|
|
14
16
|
When I go to "/inline-js.html"
|
|
15
17
|
Then I should see "5" lines
|
|
16
18
|
|
|
17
19
|
Scenario: Rendering inline js (coffeescript) with the feature enabled
|
|
18
20
|
Given "minify_javascript" feature is "enabled"
|
|
21
|
+
And the Server is running
|
|
19
22
|
When I go to "/inline-coffeescript.html"
|
|
20
23
|
Then I should see "5" lines
|
|
@@ -3,16 +3,19 @@ Feature: Custom layouts
|
|
|
3
3
|
|
|
4
4
|
Scenario: Using custom :layout attribute
|
|
5
5
|
Given page "/custom-layout.html" has layout "custom"
|
|
6
|
+
And the Server is running
|
|
6
7
|
When I go to "/custom-layout.html"
|
|
7
8
|
Then I should see "Custom Layout"
|
|
8
9
|
|
|
9
10
|
Scenario: Using with_layout block
|
|
10
11
|
Given "/custom-layout.html" with_layout block has layout "custom"
|
|
12
|
+
And the Server is running
|
|
11
13
|
When I go to "/custom-layout.html"
|
|
12
14
|
Then I should see "Custom Layout"
|
|
13
15
|
|
|
14
16
|
Scenario: Using custom :layout attribute with folders
|
|
15
17
|
Given page "/custom-layout-dir/" has layout "custom"
|
|
18
|
+
And the Server is running
|
|
16
19
|
When I go to "/custom-layout-dir"
|
|
17
20
|
Then I should see "Custom Layout"
|
|
18
21
|
When I go to "/custom-layout-dir/"
|
|
@@ -22,6 +25,7 @@ Feature: Custom layouts
|
|
|
22
25
|
|
|
23
26
|
Scenario: Using custom :layout attribute with folders
|
|
24
27
|
Given page "/custom-layout-dir" has layout "custom"
|
|
28
|
+
And the Server is running
|
|
25
29
|
When I go to "/custom-layout-dir"
|
|
26
30
|
Then I should see "Custom Layout"
|
|
27
31
|
When I go to "/custom-layout-dir/"
|
|
@@ -31,6 +35,7 @@ Feature: Custom layouts
|
|
|
31
35
|
|
|
32
36
|
Scenario: Using custom :layout attribute with folders
|
|
33
37
|
Given page "/custom-layout-dir/index.html" has layout "custom"
|
|
38
|
+
And the Server is running
|
|
34
39
|
When I go to "/custom-layout-dir"
|
|
35
40
|
Then I should see "Custom Layout"
|
|
36
41
|
When I go to "/custom-layout-dir/"
|
|
@@ -3,10 +3,42 @@ Feature: Relative Assets
|
|
|
3
3
|
|
|
4
4
|
Scenario: Rendering css with the feature disabled
|
|
5
5
|
Given "relative_assets" feature is "disabled"
|
|
6
|
+
And the Server is running
|
|
6
7
|
When I go to "/stylesheets/relative_assets.css"
|
|
7
8
|
Then I should not see "url('../"
|
|
9
|
+
And I should see "/images/blank.gif"
|
|
10
|
+
|
|
11
|
+
Scenario: Rendering html with the feature disabled
|
|
12
|
+
Given "relative_assets" feature is "disabled"
|
|
13
|
+
And the Server is running
|
|
14
|
+
When I go to "/relative_image.html"
|
|
15
|
+
Then I should see "/images/blank.gif"
|
|
8
16
|
|
|
9
17
|
Scenario: Rendering css with the feature enabled
|
|
10
18
|
Given "relative_assets" feature is "enabled"
|
|
19
|
+
And the Server is running
|
|
11
20
|
When I go to "/stylesheets/relative_assets.css"
|
|
12
|
-
Then I should see "url('../"
|
|
21
|
+
Then I should see "url('../images/blank.gif"
|
|
22
|
+
|
|
23
|
+
Scenario: Rendering html with the feature disabled
|
|
24
|
+
Given "relative_assets" feature is "enabled"
|
|
25
|
+
And the Server is running
|
|
26
|
+
When I go to "/relative_image.html"
|
|
27
|
+
Then I should not see "/images/blank.gif"
|
|
28
|
+
And I should see "images/blank.gif"
|
|
29
|
+
|
|
30
|
+
Scenario: Rendering html with a custom images_dir
|
|
31
|
+
Given "relative_assets" feature is "enabled"
|
|
32
|
+
And "images_dir" is set to "img"
|
|
33
|
+
And the Server is running
|
|
34
|
+
When I go to "/stylesheets/relative_assets.css"
|
|
35
|
+
Then I should see "url('../img/blank.gif"
|
|
36
|
+
|
|
37
|
+
Scenario: Rendering css with a custom images_dir
|
|
38
|
+
Given "relative_assets" feature is "enabled"
|
|
39
|
+
And "images_dir" is set to "img"
|
|
40
|
+
And the Server is running
|
|
41
|
+
When I go to "/relative_image.html"
|
|
42
|
+
Then I should not see "/images/blank.gif"
|
|
43
|
+
Then I should not see "/img/blank.gif"
|
|
44
|
+
And I should see "img/blank.gif"
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
Given /^I am using an asset host$/ do
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
end
|
|
2
|
+
@server ||= Middleman.server
|
|
3
|
+
@server.activate :asset_host
|
|
4
|
+
@server.set :asset_host do |asset|
|
|
5
|
+
"http://assets%d.example.com" % (asset.hash % 4)
|
|
7
6
|
end
|
|
8
|
-
@browser = Rack::Test::Session.new(Rack::MockSession.new(sandbox_server.new))
|
|
9
7
|
end
|
|
@@ -17,6 +17,11 @@ Given /^cleanup built test app$/ do
|
|
|
17
17
|
FileUtils.rm_rf(target)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
Then /^"([^"]*)" should exist$/ do |target_file,|
|
|
21
|
+
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build", target_file)
|
|
22
|
+
File.exists?(target).should be_true
|
|
23
|
+
end
|
|
24
|
+
|
|
20
25
|
Then /^"([^"]*)" should exist and include "([^"]*)"$/ do |target_file, expected|
|
|
21
26
|
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build", target_file)
|
|
22
27
|
File.exists?(target).should be_true
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
Given /^"([^\"]*)" feature is "([^\"]*)"$/ do |feature, state|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
end
|
|
6
|
-
set :environment, @current_env || :development
|
|
2
|
+
@server ||= Middleman.server
|
|
3
|
+
if state == "enabled"
|
|
4
|
+
@server.activate(feature.to_sym)
|
|
7
5
|
end
|
|
8
|
-
@
|
|
6
|
+
@server.set :environment, @current_env || :development
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Given /^"([^\"]*)" is set to "([^\"]*)"$/ do |variable, value|
|
|
10
|
+
@server ||= Middleman.server
|
|
11
|
+
@server.set variable.to_sym, value
|
|
9
12
|
end
|
|
10
13
|
|
|
11
14
|
Given /^current environment is "([^\"]*)"$/ do |env|
|
|
@@ -13,8 +16,8 @@ Given /^current environment is "([^\"]*)"$/ do |env|
|
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
Given /^the Server is running$/ do
|
|
16
|
-
|
|
17
|
-
@browser = Rack::Test::Session.new(Rack::MockSession.new(
|
|
19
|
+
@server ||= Middleman.server
|
|
20
|
+
@browser = Rack::Test::Session.new(Rack::MockSession.new(@server.new))
|
|
18
21
|
end
|
|
19
22
|
|
|
20
23
|
When /^I go to "([^\"]*)"$/ do |url|
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
Given /^page "([^\"]*)" has layout "([^\"]*)"$/ do |url, layout|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
end
|
|
6
|
-
@browser = Rack::Test::Session.new(Rack::MockSession.new(sandbox_server.new))
|
|
2
|
+
@server ||= Middleman.server
|
|
3
|
+
@server.set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
|
4
|
+
@server.page(url, :layout => layout.to_sym)
|
|
7
5
|
end
|
|
8
6
|
|
|
9
7
|
Given /^"([^\"]*)" with_layout block has layout "([^\"]*)"$/ do |url, layout|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
end
|
|
8
|
+
@server ||= Middleman.server
|
|
9
|
+
@server.set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
|
10
|
+
@server.with_layout(layout.to_sym) do
|
|
11
|
+
page(url)
|
|
15
12
|
end
|
|
16
|
-
@browser = Rack::Test::Session.new(Rack::MockSession.new(sandbox_server.new))
|
|
17
13
|
end
|
data/features/tiny_src.feature
CHANGED
|
@@ -4,10 +4,12 @@ Feature: Tiny Src
|
|
|
4
4
|
|
|
5
5
|
Scenario: Rendering html with the feature disabled
|
|
6
6
|
Given "tiny_src" feature is "disabled"
|
|
7
|
+
And the Server is running
|
|
7
8
|
When I go to "/tiny_src.html"
|
|
8
9
|
Then I should see "http://test.com/image.jpg"
|
|
9
10
|
|
|
10
11
|
Scenario: Rendering html with the feature enabled
|
|
11
12
|
Given "tiny_src" feature is "enabled"
|
|
13
|
+
And the Server is running
|
|
12
14
|
When I go to "/tiny_src.html"
|
|
13
15
|
Then I should see "http://i.tinysrc.mobi/http://test.com/image.jpg"
|
data/fixtures/test-app/config.rb
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
page "/fake.html", :proxy => "/real.html", :layout => false
|
|
2
|
+
|
|
3
|
+
%w(one two).each do |num|
|
|
4
|
+
page "/fake/#{num}.html", :proxy => "/real/index.html" do
|
|
5
|
+
@num = num
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
1
9
|
with_layout false do
|
|
10
|
+
page "/relative_image.html"
|
|
2
11
|
page "/inline-css.html"
|
|
3
12
|
page "/inline-js.html"
|
|
4
13
|
page "/inline-coffeescript.html"
|
|
14
|
+
page "/spaces in file.html"
|
|
5
15
|
page "/slim.html"
|
|
6
16
|
page "/data.html"
|
|
7
17
|
page "/page-classes.html"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Regular
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
README
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I am real
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= image_tag "blank.gif" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= "spaces" %>
|
data/lib/middleman/base.rb
CHANGED
|
@@ -83,21 +83,23 @@ module Middleman::Base
|
|
|
83
83
|
settings.set :views, File.join(settings.root, settings.views)
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
request_path = request.path_info.gsub("%20", " ")
|
|
87
|
+
result = resolve_template(request_path, :raise_exceptions => false)
|
|
88
|
+
|
|
87
89
|
if result
|
|
88
90
|
extensionless_path, template_engine = result
|
|
89
91
|
|
|
90
92
|
# Return static files
|
|
91
93
|
if !::Tilt.mappings.has_key?(template_engine.to_s)
|
|
92
|
-
content_type mime_type(File.extname(
|
|
94
|
+
content_type mime_type(File.extname(request_path)), :charset => 'utf-8'
|
|
93
95
|
status 200
|
|
94
|
-
send_file File.join(settings.views,
|
|
96
|
+
send_file File.join(settings.views, request_path)
|
|
95
97
|
false
|
|
96
98
|
else
|
|
97
99
|
true
|
|
98
100
|
end
|
|
99
101
|
else
|
|
100
|
-
$stderr.puts "File not found: #{
|
|
102
|
+
$stderr.puts "File not found: #{request_path}"
|
|
101
103
|
status 404
|
|
102
104
|
false
|
|
103
105
|
end
|
|
@@ -156,11 +158,12 @@ module Middleman::Base
|
|
|
156
158
|
|
|
157
159
|
render_options = { :layout => layout }
|
|
158
160
|
render_options[:layout_engine] = options[:layout_engine] if options.has_key? :layout_engine
|
|
159
|
-
|
|
161
|
+
request_path = request.path_info.gsub("%20", " ")
|
|
162
|
+
result = render(request_path, render_options)
|
|
160
163
|
settings.set :layout, old_layout
|
|
161
164
|
|
|
162
165
|
if result
|
|
163
|
-
content_type mime_type(File.extname(
|
|
166
|
+
content_type mime_type(File.extname(request_path)), :charset => 'utf-8'
|
|
164
167
|
status 200
|
|
165
168
|
body result
|
|
166
169
|
else
|
data/lib/middleman/builder.rb
CHANGED
|
@@ -10,15 +10,15 @@ module Middleman
|
|
|
10
10
|
config = args.last.is_a?(Hash) ? args.pop : {}
|
|
11
11
|
destination = args.first || source
|
|
12
12
|
|
|
13
|
-
source = File.expand_path(find_in_source_paths(source.to_s))
|
|
13
|
+
# source = File.expand_path(find_in_source_paths(source.to_s))
|
|
14
14
|
context = instance_eval('binding')
|
|
15
15
|
|
|
16
16
|
@@rack_test ||= ::Rack::Test::Session.new(::Rack::MockSession.new(SHARED_SERVER))
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
create_file destination, nil, config do
|
|
19
19
|
# The default render just requests the page over Rack and writes the response
|
|
20
20
|
request_path = destination.sub(/^#{SHARED_SERVER.build_dir}/, "")
|
|
21
|
-
@@rack_test.get(request_path)
|
|
21
|
+
@@rack_test.get(request_path.gsub(/\s/, "%20"))
|
|
22
22
|
@@rack_test.last_response.body
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -40,7 +40,6 @@ module Middleman
|
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
|
|
44
43
|
def source_paths
|
|
45
44
|
@source_paths ||= [
|
|
46
45
|
SHARED_SERVER.root
|
|
@@ -49,6 +48,10 @@ module Middleman
|
|
|
49
48
|
|
|
50
49
|
def build_all_files
|
|
51
50
|
action Directory.new(self, SHARED_SERVER.views, SHARED_SERVER.build_dir, { :force => true })
|
|
51
|
+
|
|
52
|
+
SHARED_SERVER.proxied_paths.each do |url, proxy|
|
|
53
|
+
tilt_template(url.gsub(/^\//, "#{SHARED_SERVER.build_dir}/"), { :force => true })
|
|
54
|
+
end
|
|
52
55
|
end
|
|
53
56
|
|
|
54
57
|
@@hooks = {}
|