beans-middleman 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +15 -0
  3. data/Rakefile +9 -0
  4. data/bin/mm-build +15 -0
  5. data/bin/mm-init +37 -0
  6. data/bin/mm-preview +12 -0
  7. data/bin/mm-server +67 -0
  8. data/features/builder.feature +16 -0
  9. data/features/coffee-script.feature +7 -0
  10. data/features/generator.feature +8 -0
  11. data/features/helpers_auto_stylesheet_link_tag.feature +17 -0
  12. data/features/helpers_page_classes.feature +17 -0
  13. data/features/less-css.feature +7 -0
  14. data/features/minify_css.feature +22 -0
  15. data/features/minify_javascript.feature +12 -0
  16. data/features/padrino_helpers.feature +10 -0
  17. data/features/page_alias_and_layouts.feature +12 -0
  18. data/features/scss-support.feature +7 -0
  19. data/features/step_definitions/asset_host_steps.rb +7 -0
  20. data/features/step_definitions/builder_steps.rb +23 -0
  21. data/features/step_definitions/env.rb +3 -0
  22. data/features/step_definitions/generator_steps.rb +30 -0
  23. data/features/step_definitions/middleman_steps.rb +29 -0
  24. data/features/step_definitions/page_layout_steps.rb +13 -0
  25. data/features/w_asset_host.feature +12 -0
  26. data/features/x_automatic_image_sizes.feature +14 -0
  27. data/features/y_cache_buster.feature +22 -0
  28. data/features/z_relative_assets.feature +12 -0
  29. data/fixtures/test-app/config.rb +28 -0
  30. data/fixtures/test-app/public/images/blank.gif +0 -0
  31. data/fixtures/test-app/public/static.html +1 -0
  32. data/fixtures/test-app/public/stylesheets/auto-css.css +0 -0
  33. data/fixtures/test-app/public/stylesheets/static.css +2 -0
  34. data/fixtures/test-app/public/stylesheets/sub1/auto-css.css +0 -0
  35. data/fixtures/test-app/public/stylesheets/sub1/sub2/auto-css.css +0 -0
  36. data/fixtures/test-app/views/_partial.haml +1 -0
  37. data/fixtures/test-app/views/asset_host.html.haml +1 -0
  38. data/fixtures/test-app/views/auto-css.html.haml +1 -0
  39. data/fixtures/test-app/views/auto-image-sizes.html.haml +1 -0
  40. data/fixtures/test-app/views/cache-buster.html.haml +2 -0
  41. data/fixtures/test-app/views/custom-layout.html.haml +1 -0
  42. data/fixtures/test-app/views/index.html.haml +1 -0
  43. data/fixtures/test-app/views/inline-css.html.haml +4 -0
  44. data/fixtures/test-app/views/inline-js.html.haml +7 -0
  45. data/fixtures/test-app/views/javascripts/coffee_test.js.coffee +3 -0
  46. data/fixtures/test-app/views/layout.haml +6 -0
  47. data/fixtures/test-app/views/layouts/custom.haml +5 -0
  48. data/fixtures/test-app/views/padrino_test.html.haml +5 -0
  49. data/fixtures/test-app/views/page-classes.html.haml +1 -0
  50. data/fixtures/test-app/views/services/index.html.haml +1 -0
  51. data/fixtures/test-app/views/stylesheets/asset_host.css.sass +3 -0
  52. data/fixtures/test-app/views/stylesheets/relative_assets.css.sass +3 -0
  53. data/fixtures/test-app/views/stylesheets/site.css.sass +1 -0
  54. data/fixtures/test-app/views/stylesheets/site_scss.css.scss +1 -0
  55. data/fixtures/test-app/views/stylesheets/test_less.css.less +5 -0
  56. data/lib/middleman/assets.rb +33 -0
  57. data/lib/middleman/builder.rb +60 -0
  58. data/lib/middleman/config.ru +2 -0
  59. data/lib/middleman/features/asset_host.rb +22 -0
  60. data/lib/middleman/features/automatic_image_sizes/fastimage.rb +287 -0
  61. data/lib/middleman/features/automatic_image_sizes.rb +33 -0
  62. data/lib/middleman/features/cache_buster.rb +44 -0
  63. data/lib/middleman/features/code_ray.rb +12 -0
  64. data/lib/middleman/features/default_helpers.rb +61 -0
  65. data/lib/middleman/features/live_reload.rb +21 -0
  66. data/lib/middleman/features/minify_css.rb +10 -0
  67. data/lib/middleman/features/minify_javascript/rack.rb +31 -0
  68. data/lib/middleman/features/minify_javascript.rb +21 -0
  69. data/lib/middleman/features/partials.rb +15 -0
  70. data/lib/middleman/features/relative_assets.rb +36 -0
  71. data/lib/middleman/features/slickmap/template.html.haml +27 -0
  72. data/lib/middleman/features/slickmap.rb +89 -0
  73. data/lib/middleman/features/smush_pngs.rb +38 -0
  74. data/lib/middleman/features/ugly_haml.rb +8 -0
  75. data/lib/middleman/features.rb +37 -0
  76. data/lib/middleman/renderers/haml.rb +42 -0
  77. data/lib/middleman/renderers/sass.rb +70 -0
  78. data/lib/middleman/server.rb +165 -0
  79. data/lib/middleman/template/config.rbt +64 -0
  80. data/lib/middleman/template/views/index.html.haml +4 -0
  81. data/lib/middleman/template/views/layout.haml +13 -0
  82. data/lib/middleman/template/views/stylesheets/site.css.sass +27 -0
  83. data/lib/middleman/templater+dynamic_renderer.rb +26 -0
  84. data/lib/middleman.rb +15 -0
  85. 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,7 @@
1
+ Feature: Support coffee-script
2
+ In order to offer an alternative when writing Javascript
3
+
4
+ Scenario: Rendering coffee script
5
+ Given the Server is running
6
+ When I go to "/javascripts/coffee_test.js"
7
+ Then I should see "Array.prototype.slice"
@@ -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,7 @@
1
+ Feature: Support Less CSS
2
+ In order to offer an alternative when writing CSS
3
+
4
+ Scenario: Rendering Less
5
+ Given the Server is running
6
+ When I go to "/stylesheets/test_less.css"
7
+ Then I should see "666"
@@ -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
+ Feature: Support SCSS Syntax
2
+ In order to offer an alternative when writing Sass
3
+
4
+ Scenario: Rendering scss
5
+ Given the Server is running
6
+ When I go to "/stylesheets/site_scss.css"
7
+ Then I should see "html"
@@ -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,3 @@
1
+ ENV["MM_DIR"] = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
2
+ require File.join(File.dirname(File.dirname(File.dirname(__FILE__))), 'lib', 'middleman')
3
+ require "rack/test"
@@ -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
@@ -0,0 +1 @@
1
+ Static, no code!
File without changes
@@ -0,0 +1,2 @@
1
+ body {
2
+ font-size: 12px; }
@@ -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,2 @@
1
+ = stylesheet_link_tag "site.css"
2
+ = javascript_include_tag "empty-with-include.js"
@@ -0,0 +1 @@
1
+ %h1 Welcome
@@ -0,0 +1 @@
1
+ %h1 Welcome
@@ -0,0 +1,4 @@
1
+ :sass
2
+ body
3
+ test: style
4
+ good: deal
@@ -0,0 +1,7 @@
1
+ :javascript
2
+ ;(function() {
3
+ this;
4
+ should();
5
+ all.be();
6
+ on = { one: line };
7
+ });
@@ -0,0 +1,3 @@
1
+ # Splats:
2
+ race = (winner, runners...) ->
3
+ print winner, runners
@@ -0,0 +1,6 @@
1
+ %html
2
+ %head
3
+ %title My Sample Site
4
+ / Comment in layout
5
+ %body
6
+ = yield
@@ -0,0 +1,5 @@
1
+ %html
2
+ %head
3
+ %title Custom Layout
4
+ %body
5
+ = yield
@@ -0,0 +1,5 @@
1
+ = stylesheet_link_tag "test1"
2
+ = javascript_include_tag "test1"
3
+ = image_tag "test2.png", :alt => "alt"
4
+
5
+ = link_to "Has param", "test2.com", :class => "test"
@@ -0,0 +1 @@
1
+ = page_classes
@@ -0,0 +1 @@
1
+ %h2 Services
@@ -0,0 +1,3 @@
1
+ @import "compass"
2
+ h1
3
+ background: image-url("blank.gif")