beans-middleman 1.0.5
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/LICENSE +20 -0
- data/README.rdoc +15 -0
- data/Rakefile +9 -0
- data/bin/mm-build +15 -0
- data/bin/mm-init +37 -0
- data/bin/mm-preview +12 -0
- data/bin/mm-server +67 -0
- data/features/builder.feature +16 -0
- data/features/coffee-script.feature +7 -0
- data/features/generator.feature +8 -0
- data/features/helpers_auto_stylesheet_link_tag.feature +17 -0
- data/features/helpers_page_classes.feature +17 -0
- data/features/less-css.feature +7 -0
- data/features/minify_css.feature +22 -0
- data/features/minify_javascript.feature +12 -0
- data/features/padrino_helpers.feature +10 -0
- data/features/page_alias_and_layouts.feature +12 -0
- data/features/scss-support.feature +7 -0
- data/features/step_definitions/asset_host_steps.rb +7 -0
- data/features/step_definitions/builder_steps.rb +23 -0
- data/features/step_definitions/env.rb +3 -0
- data/features/step_definitions/generator_steps.rb +30 -0
- data/features/step_definitions/middleman_steps.rb +29 -0
- data/features/step_definitions/page_layout_steps.rb +13 -0
- data/features/w_asset_host.feature +12 -0
- data/features/x_automatic_image_sizes.feature +14 -0
- data/features/y_cache_buster.feature +22 -0
- data/features/z_relative_assets.feature +12 -0
- data/fixtures/test-app/config.rb +28 -0
- data/fixtures/test-app/public/images/blank.gif +0 -0
- data/fixtures/test-app/public/static.html +1 -0
- data/fixtures/test-app/public/stylesheets/auto-css.css +0 -0
- data/fixtures/test-app/public/stylesheets/static.css +2 -0
- data/fixtures/test-app/public/stylesheets/sub1/auto-css.css +0 -0
- data/fixtures/test-app/public/stylesheets/sub1/sub2/auto-css.css +0 -0
- data/fixtures/test-app/views/_partial.haml +1 -0
- data/fixtures/test-app/views/asset_host.html.haml +1 -0
- data/fixtures/test-app/views/auto-css.html.haml +1 -0
- data/fixtures/test-app/views/auto-image-sizes.html.haml +1 -0
- data/fixtures/test-app/views/cache-buster.html.haml +2 -0
- data/fixtures/test-app/views/custom-layout.html.haml +1 -0
- data/fixtures/test-app/views/index.html.haml +1 -0
- data/fixtures/test-app/views/inline-css.html.haml +4 -0
- data/fixtures/test-app/views/inline-js.html.haml +7 -0
- data/fixtures/test-app/views/javascripts/coffee_test.js.coffee +3 -0
- data/fixtures/test-app/views/layout.haml +6 -0
- data/fixtures/test-app/views/layouts/custom.haml +5 -0
- data/fixtures/test-app/views/padrino_test.html.haml +5 -0
- data/fixtures/test-app/views/page-classes.html.haml +1 -0
- data/fixtures/test-app/views/services/index.html.haml +1 -0
- data/fixtures/test-app/views/stylesheets/asset_host.css.sass +3 -0
- data/fixtures/test-app/views/stylesheets/relative_assets.css.sass +3 -0
- data/fixtures/test-app/views/stylesheets/site.css.sass +1 -0
- data/fixtures/test-app/views/stylesheets/site_scss.css.scss +1 -0
- data/fixtures/test-app/views/stylesheets/test_less.css.less +5 -0
- data/lib/middleman/assets.rb +33 -0
- data/lib/middleman/builder.rb +60 -0
- data/lib/middleman/config.ru +2 -0
- data/lib/middleman/features/asset_host.rb +22 -0
- data/lib/middleman/features/automatic_image_sizes/fastimage.rb +287 -0
- data/lib/middleman/features/automatic_image_sizes.rb +33 -0
- data/lib/middleman/features/cache_buster.rb +44 -0
- data/lib/middleman/features/code_ray.rb +12 -0
- data/lib/middleman/features/default_helpers.rb +61 -0
- data/lib/middleman/features/live_reload.rb +21 -0
- data/lib/middleman/features/minify_css.rb +10 -0
- data/lib/middleman/features/minify_javascript/rack.rb +31 -0
- data/lib/middleman/features/minify_javascript.rb +21 -0
- data/lib/middleman/features/partials.rb +15 -0
- data/lib/middleman/features/relative_assets.rb +36 -0
- data/lib/middleman/features/slickmap/template.html.haml +27 -0
- data/lib/middleman/features/slickmap.rb +89 -0
- data/lib/middleman/features/smush_pngs.rb +38 -0
- data/lib/middleman/features/ugly_haml.rb +8 -0
- data/lib/middleman/features.rb +37 -0
- data/lib/middleman/renderers/haml.rb +42 -0
- data/lib/middleman/renderers/sass.rb +70 -0
- data/lib/middleman/server.rb +165 -0
- data/lib/middleman/template/config.rbt +64 -0
- data/lib/middleman/template/views/index.html.haml +4 -0
- data/lib/middleman/template/views/layout.haml +13 -0
- data/lib/middleman/template/views/stylesheets/site.css.sass +27 -0
- data/lib/middleman/templater+dynamic_renderer.rb +26 -0
- data/lib/middleman.rb +15 -0
- metadata +452 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Thomas Reynolds
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
= middleman
|
2
|
+
|
3
|
+
The Middleman is ever-vigilant against tag-soup, unreadable CSS and repetition. He stands-watch over your Haml, Sass, Less and CoffeeScript producing only the cleanest and efficient markup.
|
4
|
+
|
5
|
+
== Getting Started
|
6
|
+
|
7
|
+
Everything you need to know is on the wiki: http://github.com/tdreyno/middleman/wiki
|
8
|
+
|
9
|
+
== Mailing List
|
10
|
+
|
11
|
+
If you have questions, answers can be found on the mailing list: http://groups.google.com/group/middleman-users
|
12
|
+
|
13
|
+
== Copyright
|
14
|
+
|
15
|
+
Copyright (c) 2010 Thomas Reynolds. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'lib/middleman'
|
2
|
+
require 'rake'
|
3
|
+
require 'cucumber/rake/task'
|
4
|
+
|
5
|
+
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
6
|
+
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
7
|
+
end
|
8
|
+
|
9
|
+
task :default => :cucumber
|
data/bin/mm-build
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
if ARGV[0] && ARGV[0] == 'preview'
|
4
|
+
ENV['MM_ENV'] = ARGV.shift
|
5
|
+
else
|
6
|
+
ENV['MM_ENV'] = 'build'
|
7
|
+
end
|
8
|
+
# Require app
|
9
|
+
require File.join(File.dirname(__FILE__), "..", "lib", "middleman")
|
10
|
+
require 'middleman/builder'
|
11
|
+
|
12
|
+
# Middleman::Server.init!
|
13
|
+
Middleman::Builder.init!
|
14
|
+
|
15
|
+
Middleman::Generators.run_cli(Dir.pwd, 'mm-build', 1, %w(build --force).concat(ARGV))
|
data/bin/mm-init
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require File.join(File.dirname(File.dirname(__FILE__)), 'lib', 'middleman')
|
3
|
+
require 'templater'
|
4
|
+
|
5
|
+
module Generators
|
6
|
+
extend Templater::Manifold
|
7
|
+
desc "Generator for streamlining staticmatic"
|
8
|
+
|
9
|
+
class NewSite < Templater::Generator
|
10
|
+
desc "Creates a new middleman scaffold."
|
11
|
+
first_argument :location, :required => true, :desc => "Project location"
|
12
|
+
|
13
|
+
option :css_dir, :desc => 'The path to the css files'
|
14
|
+
option :js_dir, :desc => 'The path to the javascript files'
|
15
|
+
option :images_dir, :desc => 'The path to the image files'
|
16
|
+
|
17
|
+
def destination_root
|
18
|
+
File.expand_path(location)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.source_root
|
22
|
+
File.join(File.dirname(__FILE__), '..', 'lib', 'middleman', 'template')
|
23
|
+
end
|
24
|
+
|
25
|
+
template :config, "config.rb"
|
26
|
+
glob! :views
|
27
|
+
glob! :public
|
28
|
+
|
29
|
+
empty_directory :stylesheets, "public/stylesheets"#, File.join("public", css_dir)
|
30
|
+
empty_directory :javascripts, "public/javascripts"#, File.join("public", js_dir)
|
31
|
+
empty_directory :images, "public/images"#, File.join("public", images_dir)
|
32
|
+
end
|
33
|
+
|
34
|
+
add :setup, NewSite
|
35
|
+
end
|
36
|
+
|
37
|
+
Generators.run_cli(Dir.pwd, 'mm-init', 1, %w(setup).concat(ARGV))
|
data/bin/mm-preview
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
ENV['MM_ENV'] = 'preview'
|
4
|
+
|
5
|
+
# Require app
|
6
|
+
require File.join(File.dirname(__FILE__), "..", "lib", "middleman")
|
7
|
+
require 'middleman/builder'
|
8
|
+
|
9
|
+
# Middleman::Server.init!
|
10
|
+
Middleman::Builder.init!
|
11
|
+
|
12
|
+
Middleman::Generators.run_cli(Dir.pwd, 'mm-build', 1, %w(build --force).concat(ARGV))
|
data/bin/mm-server
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Non-blocking site rebuilding
|
4
|
+
trap("TSTP") do
|
5
|
+
fork do
|
6
|
+
require "open3"
|
7
|
+
first_run = true
|
8
|
+
Open3.popen3(%Q{cd "#{Dir.pwd}" && #{File.join(File.dirname(__FILE__), "mm-build")} | grep FORCED}) do |stdin, stdout, stderr|
|
9
|
+
puts "\n== Building the site..."
|
10
|
+
stdout.readlines.each do |l|
|
11
|
+
puts "== Updated:" if first_run
|
12
|
+
puts " " + l.split("[FORCED]").last.chomp
|
13
|
+
first_run = false
|
14
|
+
end
|
15
|
+
puts "== Build complete"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'optparse'
|
21
|
+
|
22
|
+
# Require Middleman
|
23
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'middleman')
|
24
|
+
|
25
|
+
env = ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development'
|
26
|
+
options = { :Port => 4567, :AccessLog => [] }
|
27
|
+
|
28
|
+
OptionParser.new { |opts|
|
29
|
+
opts.banner = "Usage: mm-server [rack options]"
|
30
|
+
opts.separator ""
|
31
|
+
opts.separator "Rack options:"
|
32
|
+
opts.on("-p", "--port PORT", "use PORT (default: 4567)") { |port|
|
33
|
+
options[:Port] = port
|
34
|
+
}
|
35
|
+
opts.on("-E", "--env ENVIRONMENT", "use ENVIRONMENT for defaults (default: development)") { |e|
|
36
|
+
env = e
|
37
|
+
}
|
38
|
+
opts.on("--debug", "Debug mode") {
|
39
|
+
::Middleman::Server.set :logging, true
|
40
|
+
}
|
41
|
+
|
42
|
+
opts.parse! ARGV
|
43
|
+
}
|
44
|
+
|
45
|
+
ENV['RACK_ENV'] = env
|
46
|
+
|
47
|
+
class Middleman::Server
|
48
|
+
set :root, Dir.pwd
|
49
|
+
end
|
50
|
+
|
51
|
+
require 'shotgun'
|
52
|
+
config = File.join(File.dirname(__FILE__), '..', 'lib', 'middleman', 'config.ru')
|
53
|
+
app = Shotgun.new(config, &lambda { |inner_app| Middleman::Server })
|
54
|
+
|
55
|
+
require 'rubygems'
|
56
|
+
require 'thin'
|
57
|
+
Thin::Logging.silent = true
|
58
|
+
|
59
|
+
::Rack::Mime::MIME_TYPES.merge!({
|
60
|
+
'.eot' => 'application/vnd.ms-fontobject',
|
61
|
+
'.woff' => 'application/octet-stream',
|
62
|
+
'.ttf' => 'application/octet-stream'
|
63
|
+
})
|
64
|
+
|
65
|
+
Rack::Handler::Thin.run app, options do |inst|
|
66
|
+
puts "== The Middleman is standing watch on port #{options[:Port]}"
|
67
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Builder
|
2
|
+
In order to output static html and css for delivery
|
3
|
+
|
4
|
+
Scenario: Checking built folder for content
|
5
|
+
Given a built test app
|
6
|
+
Then "index.html" should exist and include "Comment in layout"
|
7
|
+
Then "javascripts/coffee_test.js" should exist and include "Array.prototype.slice"
|
8
|
+
Then "index.html" should exist and include "<h1>Welcome</h1>"
|
9
|
+
Then "static.html" should exist and include "Static, no code!"
|
10
|
+
Then "services/index.html" should exist and include "Services"
|
11
|
+
Then "stylesheets/site.css" should exist and include "html, body, div, span"
|
12
|
+
Then "stylesheets/site_scss.css" should exist and include "html, body, div, span"
|
13
|
+
Then "stylesheets/test_less.css" should exist and include "666"
|
14
|
+
Then "stylesheets/static.css" should exist and include "body"
|
15
|
+
Then "_partial.html" should not exist
|
16
|
+
And cleanup built test app
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Feature: Generator
|
2
|
+
In order to generate static assets for client
|
3
|
+
|
4
|
+
Scenario: Copying template files
|
5
|
+
Given generated directory at "generator-test"
|
6
|
+
Then template files should exist at "generator-test"
|
7
|
+
And empty directories should exist at "generator-test"
|
8
|
+
And cleanup at "generator-test"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Feature: Built-in auto_stylesheet_link_tag view helper
|
2
|
+
In order to simplify including css files
|
3
|
+
|
4
|
+
Scenario: Viewing the root path
|
5
|
+
Given the Server is running
|
6
|
+
When I go to "/auto-css.html"
|
7
|
+
Then I should see "stylesheets/auto-css.css"
|
8
|
+
|
9
|
+
Scenario: Viewing a tier-1 path
|
10
|
+
Given the Server is running
|
11
|
+
When I go to "/sub1/auto-css.html"
|
12
|
+
Then I should see "stylesheets/sub1/auto-css.css"
|
13
|
+
|
14
|
+
Scenario: Viewing a tier-2 path
|
15
|
+
Given the Server is running
|
16
|
+
When I go to "/sub1/sub2/auto-css.html"
|
17
|
+
Then I should see "stylesheets/sub1/sub2/auto-css.css"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Feature: Built-in page_classes view helper
|
2
|
+
In order to generate body classes for views
|
3
|
+
|
4
|
+
Scenario: Viewing the root path
|
5
|
+
Given the Server is running
|
6
|
+
When I go to "/page-class.html"
|
7
|
+
Then I should see "page-class"
|
8
|
+
|
9
|
+
Scenario: Viewing a tier-1 path
|
10
|
+
Given the Server is running
|
11
|
+
When I go to "/sub1/page-class.html"
|
12
|
+
Then I should see "sub1 sub1_page-class"
|
13
|
+
|
14
|
+
Scenario: Viewing a tier-2 path
|
15
|
+
Given the Server is running
|
16
|
+
When I go to "/sub1/sub2/page-class.html"
|
17
|
+
Then I should see "sub1 sub1_sub2 sub1_sub2_page-class"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Feature: Minify CSS
|
2
|
+
In order reduce bytes sent to client and appease YSlow
|
3
|
+
|
4
|
+
Scenario: Rendering inline css with the feature disabled
|
5
|
+
Given "minify_css" feature is "disabled"
|
6
|
+
When I go to "/inline-css.html"
|
7
|
+
Then I should see "4" lines
|
8
|
+
|
9
|
+
Scenario: Rendering external css with the feature disabled
|
10
|
+
Given "minify_css" feature is "disabled"
|
11
|
+
When I go to "/stylesheets/site.css"
|
12
|
+
Then I should see "51" lines
|
13
|
+
|
14
|
+
Scenario: Rendering inline css with the feature enabled
|
15
|
+
Given "minify_css" feature is "enabled"
|
16
|
+
When I go to "/inline-css.html"
|
17
|
+
Then I should see "1" lines
|
18
|
+
|
19
|
+
Scenario: Rendering external css with the feature enabled
|
20
|
+
Given "minify_css" feature is "enabled"
|
21
|
+
When I go to "/stylesheets/site.css"
|
22
|
+
Then I should see "1" lines
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Minify Javascript
|
2
|
+
In order reduce bytes sent to client and appease YSlow
|
3
|
+
|
4
|
+
Scenario: Rendering inline js with the feature disabled
|
5
|
+
Given "minify_javascript" feature is "disabled"
|
6
|
+
When I go to "/inline-js.html"
|
7
|
+
Then I should see "10" lines
|
8
|
+
|
9
|
+
Scenario: Rendering inline js with the feature enabled
|
10
|
+
Given "minify_javascript" feature is "enabled"
|
11
|
+
When I go to "/inline-js.html"
|
12
|
+
Then I should see "1" lines
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Feature: Built-in macro view helpers
|
2
|
+
In order to simplify generating HTML
|
3
|
+
|
4
|
+
Scenario: Using the link_to helper
|
5
|
+
Given the Server is running
|
6
|
+
When I go to "/padrino_test.html"
|
7
|
+
And I should see 'href="test2.com"'
|
8
|
+
And I should see 'src="/images/test2.png"'
|
9
|
+
Then I should see 'src="/javascripts/test1.js"'
|
10
|
+
Then I should see 'href="/stylesheets/test1.css"'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Custom layouts
|
2
|
+
In order easily switch between relative and absolute paths
|
3
|
+
|
4
|
+
Scenario: Using custom :layout attribute
|
5
|
+
Given page "/custom-layout.html" has layout "custom"
|
6
|
+
When I go to "/custom-layout.html"
|
7
|
+
Then I should see "Custom Layout"
|
8
|
+
|
9
|
+
Scenario: Using with_layout block
|
10
|
+
Given "/custom-layout.html" with_layout block has layout "custom"
|
11
|
+
When I go to "/custom-layout.html"
|
12
|
+
Then I should see "Custom Layout"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Given /^I am using an asset host$/ do
|
2
|
+
Middleman::Server.activate :asset_host
|
3
|
+
Middleman::Server.set :asset_host do |asset|
|
4
|
+
"http://assets%d.example.com" % (asset.hash % 4)
|
5
|
+
end
|
6
|
+
@browser = Rack::Test::Session.new(Rack::MockSession.new(Middleman::Server.new))
|
7
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
Given /^a built test app$/ do
|
4
|
+
target = File.join(File.dirname(__FILE__), "../", "../", "fixtures", "test-app")
|
5
|
+
build_cmd = File.expand_path(File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "bin", "mm-build"))
|
6
|
+
`cd #{target} && MM_DIR="#{target}" #{build_cmd}`
|
7
|
+
end
|
8
|
+
|
9
|
+
Given /^cleanup built test app$/ do
|
10
|
+
target = File.join(File.dirname(__FILE__), "../", "../", "fixtures", "test-app", "build")
|
11
|
+
FileUtils.rm_rf(target)
|
12
|
+
end
|
13
|
+
|
14
|
+
Then /^"([^"]*)" should exist and include "([^"]*)"$/ do |target_file, expected|
|
15
|
+
target = File.join(File.dirname(__FILE__), "../", "../", "fixtures", "test-app", "build", target_file)
|
16
|
+
File.exists?(target).should be_true
|
17
|
+
File.read(target).should include(expected)
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /^"([^"]*)" should not exist$/ do |target_file|
|
21
|
+
target = File.join(File.dirname(__FILE__), "../", "../", "fixtures", "test-app", "build", target_file)
|
22
|
+
File.exists?(target).should be_false
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
Given /^generated directory at "([^\"]*)"$/ do |dirname|
|
4
|
+
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", dirname)
|
5
|
+
init_cmd = File.expand_path(File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "bin", "mm-init"))
|
6
|
+
`cd #{File.dirname(target)} && #{init_cmd} #{File.basename(target)}`
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^template files should exist at "([^\"]*)"$/ do |dirname|
|
10
|
+
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", dirname)
|
11
|
+
template_glob = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "lib", "middleman", "template", "*/**/*")
|
12
|
+
|
13
|
+
Dir[template_glob].each do |f|
|
14
|
+
next if File.directory?(f)
|
15
|
+
File.exists?("#{target}/#{f.split('template/')[1]}").should be_true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
Then /^empty directories should exist at "([^\"]*)"$/ do |dirname|
|
20
|
+
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", dirname)
|
21
|
+
|
22
|
+
%w(views/stylesheets public/stylesheets public/javascripts public/images).each do |d|
|
23
|
+
File.exists?("#{target}/#{d}").should be_true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
Then /^cleanup at "([^\"]*)"$/ do |dirname|
|
28
|
+
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", dirname)
|
29
|
+
FileUtils.rm_rf(target)
|
30
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Given /^"([^\"]*)" feature is "([^\"]*)"$/ do |feature, state|
|
2
|
+
if state == "enabled"
|
3
|
+
Middleman::Server.activate(feature.to_sym)
|
4
|
+
end
|
5
|
+
@browser = Rack::Test::Session.new(Rack::MockSession.new(Middleman::Server.new))
|
6
|
+
end
|
7
|
+
|
8
|
+
Given /^the Server is running$/ do
|
9
|
+
@browser = Rack::Test::Session.new(Rack::MockSession.new(Middleman::Server.new))
|
10
|
+
end
|
11
|
+
|
12
|
+
When /^I go to "([^\"]*)"$/ do |url|
|
13
|
+
@browser.get(url)
|
14
|
+
end
|
15
|
+
|
16
|
+
Then /^I should see "([^\"]*)"$/ do |expected|
|
17
|
+
@browser.last_response.body.should include(expected)
|
18
|
+
end
|
19
|
+
Then /^I should see '([^\']*)'$/ do |expected|
|
20
|
+
@browser.last_response.body.should include(expected)
|
21
|
+
end
|
22
|
+
|
23
|
+
Then /^I should not see "([^\"]*)"$/ do |expected|
|
24
|
+
@browser.last_response.body.should_not include(expected)
|
25
|
+
end
|
26
|
+
|
27
|
+
Then /^I should see "([^\"]*)" lines$/ do |lines|
|
28
|
+
@browser.last_response.body.chomp.split($/).length.should == lines.to_i
|
29
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Given /^page "([^\"]*)" has layout "([^\"]*)"$/ do |url, layout|
|
2
|
+
Middleman::Server.set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
3
|
+
Middleman::Server.page(url, :layout => layout.to_sym)
|
4
|
+
@browser = Rack::Test::Session.new(Rack::MockSession.new(Middleman::Server.new))
|
5
|
+
end
|
6
|
+
|
7
|
+
Given /^"([^\"]*)" with_layout block has layout "([^\"]*)"$/ do |url, layout|
|
8
|
+
Middleman::Server.set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
9
|
+
Middleman::Server.with_layout(:layout => layout.to_sym) do
|
10
|
+
page(url)
|
11
|
+
end
|
12
|
+
@browser = Rack::Test::Session.new(Rack::MockSession.new(Middleman::Server.new))
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Alternate between multiple asset hosts
|
2
|
+
In order to speed up page loading
|
3
|
+
|
4
|
+
Scenario: Rendering css with the feature enabled
|
5
|
+
Given I am using an asset host
|
6
|
+
When I go to "/stylesheets/asset_host.css"
|
7
|
+
Then I should see "http://assets"
|
8
|
+
|
9
|
+
Scenario: Rendering html with the feature enabled
|
10
|
+
Given I am using an asset host
|
11
|
+
When I go to "/asset_host.html"
|
12
|
+
Then I should see "http://assets"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Automatically detect and insert image dimensions into tags
|
2
|
+
In order to speed up development and appease YSlow
|
3
|
+
|
4
|
+
Scenario: Rendering an image with the feature disabled
|
5
|
+
Given "automatic_image_sizes" feature is "disabled"
|
6
|
+
When I go to "/auto-image-sizes.html"
|
7
|
+
Then I should not see "width="
|
8
|
+
And I should not see "height="
|
9
|
+
|
10
|
+
Scenario: Rendering an image with the feature enabled
|
11
|
+
Given "automatic_image_sizes" feature is "enabled"
|
12
|
+
When I go to "/auto-image-sizes.html"
|
13
|
+
Then I should see "width="
|
14
|
+
And I should see "height="
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Feature: Generate mtime-based query string for busting browser caches
|
2
|
+
In order to display the most recent content for IE & CDNs and appease YSlow
|
3
|
+
|
4
|
+
Scenario: Rendering css with the feature disabled
|
5
|
+
Given "cache_buster" feature is "disabled"
|
6
|
+
When I go to "/stylesheets/relative_assets.css"
|
7
|
+
Then I should not see "?"
|
8
|
+
|
9
|
+
Scenario: Rendering html with the feature disabled
|
10
|
+
Given "cache_buster" feature is "disabled"
|
11
|
+
When I go to "/cache-buster.html"
|
12
|
+
Then I should not see "?"
|
13
|
+
|
14
|
+
Scenario: Rendering css with the feature enabled
|
15
|
+
Given "cache_buster" feature is "enabled"
|
16
|
+
When I go to "/stylesheets/relative_assets.css"
|
17
|
+
Then I should see "?"
|
18
|
+
|
19
|
+
Scenario: Rendering html with the feature enabled
|
20
|
+
Given "cache_buster" feature is "enabled"
|
21
|
+
When I go to "/cache-buster.html"
|
22
|
+
Then I should not see "?"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Relative Assets
|
2
|
+
In order easily switch between relative and absolute paths
|
3
|
+
|
4
|
+
Scenario: Rendering css with the feature disabled
|
5
|
+
Given "relative_assets" feature is "disabled"
|
6
|
+
When I go to "/stylesheets/relative_assets.css"
|
7
|
+
Then I should not see "url('../"
|
8
|
+
|
9
|
+
Scenario: Rendering css with the feature enabled
|
10
|
+
Given "relative_assets" feature is "enabled"
|
11
|
+
When I go to "/stylesheets/relative_assets.css"
|
12
|
+
Then I should see "url('../"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
with_layout false do
|
2
|
+
page "/inline-css.html"
|
3
|
+
page "/inline-js.html"
|
4
|
+
end
|
5
|
+
|
6
|
+
get "/page-class.html" do
|
7
|
+
haml :"page-classes.html", :layout => false
|
8
|
+
end
|
9
|
+
|
10
|
+
get "/sub1/page-class.html" do
|
11
|
+
haml :"page-classes.html", :layout => false
|
12
|
+
end
|
13
|
+
|
14
|
+
get "/sub1/sub2/page-class.html" do
|
15
|
+
haml :"page-classes.html", :layout => false
|
16
|
+
end
|
17
|
+
|
18
|
+
get "/auto-css.html" do
|
19
|
+
haml :"auto-css.html", :layout => false
|
20
|
+
end
|
21
|
+
|
22
|
+
get "/sub1/auto-css.html" do
|
23
|
+
haml :"auto-css.html", :layout => false
|
24
|
+
end
|
25
|
+
|
26
|
+
get "/sub1/sub2/auto-css.html" do
|
27
|
+
haml :"auto-css.html", :layout => false
|
28
|
+
end
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
Static, no code!
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
%p Test
|
@@ -0,0 +1 @@
|
|
1
|
+
= image_tag "blank.gif"
|
@@ -0,0 +1 @@
|
|
1
|
+
= auto_stylesheet_link_tag
|
@@ -0,0 +1 @@
|
|
1
|
+
= image_tag "blank.gif"
|
@@ -0,0 +1 @@
|
|
1
|
+
%h1 Welcome
|
@@ -0,0 +1 @@
|
|
1
|
+
%h1 Welcome
|
@@ -0,0 +1 @@
|
|
1
|
+
= page_classes
|
@@ -0,0 +1 @@
|
|
1
|
+
%h2 Services
|