directory_indexes feature, some builder rename middleware and a bunch of test case cleanup. closes #63
This commit is contained in:
parent
c35a6fc369
commit
5602e35c88
|
@ -11,3 +11,4 @@
|
||||||
- Added support for a compass.config file which is passed directly to Compass
|
- Added support for a compass.config file which is passed directly to Compass
|
||||||
- Blog-aware Feature (and project template)
|
- Blog-aware Feature (and project template)
|
||||||
- Thor-based, unified `middleman` binary
|
- Thor-based, unified `middleman` binary
|
||||||
|
- :directory_indexes feature
|
|
@ -3,12 +3,12 @@ Feature: Alternate between multiple asset hosts
|
||||||
|
|
||||||
Scenario: Rendering css with the feature enabled
|
Scenario: Rendering css with the feature enabled
|
||||||
Given I am using an asset host
|
Given I am using an asset host
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/stylesheets/asset_host.css"
|
When I go to "/stylesheets/asset_host.css"
|
||||||
Then I should see "http://assets"
|
Then I should see "http://assets"
|
||||||
|
|
||||||
Scenario: Rendering html with the feature enabled
|
Scenario: Rendering html with the feature enabled
|
||||||
Given I am using an asset host
|
Given I am using an asset host
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/asset_host.html"
|
When I go to "/asset_host.html"
|
||||||
Then I should see "http://assets"
|
Then I should see "http://assets"
|
|
@ -3,14 +3,14 @@ Feature: Automatically detect and insert image dimensions into tags
|
||||||
|
|
||||||
Scenario: Rendering an image with the feature disabled
|
Scenario: Rendering an image with the feature disabled
|
||||||
Given "automatic_image_sizes" feature is "disabled"
|
Given "automatic_image_sizes" feature is "disabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/auto-image-sizes.html"
|
When I go to "/auto-image-sizes.html"
|
||||||
Then I should not see "width="
|
Then I should not see "width="
|
||||||
And I should not see "height="
|
And I should not see "height="
|
||||||
|
|
||||||
Scenario: Rendering an image with the feature enabled
|
Scenario: Rendering an image with the feature enabled
|
||||||
Given "automatic_image_sizes" feature is "enabled"
|
Given "automatic_image_sizes" feature is "enabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/auto-image-sizes.html"
|
When I go to "/auto-image-sizes.html"
|
||||||
Then I should see "width="
|
Then I should see "width="
|
||||||
And I should see "height="
|
And I should see "height="
|
|
@ -2,22 +2,22 @@ Feature: Builder
|
||||||
In order to output static html and css for delivery
|
In order to output static html and css for delivery
|
||||||
|
|
||||||
Scenario: Checking built folder for content
|
Scenario: Checking built folder for content
|
||||||
Given a built test app
|
Given a built app at "test-app"
|
||||||
Then "index.html" should exist and include "Comment in layout"
|
Then "index.html" should exist at "test-app" and include "Comment in layout"
|
||||||
Then "javascripts/coffee_test.js" should exist and include "Array.prototype.slice"
|
Then "javascripts/coffee_test.js" should exist at "test-app" and include "Array.prototype.slice"
|
||||||
Then "index.html" should exist and include "<h1>Welcome</h1>"
|
Then "index.html" should exist at "test-app" and include "<h1>Welcome</h1>"
|
||||||
Then "static.html" should exist and include "Static, no code!"
|
Then "static.html" should exist at "test-app" and include "Static, no code!"
|
||||||
Then "services/index.html" should exist and include "Services"
|
Then "services/index.html" should exist at "test-app" and include "Services"
|
||||||
Then "stylesheets/site.css" should exist and include "html, body, div, span"
|
Then "stylesheets/site.css" should exist at "test-app" and include "html, body, div, span"
|
||||||
Then "stylesheets/site_scss.css" should exist and include "html, body, div, span"
|
Then "stylesheets/site_scss.css" should exist at "test-app" and include "html, body, div, span"
|
||||||
Then "stylesheets/static.css" should exist and include "body"
|
Then "stylesheets/static.css" should exist at "test-app" and include "body"
|
||||||
Then "_partial.html" should not exist
|
Then "_partial.html" should not exist at "test-app"
|
||||||
Then "spaces in file.html" should exist and include "spaces"
|
Then "spaces in file.html" should exist at "test-app" and include "spaces"
|
||||||
Then "images/Read me (example).txt" should exist
|
Then "images/Read me (example).txt" should exist at "test-app"
|
||||||
Then "images/Child folder/regular_file(example).txt" should exist
|
Then "images/Child folder/regular_file(example).txt" should exist at "test-app"
|
||||||
And cleanup built test app
|
And cleanup built app at "test-app"
|
||||||
|
|
||||||
Scenario: Force relative assets
|
Scenario: Force relative assets
|
||||||
Given a built test app with flags "--relative"
|
Given a built test app with flags "--relative"
|
||||||
Then "stylesheets/relative_assets.css" should exist and include "../"
|
Then "stylesheets/relative_assets.css" should exist at "test-app" and include "../"
|
||||||
And cleanup built test app
|
And cleanup built app at "test-app"
|
|
@ -3,24 +3,24 @@ Feature: Generate mtime-based query string for busting browser caches
|
||||||
|
|
||||||
Scenario: Rendering css with the feature disabled
|
Scenario: Rendering css with the feature disabled
|
||||||
Given "cache_buster" feature is "disabled"
|
Given "cache_buster" feature is "disabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/stylesheets/relative_assets.css"
|
When I go to "/stylesheets/relative_assets.css"
|
||||||
Then I should not see "?"
|
Then I should not see "?"
|
||||||
|
|
||||||
Scenario: Rendering html with the feature disabled
|
Scenario: Rendering html with the feature disabled
|
||||||
Given "cache_buster" feature is "disabled"
|
Given "cache_buster" feature is "disabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/cache-buster.html"
|
When I go to "/cache-buster.html"
|
||||||
Then I should not see "?"
|
Then I should not see "?"
|
||||||
|
|
||||||
Scenario: Rendering css with the feature enabled
|
Scenario: Rendering css with the feature enabled
|
||||||
Given "cache_buster" feature is "enabled"
|
Given "cache_buster" feature is "enabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/stylesheets/relative_assets.css"
|
When I go to "/stylesheets/relative_assets.css"
|
||||||
Then I should see "?"
|
Then I should see "?"
|
||||||
|
|
||||||
Scenario: Rendering html with the feature enabled
|
Scenario: Rendering html with the feature enabled
|
||||||
Given "cache_buster" feature is "enabled"
|
Given "cache_buster" feature is "enabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/cache-buster.html"
|
When I go to "/cache-buster.html"
|
||||||
Then I should not see "?"
|
Then I should not see "?"
|
|
@ -2,16 +2,16 @@ Feature: Support coffee-script
|
||||||
In order to offer an alternative when writing Javascript
|
In order to offer an alternative when writing Javascript
|
||||||
|
|
||||||
Scenario: Rendering coffee script
|
Scenario: Rendering coffee script
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/javascripts/coffee_test.js"
|
When I go to "/javascripts/coffee_test.js"
|
||||||
Then I should see "Array.prototype.slice"
|
Then I should see "Array.prototype.slice"
|
||||||
|
|
||||||
Scenario: Rendering coffee-script with :coffeescript haml-filter
|
Scenario: Rendering coffee-script with :coffeescript haml-filter
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/inline-coffeescript.html"
|
When I go to "/inline-coffeescript.html"
|
||||||
Then I should see "Array.prototype.slice"
|
Then I should see "Array.prototype.slice"
|
||||||
|
|
||||||
Scenario: Rendering broken coffee
|
Scenario: Rendering broken coffee
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/javascripts/broken-coffee.js"
|
When I go to "/javascripts/broken-coffee.js"
|
||||||
Then I should see "Reserved word"
|
Then I should see "Reserved word"
|
|
@ -2,6 +2,6 @@ Feature: Local Data API
|
||||||
In order to abstract content from structure
|
In order to abstract content from structure
|
||||||
|
|
||||||
Scenario: Rendering html
|
Scenario: Rendering html
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/data.html"
|
When I go to "/data.html"
|
||||||
Then I should see "One:Two"
|
Then I should see "One:Two"
|
27
features/directory_index.feature
Normal file
27
features/directory_index.feature
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
Feature: Directory Index
|
||||||
|
In order output Apache-friendly directories and indexes
|
||||||
|
|
||||||
|
Scenario: Checking built folder for content
|
||||||
|
Given a built app at "indexable-app"
|
||||||
|
Then "needs_index/index.html" should exist at "indexable-app" and include "Indexable"
|
||||||
|
Then "a_folder/needs_index/index.html" should exist at "indexable-app" and include "Indexable"
|
||||||
|
Then "leave_me_alone.html" should exist at "indexable-app" and include "Stay away"
|
||||||
|
Then "needs_index.html" should not exist at "indexable-app"
|
||||||
|
Then "a_folder/needs_index.html" should not exist at "indexable-app"
|
||||||
|
Then "leave_me_alone/index.html" should not exist at "indexable-app"
|
||||||
|
And cleanup built app at "indexable-app"
|
||||||
|
|
||||||
|
Scenario: Preview normal file
|
||||||
|
Given the Server is running at "indexable-app"
|
||||||
|
When I go to "/needs_index/"
|
||||||
|
Then I should see "Indexable"
|
||||||
|
|
||||||
|
Scenario: Preview normal file subdirectory
|
||||||
|
Given the Server is running at "indexable-app"
|
||||||
|
When I go to "/a_folder/needs_index/"
|
||||||
|
Then I should see "Indexable"
|
||||||
|
|
||||||
|
Scenario: Preview ignored file
|
||||||
|
Given the Server is running at "indexable-app"
|
||||||
|
When I go to "/leave_me_alone/"
|
||||||
|
Then I should see "File Not Found"
|
|
@ -2,27 +2,32 @@ Feature: Dynamic Pages
|
||||||
In order to use a single view to generate multiple output files
|
In order to use a single view to generate multiple output files
|
||||||
|
|
||||||
Scenario: Checking built folder for content
|
Scenario: Checking built folder for content
|
||||||
Given a built test app
|
Given a built app at "test-app"
|
||||||
Then "fake.html" should exist and include "I am real"
|
Then "fake.html" should exist at "test-app" and include "I am real"
|
||||||
Then "fake/one.html" should exist and include "I am real: one"
|
Then "fake/one.html" should exist at "test-app" and include "I am real: one"
|
||||||
Then "fake/two.html" should exist and include "I am real: two"
|
Then "fake/two.html" should exist at "test-app" and include "I am real: two"
|
||||||
Then "target_ignore.html" should exist and include "Ignore me"
|
Then "target_ignore.html" should exist at "test-app" and include "Ignore me"
|
||||||
Then "should_be_ignored.html" should not exist
|
Then "should_be_ignored.html" should not exist at "test-app"
|
||||||
Then "should_be_ignored2.html" should not exist
|
Then "should_be_ignored2.html" should not exist at "test-app"
|
||||||
Then "should_be_ignored3.html" should not exist
|
Then "should_be_ignored3.html" should not exist at "test-app"
|
||||||
And cleanup built test app
|
And cleanup built app at "test-app"
|
||||||
|
|
||||||
Scenario: Preview basic proxy
|
Scenario: Preview basic proxy
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/fake.html"
|
When I go to "/fake.html"
|
||||||
Then I should see "I am real"
|
Then I should see "I am real"
|
||||||
|
|
||||||
Scenario: Preview proxy with variable one
|
Scenario: Preview proxy with variable one
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/fake/one.html"
|
When I go to "/fake/one.html"
|
||||||
Then I should see "I am real: one"
|
Then I should see "I am real: one"
|
||||||
|
|
||||||
Scenario: Preview proxy with variable two
|
Scenario: Preview proxy with variable two
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/fake/two.html"
|
When I go to "/fake/two.html"
|
||||||
Then I should see "I am real: two"
|
Then I should see "I am real: two"
|
||||||
|
|
||||||
|
Scenario: Preview ignored paths
|
||||||
|
Given the Server is running at "test-app"
|
||||||
|
When I go to "/should_be_ignored.html"
|
||||||
|
Then I should see "File Not Found"
|
|
@ -2,6 +2,6 @@ Feature: YAML Front Matter
|
||||||
In order to specific options and data inline
|
In order to specific options and data inline
|
||||||
|
|
||||||
Scenario: Rendering html
|
Scenario: Rendering html
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/front-matter.html"
|
When I go to "/front-matter.html"
|
||||||
Then I should see "<h1>This is the title</h1>"
|
Then I should see "<h1>This is the title</h1>"
|
|
@ -2,26 +2,26 @@ Feature: Built-in auto_javascript_include_tag view helper
|
||||||
In order to simplify including javascript files
|
In order to simplify including javascript files
|
||||||
|
|
||||||
Scenario: Viewing the root path
|
Scenario: Viewing the root path
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/auto-js.html"
|
When I go to "/auto-js.html"
|
||||||
Then I should see "javascripts/auto-js.js"
|
Then I should see "javascripts/auto-js.js"
|
||||||
|
|
||||||
Scenario: Viewing a tier-1 path
|
Scenario: Viewing a tier-1 path
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/auto-js/auto-js.html"
|
When I go to "/auto-js/auto-js.html"
|
||||||
Then I should see "javascripts/auto-js/auto-js.js"
|
Then I should see "javascripts/auto-js/auto-js.js"
|
||||||
|
|
||||||
Scenario: Viewing the index file of a tier-1 path, without filename
|
Scenario: Viewing the index file of a tier-1 path, without filename
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/auto-js"
|
When I go to "/auto-js"
|
||||||
Then I should see "javascripts/auto-js/index.js"
|
Then I should see "javascripts/auto-js/index.js"
|
||||||
|
|
||||||
Scenario: Viewing the index file of a tier-1 path, without filename, with a trailing slash
|
Scenario: Viewing the index file of a tier-1 path, without filename, with a trailing slash
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/auto-js/"
|
When I go to "/auto-js/"
|
||||||
Then I should see "javascripts/auto-js/index.js"
|
Then I should see "javascripts/auto-js/index.js"
|
||||||
|
|
||||||
Scenario: Viewing a tier-2 path
|
Scenario: Viewing a tier-2 path
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/auto-js/sub/auto-js.html"
|
When I go to "/auto-js/sub/auto-js.html"
|
||||||
Then I should see "javascripts/auto-js/sub/auto-js.js"
|
Then I should see "javascripts/auto-js/sub/auto-js.js"
|
||||||
|
|
|
@ -2,26 +2,26 @@ Feature: Built-in auto_stylesheet_link_tag view helper
|
||||||
In order to simplify including css files
|
In order to simplify including css files
|
||||||
|
|
||||||
Scenario: Viewing the root path
|
Scenario: Viewing the root path
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/auto-css.html"
|
When I go to "/auto-css.html"
|
||||||
Then I should see "stylesheets/auto-css.css"
|
Then I should see "stylesheets/auto-css.css"
|
||||||
|
|
||||||
Scenario: Viewing a tier-1 path
|
Scenario: Viewing a tier-1 path
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/auto-css/auto-css.html"
|
When I go to "/auto-css/auto-css.html"
|
||||||
Then I should see "stylesheets/auto-css/auto-css.css"
|
Then I should see "stylesheets/auto-css/auto-css.css"
|
||||||
|
|
||||||
Scenario: Viewing the index file of a tier-1 path, without filename
|
Scenario: Viewing the index file of a tier-1 path, without filename
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/auto-css"
|
When I go to "/auto-css"
|
||||||
Then I should see "stylesheets/auto-css/index.css"
|
Then I should see "stylesheets/auto-css/index.css"
|
||||||
|
|
||||||
Scenario: Viewing the index file of a tier-1 path, without filename, with a trailing slash
|
Scenario: Viewing the index file of a tier-1 path, without filename, with a trailing slash
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/auto-css/"
|
When I go to "/auto-css/"
|
||||||
Then I should see "stylesheets/auto-css/index.css"
|
Then I should see "stylesheets/auto-css/index.css"
|
||||||
|
|
||||||
Scenario: Viewing a tier-2 path
|
Scenario: Viewing a tier-2 path
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/auto-css/sub/auto-css.html"
|
When I go to "/auto-css/sub/auto-css.html"
|
||||||
Then I should see "stylesheets/auto-css/sub/auto-css.css"
|
Then I should see "stylesheets/auto-css/sub/auto-css.css"
|
||||||
|
|
|
@ -2,16 +2,16 @@ Feature: Built-in page_classes view helper
|
||||||
In order to generate body classes for views
|
In order to generate body classes for views
|
||||||
|
|
||||||
Scenario: Viewing the root path
|
Scenario: Viewing the root path
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/page-classes.html"
|
When I go to "/page-classes.html"
|
||||||
Then I should see "page-classes"
|
Then I should see "page-classes"
|
||||||
|
|
||||||
Scenario: Viewing a tier-1 path
|
Scenario: Viewing a tier-1 path
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/sub1/page-classes.html"
|
When I go to "/sub1/page-classes.html"
|
||||||
Then I should see "sub1 sub1_page-classes"
|
Then I should see "sub1 sub1_page-classes"
|
||||||
|
|
||||||
Scenario: Viewing a tier-2 path
|
Scenario: Viewing a tier-2 path
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/sub1/sub2/page-classes.html"
|
When I go to "/sub1/sub2/page-classes.html"
|
||||||
Then I should see "sub1 sub1_sub2 sub1_sub2_page-classes"
|
Then I should see "sub1 sub1_sub2 sub1_sub2_page-classes"
|
|
@ -8,7 +8,7 @@ Feature: Minify CSS
|
||||||
|
|
||||||
Scenario: Rendering external css with the feature disabled
|
Scenario: Rendering external css with the feature disabled
|
||||||
Given "minify_css" feature is "disabled"
|
Given "minify_css" feature is "disabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/stylesheets/site.css"
|
When I go to "/stylesheets/site.css"
|
||||||
Then I should see "55" lines
|
Then I should see "55" lines
|
||||||
|
|
||||||
|
@ -19,6 +19,6 @@ Feature: Minify CSS
|
||||||
|
|
||||||
Scenario: Rendering external css with the feature enabled
|
Scenario: Rendering external css with the feature enabled
|
||||||
Given "minify_css" feature is "enabled"
|
Given "minify_css" feature is "enabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/stylesheets/site.css"
|
When I go to "/stylesheets/site.css"
|
||||||
Then I should see "1" lines
|
Then I should see "1" lines
|
|
@ -6,18 +6,18 @@ Feature: Minify Javascript
|
||||||
|
|
||||||
Scenario: Rendering inline js with the feature disabled
|
Scenario: Rendering inline js with the feature disabled
|
||||||
Given "minify_javascript" feature is "disabled"
|
Given "minify_javascript" feature is "disabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/inline-js.html"
|
When I go to "/inline-js.html"
|
||||||
Then I should see "10" lines
|
Then I should see "10" lines
|
||||||
|
|
||||||
Scenario: Rendering inline js with the feature enabled
|
Scenario: Rendering inline js with the feature enabled
|
||||||
Given "minify_javascript" feature is "enabled"
|
Given "minify_javascript" feature is "enabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/inline-js.html"
|
When I go to "/inline-js.html"
|
||||||
Then I should see "5" lines
|
Then I should see "5" lines
|
||||||
|
|
||||||
Scenario: Rendering inline js (coffeescript) with the feature enabled
|
Scenario: Rendering inline js (coffeescript) with the feature enabled
|
||||||
Given "minify_javascript" feature is "enabled"
|
Given "minify_javascript" feature is "enabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/inline-coffeescript.html"
|
When I go to "/inline-coffeescript.html"
|
||||||
Then I should see "5" lines
|
Then I should see "5" lines
|
|
@ -2,7 +2,7 @@ Feature: Built-in macro view helpers
|
||||||
In order to simplify generating HTML
|
In order to simplify generating HTML
|
||||||
|
|
||||||
Scenario: Using the link_to helper
|
Scenario: Using the link_to helper
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/padrino_test.html"
|
When I go to "/padrino_test.html"
|
||||||
And I should see 'href="test2.com"'
|
And I should see 'href="test2.com"'
|
||||||
And I should see 'src="/images/test2.png"'
|
And I should see 'src="/images/test2.png"'
|
||||||
|
|
|
@ -3,19 +3,19 @@ Feature: Custom layouts
|
||||||
|
|
||||||
Scenario: Using custom :layout attribute
|
Scenario: Using custom :layout attribute
|
||||||
Given page "/custom-layout.html" has layout "custom"
|
Given page "/custom-layout.html" has layout "custom"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/custom-layout.html"
|
When I go to "/custom-layout.html"
|
||||||
Then I should see "Custom Layout"
|
Then I should see "Custom Layout"
|
||||||
|
|
||||||
Scenario: Using with_layout block
|
Scenario: Using with_layout block
|
||||||
Given "/custom-layout.html" with_layout block has layout "custom"
|
Given "/custom-layout.html" with_layout block has layout "custom"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/custom-layout.html"
|
When I go to "/custom-layout.html"
|
||||||
Then I should see "Custom Layout"
|
Then I should see "Custom Layout"
|
||||||
|
|
||||||
Scenario: Using custom :layout attribute with folders
|
Scenario: Using custom :layout attribute with folders
|
||||||
Given page "/custom-layout-dir/" has layout "custom"
|
Given page "/custom-layout-dir/" has layout "custom"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/custom-layout-dir"
|
When I go to "/custom-layout-dir"
|
||||||
Then I should see "Custom Layout"
|
Then I should see "Custom Layout"
|
||||||
When I go to "/custom-layout-dir/"
|
When I go to "/custom-layout-dir/"
|
||||||
|
@ -25,7 +25,7 @@ Feature: Custom layouts
|
||||||
|
|
||||||
Scenario: Using custom :layout attribute with folders
|
Scenario: Using custom :layout attribute with folders
|
||||||
Given page "/custom-layout-dir" has layout "custom"
|
Given page "/custom-layout-dir" has layout "custom"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/custom-layout-dir"
|
When I go to "/custom-layout-dir"
|
||||||
Then I should see "Custom Layout"
|
Then I should see "Custom Layout"
|
||||||
When I go to "/custom-layout-dir/"
|
When I go to "/custom-layout-dir/"
|
||||||
|
@ -35,7 +35,7 @@ Feature: Custom layouts
|
||||||
|
|
||||||
Scenario: Using custom :layout attribute with folders
|
Scenario: Using custom :layout attribute with folders
|
||||||
Given page "/custom-layout-dir/index.html" has layout "custom"
|
Given page "/custom-layout-dir/index.html" has layout "custom"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/custom-layout-dir"
|
When I go to "/custom-layout-dir"
|
||||||
Then I should see "Custom Layout"
|
Then I should see "Custom Layout"
|
||||||
When I go to "/custom-layout-dir/"
|
When I go to "/custom-layout-dir/"
|
||||||
|
|
|
@ -3,26 +3,26 @@ Feature: Relative Assets
|
||||||
|
|
||||||
Scenario: Rendering css with the feature disabled
|
Scenario: Rendering css with the feature disabled
|
||||||
Given "relative_assets" feature is "disabled"
|
Given "relative_assets" feature is "disabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/stylesheets/relative_assets.css"
|
When I go to "/stylesheets/relative_assets.css"
|
||||||
Then I should not see "url('../"
|
Then I should not see "url('../"
|
||||||
And I should see "/images/blank.gif"
|
And I should see "/images/blank.gif"
|
||||||
|
|
||||||
Scenario: Rendering html with the feature disabled
|
Scenario: Rendering html with the feature disabled
|
||||||
Given "relative_assets" feature is "disabled"
|
Given "relative_assets" feature is "disabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/relative_image.html"
|
When I go to "/relative_image.html"
|
||||||
Then I should see "/images/blank.gif"
|
Then I should see "/images/blank.gif"
|
||||||
|
|
||||||
Scenario: Rendering css with the feature enabled
|
Scenario: Rendering css with the feature enabled
|
||||||
Given "relative_assets" feature is "enabled"
|
Given "relative_assets" feature is "enabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/stylesheets/relative_assets.css"
|
When I go to "/stylesheets/relative_assets.css"
|
||||||
Then I should see "url('../images/blank.gif"
|
Then I should see "url('../images/blank.gif"
|
||||||
|
|
||||||
Scenario: Rendering html with the feature disabled
|
Scenario: Rendering html with the feature disabled
|
||||||
Given "relative_assets" feature is "enabled"
|
Given "relative_assets" feature is "enabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/relative_image.html"
|
When I go to "/relative_image.html"
|
||||||
Then I should not see "/images/blank.gif"
|
Then I should not see "/images/blank.gif"
|
||||||
And I should see "images/blank.gif"
|
And I should see "images/blank.gif"
|
||||||
|
@ -30,14 +30,14 @@ Feature: Relative Assets
|
||||||
Scenario: Rendering html with a custom images_dir
|
Scenario: Rendering html with a custom images_dir
|
||||||
Given "relative_assets" feature is "enabled"
|
Given "relative_assets" feature is "enabled"
|
||||||
And "images_dir" is set to "img"
|
And "images_dir" is set to "img"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/stylesheets/relative_assets.css"
|
When I go to "/stylesheets/relative_assets.css"
|
||||||
Then I should see "url('../img/blank.gif"
|
Then I should see "url('../img/blank.gif"
|
||||||
|
|
||||||
Scenario: Rendering css with a custom images_dir
|
Scenario: Rendering css with a custom images_dir
|
||||||
Given "relative_assets" feature is "enabled"
|
Given "relative_assets" feature is "enabled"
|
||||||
And "images_dir" is set to "img"
|
And "images_dir" is set to "img"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/relative_image.html"
|
When I go to "/relative_image.html"
|
||||||
Then I should not see "/images/blank.gif"
|
Then I should not see "/images/blank.gif"
|
||||||
Then I should not see "/img/blank.gif"
|
Then I should not see "/img/blank.gif"
|
||||||
|
|
|
@ -2,11 +2,11 @@ Feature: Support SCSS Syntax
|
||||||
In order to offer an alternative when writing Sass
|
In order to offer an alternative when writing Sass
|
||||||
|
|
||||||
Scenario: Rendering scss
|
Scenario: Rendering scss
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/stylesheets/site_scss.css"
|
When I go to "/stylesheets/site_scss.css"
|
||||||
Then I should see "html"
|
Then I should see "html"
|
||||||
|
|
||||||
Scenario: Rendering scss
|
Scenario: Rendering scss
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/stylesheets/layout.css"
|
When I go to "/stylesheets/layout.css"
|
||||||
Then I should see "html"
|
Then I should see "html"
|
|
@ -1,6 +1,6 @@
|
||||||
Feature: Sinatra Routes
|
Feature: Sinatra Routes
|
||||||
|
|
||||||
Scenario: Rendering html
|
Scenario: Rendering html
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/sinatra_test"
|
When I go to "/sinatra_test"
|
||||||
Then I should see "Ratpack"
|
Then I should see "Ratpack"
|
|
@ -2,6 +2,6 @@ Feature: Support slim templating language
|
||||||
In order to offer an alternative to Haml
|
In order to offer an alternative to Haml
|
||||||
|
|
||||||
Scenario: Rendering Slim
|
Scenario: Rendering Slim
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/slim.html"
|
When I go to "/slim.html"
|
||||||
Then I should see "<h1>Welcome to Slim</h1>"
|
Then I should see "<h1>Welcome to Slim</h1>"
|
|
@ -1,6 +1,6 @@
|
||||||
Feature: Sprockets
|
Feature: Sprockets
|
||||||
|
|
||||||
Scenario: Sprockets require
|
Scenario: Sprockets require
|
||||||
Given the Server is running
|
Given the Server is running at "test-app"
|
||||||
When I go to "/javascripts/sprockets_base.js"
|
When I go to "/javascripts/sprockets_base.js"
|
||||||
Then I should see "sprockets_sub_function"
|
Then I should see "sprockets_sub_function"
|
|
@ -1,35 +1,39 @@
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'middleman/cli'
|
|
||||||
|
|
||||||
Given /^a built test app$/ do
|
Given /^a built app at "([^"]*)"$/ do |path|
|
||||||
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
||||||
build_cmd = File.expand_path(File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "bin", "middleman build"))
|
target = File.join(root, "fixtures", path)
|
||||||
|
build_cmd = File.expand_path(File.join(root, "bin", "middleman build"))
|
||||||
`cd #{target} && #{build_cmd}`
|
`cd #{target} && #{build_cmd}`
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Then /^cleanup built app at "([^"]*)"$/ do |path|
|
||||||
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
||||||
|
target = File.join(root, "fixtures", path, "build")
|
||||||
|
FileUtils.rm_rf(target)
|
||||||
|
end
|
||||||
|
|
||||||
Given /^a built test app with flags "([^"]*)"$/ do |flags|
|
Given /^a built test app with flags "([^"]*)"$/ do |flags|
|
||||||
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
||||||
build_cmd = File.expand_path(File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "bin", "middleman build"))
|
build_cmd = File.expand_path(File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "bin", "middleman build"))
|
||||||
`cd #{target} && #{build_cmd} #{flags}`
|
`cd #{target} && #{build_cmd} #{flags}`
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^cleanup built test app$/ do
|
Then /^"([^"]*)" should exist at "([^"]*)"$/ do |target_file, path|
|
||||||
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build")
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
||||||
FileUtils.rm_rf(target)
|
target = File.join(root, "fixtures", path, "build", target_file)
|
||||||
end
|
|
||||||
|
|
||||||
Then /^"([^"]*)" should exist$/ do |target_file,|
|
|
||||||
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build", target_file)
|
|
||||||
File.exists?(target).should be_true
|
File.exists?(target).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^"([^"]*)" should exist and include "([^"]*)"$/ do |target_file, expected|
|
Then /^"([^"]*)" should exist at "([^"]*)" and include "([^"]*)"$/ do |target_file, path, expected|
|
||||||
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build", target_file)
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
||||||
|
target = File.join(root, "fixtures", path, "build", target_file)
|
||||||
File.exists?(target).should be_true
|
File.exists?(target).should be_true
|
||||||
File.read(target).should include(expected)
|
File.read(target).should include(expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^"([^"]*)" should not exist$/ do |target_file|
|
Then /^"([^"]*)" should not exist at "([^"]*)"$/ do |target_file, path|
|
||||||
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build", target_file)
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
||||||
|
target = File.join(root, "fixtures", path, "build", target_file)
|
||||||
File.exists?(target).should be_false
|
File.exists?(target).should be_false
|
||||||
end
|
end
|
|
@ -15,9 +15,10 @@ Given /^current environment is "([^\"]*)"$/ do |env|
|
||||||
@current_env = env.to_sym
|
@current_env = env.to_sym
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^the Server is running$/ do
|
Given /^the Server is running at "([^\"]*)"$/ do |app_path|
|
||||||
@server ||= Middleman.server
|
@server ||= Middleman.server
|
||||||
@server.set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
||||||
|
@server.set :root, File.join(root, "fixtures", app_path)
|
||||||
@browser = Rack::Test::Session.new(Rack::MockSession.new(@server.new))
|
@browser = Rack::Test::Session.new(Rack::MockSession.new(@server.new))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,12 @@ Feature: Tiny Src
|
||||||
|
|
||||||
Scenario: Rendering html with the feature disabled
|
Scenario: Rendering html with the feature disabled
|
||||||
Given "tiny_src" feature is "disabled"
|
Given "tiny_src" feature is "disabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/tiny_src.html"
|
When I go to "/tiny_src.html"
|
||||||
Then I should see "http://test.com/image.jpg"
|
Then I should see "http://test.com/image.jpg"
|
||||||
|
|
||||||
Scenario: Rendering html with the feature enabled
|
Scenario: Rendering html with the feature enabled
|
||||||
Given "tiny_src" feature is "enabled"
|
Given "tiny_src" feature is "enabled"
|
||||||
And the Server is running
|
And the Server is running at "test-app"
|
||||||
When I go to "/tiny_src.html"
|
When I go to "/tiny_src.html"
|
||||||
Then I should see "http://i.tinysrc.mobi/http://test.com/image.jpg"
|
Then I should see "http://i.tinysrc.mobi/http://test.com/image.jpg"
|
|
@ -0,0 +1 @@
|
||||||
|
Indexable
|
2
fixtures/indexable-app/config.rb
Normal file
2
fixtures/indexable-app/config.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
activate :directory_indexes
|
||||||
|
page "/leave_me_alone.html", :directory_index => false
|
1
fixtures/indexable-app/source/a_folder/needs_index.html
Normal file
1
fixtures/indexable-app/source/a_folder/needs_index.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Indexable
|
1
fixtures/indexable-app/source/leave_me_alone.html
Normal file
1
fixtures/indexable-app/source/leave_me_alone.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Stay away
|
1
fixtures/indexable-app/source/needs_index.html
Normal file
1
fixtures/indexable-app/source/needs_index.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Indexable
|
1
fixtures/test-app/source/a_folder/needs_index.html
Normal file
1
fixtures/test-app/source/a_folder/needs_index.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Indexable
|
1
fixtures/test-app/source/needs_index.html
Normal file
1
fixtures/test-app/source/needs_index.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Indexable
|
|
@ -149,6 +149,9 @@ module Middleman
|
||||||
|
|
||||||
# Automatically resize images for mobile devises
|
# Automatically resize images for mobile devises
|
||||||
# autoload :TinySrc, "middleman/features/tiny_src"
|
# autoload :TinySrc, "middleman/features/tiny_src"
|
||||||
|
|
||||||
|
# Automatically convert filename.html files into filename/index.html
|
||||||
|
autoload :DirectoryIndexes, "middleman/features/directory_indexes"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.server(&block)
|
def self.server(&block)
|
||||||
|
|
|
@ -86,7 +86,9 @@ module Middleman::Base
|
||||||
request_path = request.path_info.gsub("%20", " ")
|
request_path = request.path_info.gsub("%20", " ")
|
||||||
result = resolve_template(request_path, :raise_exceptions => false)
|
result = resolve_template(request_path, :raise_exceptions => false)
|
||||||
|
|
||||||
if result
|
should_be_ignored = !(request["is_proxy"]) && settings.excluded_paths.include?("/#{request_path}")
|
||||||
|
|
||||||
|
if result && !should_be_ignored
|
||||||
extensionless_path, template_engine = result
|
extensionless_path, template_engine = result
|
||||||
|
|
||||||
# Return static files
|
# Return static files
|
||||||
|
@ -119,6 +121,27 @@ module Middleman::Base
|
||||||
super(option, value, &nil)
|
super(option, value, &nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def build_reroute(&block)
|
||||||
|
@build_rerouters ||= []
|
||||||
|
@build_rerouters << block
|
||||||
|
end
|
||||||
|
|
||||||
|
def reroute_builder(desination, request_path)
|
||||||
|
@build_rerouters ||= []
|
||||||
|
|
||||||
|
result = [desination, request_path]
|
||||||
|
|
||||||
|
@build_rerouters.each do |block|
|
||||||
|
output = block.call(desination, request_path)
|
||||||
|
if output
|
||||||
|
result = output
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
result
|
||||||
|
end
|
||||||
|
|
||||||
def before_processing(&block)
|
def before_processing(&block)
|
||||||
@before_processes ||= []
|
@before_processes ||= []
|
||||||
@before_processes << block
|
@before_processes << block
|
||||||
|
|
|
@ -15,11 +15,15 @@ module Middleman
|
||||||
context = instance_eval('binding')
|
context = instance_eval('binding')
|
||||||
|
|
||||||
request_path = destination.sub(/^#{SHARED_SERVER.build_dir}/, "")
|
request_path = destination.sub(/^#{SHARED_SERVER.build_dir}/, "")
|
||||||
return if SHARED_SERVER.excluded_paths.include?(request_path)
|
|
||||||
|
|
||||||
create_file destination, nil, config do
|
begin
|
||||||
Middleman::Builder.shared_rack.get(request_path.gsub(/\s/, "%20"))
|
destination, request_page = SHARED_SERVER.reroute_builder(destination, request_path)
|
||||||
Middleman::Builder.shared_rack.last_response.body
|
|
||||||
|
create_file destination, nil, config do
|
||||||
|
Middleman::Builder.shared_rack.get(request_path.gsub(/\s/, "%20"))
|
||||||
|
Middleman::Builder.shared_rack.last_response.body
|
||||||
|
end
|
||||||
|
rescue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,10 @@ module Middleman::CoreExtensions::Routing
|
||||||
app.set :proxied_paths, {}
|
app.set :proxied_paths, {}
|
||||||
app.set :excluded_paths, []
|
app.set :excluded_paths, []
|
||||||
|
|
||||||
|
app.build_reroute do |destination, request_path|
|
||||||
|
throw if app.settings.excluded_paths.include?(request_path)
|
||||||
|
end
|
||||||
|
|
||||||
# Normalize the path and add index if we're looking at a directory
|
# Normalize the path and add index if we're looking at a directory
|
||||||
app.before_processing do
|
app.before_processing do
|
||||||
request.path_info = self.class.path_to_index(request.path)
|
request.path_info = self.class.path_to_index(request.path)
|
||||||
|
@ -39,7 +43,7 @@ module Middleman::CoreExtensions::Routing
|
||||||
end
|
end
|
||||||
|
|
||||||
def paths_for_url(url)
|
def paths_for_url(url)
|
||||||
url = url.gsub(%r{#{settings.index_file}$}, "")
|
url = url.gsub(%r{\/#{settings.index_file}$}, "")
|
||||||
url = url.gsub(%r{(\/)$}, "") if url.length > 1
|
url = url.gsub(%r{(\/)$}, "") if url.length > 1
|
||||||
|
|
||||||
paths = [url]
|
paths = [url]
|
||||||
|
@ -76,6 +80,7 @@ module Middleman::CoreExtensions::Routing
|
||||||
paths_for_url(url).each do |p|
|
paths_for_url(url).each do |p|
|
||||||
get(p) do
|
get(p) do
|
||||||
if settings.proxied_paths.has_key?(url)
|
if settings.proxied_paths.has_key?(url)
|
||||||
|
request["is_proxy"] = true
|
||||||
request.path_info = settings.proxied_paths[url]
|
request.path_info = settings.proxied_paths[url]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ module Middleman
|
||||||
end
|
end
|
||||||
|
|
||||||
app.get("/#{app.blog_permalink}") do
|
app.get("/#{app.blog_permalink}") do
|
||||||
$stderr.puts "*" * 500
|
|
||||||
process_request({
|
process_request({
|
||||||
:layout => app.blog_layout,
|
:layout => app.blog_layout,
|
||||||
:layout_engine => app.blog_layout_engine
|
:layout_engine => app.blog_layout_engine
|
||||||
|
|
47
lib/middleman/features/directory_indexes.rb
Normal file
47
lib/middleman/features/directory_indexes.rb
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
module Middleman::Features::DirectoryIndexes
|
||||||
|
class << self
|
||||||
|
def registered(app)
|
||||||
|
app.set :ignored_directory_indexes, []
|
||||||
|
app.extend ClassMethods
|
||||||
|
|
||||||
|
app.build_reroute do |destination, request_path|
|
||||||
|
indexed_path = request_path.gsub(/\/$/, "") + ".html"
|
||||||
|
|
||||||
|
if app.settings.ignored_directory_indexes.include?(request_path)
|
||||||
|
false
|
||||||
|
else
|
||||||
|
[
|
||||||
|
destination.gsub(/\.html$/, "/index.html"),
|
||||||
|
request_path.gsub(/\.html$/, "/index.html")
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
app.before do
|
||||||
|
indexed_path = request.path_info.gsub(/\/$/, "") + ".html"
|
||||||
|
|
||||||
|
if !settings.ignored_directory_indexes.include?(indexed_path)
|
||||||
|
parts = request.path_info.split("/")
|
||||||
|
last_part = parts.last
|
||||||
|
last_part_ext = File.extname(last_part)
|
||||||
|
|
||||||
|
if last_part_ext.blank?
|
||||||
|
# This is a folder, redirect to index
|
||||||
|
request.path_info = indexed_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
alias :included :registered
|
||||||
|
end
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
|
def page(url, options={}, &block)
|
||||||
|
if options.has_key?(:directory_index) && !options["directory_index"]
|
||||||
|
settings.ignored_directory_indexes << url
|
||||||
|
else
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue