middleman 2.0.0.rc92 → 2.0.0.rc93

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/CHANGELOG +3 -1
  2. data/Rakefile +1 -40
  3. data/bin/middleman +8 -0
  4. data/bin/mm-build +2 -7
  5. data/bin/mm-init +2 -27
  6. data/bin/mm-server +2 -46
  7. data/features/asset_host.feature +2 -2
  8. data/features/automatic_image_sizes.feature +2 -2
  9. data/features/builder.feature +16 -16
  10. data/features/cache_buster.feature +4 -4
  11. data/features/coffee-script.feature +3 -3
  12. data/features/data.feature +1 -1
  13. data/features/directory_index.feature +27 -0
  14. data/features/dynamic_pages.feature +18 -9
  15. data/features/front-matter.feature +1 -1
  16. data/features/helpers_auto_javascript_include_tag.feature +5 -5
  17. data/features/helpers_auto_stylesheet_link_tag.feature +5 -5
  18. data/features/helpers_page_classes.feature +3 -3
  19. data/features/minify_css.feature +2 -2
  20. data/features/minify_javascript.feature +3 -3
  21. data/features/padrino_helpers.feature +1 -1
  22. data/features/page_alias_and_layouts.feature +5 -5
  23. data/features/relative_assets.feature +6 -6
  24. data/features/scss-support.feature +2 -2
  25. data/features/sinatra.feature +1 -1
  26. data/features/slim.feature +1 -1
  27. data/features/sprockets.feature +1 -1
  28. data/features/step_definitions/builder_steps.rb +22 -17
  29. data/features/step_definitions/generator_steps.rb +1 -1
  30. data/features/step_definitions/middleman_steps.rb +3 -1
  31. data/features/step_definitions/page_layout_steps.rb +0 -2
  32. data/features/support/env.rb +0 -1
  33. data/features/tiny_src.feature +2 -2
  34. data/fixtures/indexable-app/config.rb +2 -0
  35. data/fixtures/indexable-app/source/a_folder/needs_index.html +1 -0
  36. data/fixtures/indexable-app/source/leave_me_alone.html +1 -0
  37. data/fixtures/indexable-app/source/needs_index.html +1 -0
  38. data/fixtures/test-app/config.rb +4 -0
  39. data/fixtures/test-app/source/a_folder/needs_index.html +1 -0
  40. data/fixtures/test-app/source/needs_index.html +1 -0
  41. data/fixtures/test-app/source/should_be_ignored.html +1 -0
  42. data/fixtures/test-app/source/should_be_ignored2.html +1 -0
  43. data/fixtures/test-app/source/should_be_ignored3.html +1 -0
  44. data/lib/middleman.rb +10 -8
  45. data/lib/middleman/base.rb +25 -2
  46. data/lib/middleman/builder.rb +23 -10
  47. data/lib/middleman/cli.rb +84 -0
  48. data/lib/middleman/core_extensions/routing.rb +22 -2
  49. data/lib/middleman/features/blog.rb +0 -1
  50. data/lib/middleman/features/directory_indexes.rb +50 -0
  51. data/lib/middleman/guard.rb +7 -3
  52. data/lib/middleman/version.rb +1 -1
  53. data/middleman.gemspec +9 -9
  54. metadata +110 -88
  55. data/bin/mm-migrate +0 -5
data/CHANGELOG CHANGED
@@ -9,4 +9,6 @@
9
9
  - Support YAML front-matter
10
10
  - Added callback to run code after Compass is configured
11
11
  - Added support for a compass.config file which is passed directly to Compass
12
- - Blog-aware Feature (and project template)
12
+ - Blog-aware Feature (and project template)
13
+ - Thor-based, unified `middleman` binary
14
+ - :directory_indexes feature
data/Rakefile CHANGED
@@ -12,43 +12,4 @@ end
12
12
  require 'rake/testtask'
13
13
  require 'rake/clean'
14
14
 
15
- task :test => ["cucumber"]
16
-
17
- # rocco depends on rdiscount, which makes me sad.
18
- unless defined?(JRUBY_VERSION)
19
- # Bring in Rocco tasks
20
- require 'rocco/tasks'
21
- Rocco::make 'docs/'
22
-
23
- desc 'Build rocco docs'
24
- task :docs => :rocco
25
- directory 'docs/'
26
-
27
- # Make index.html a copy of rocco.html
28
- file 'docs/index.html' => 'docs/middleman.html' do |f|
29
- cp 'docs/middleman.html', 'docs/index.html', :preserve => true
30
- end
31
- task :docs => 'docs/index.html'
32
- CLEAN.include 'docs/index.html'
33
-
34
- desc 'Update gh-pages branch'
35
- task :pages => ['docs/.git', :docs] do
36
- rev = `git rev-parse --short HEAD`.strip
37
- Dir.chdir 'docs' do
38
- sh "git add *.html"
39
- sh "git commit -m 'rebuild pages from #{rev}'" do |ok,res|
40
- if ok
41
- verbose { puts "gh-pages updated" }
42
- sh "git push -q o HEAD:gh-pages"
43
- end
44
- end
45
- end
46
- end
47
-
48
- # Update the pages/ directory clone
49
- file 'docs/.git' => ['docs/', '.git/refs/heads/gh-pages'] do |f|
50
- sh "cd docs && git init -q && git remote add o ../.git" if !File.exist?(f.name)
51
- sh "cd docs && git fetch -q o && git reset -q --hard o/gh-pages && touch ."
52
- end
53
- CLOBBER.include 'docs/.git'
54
- end
15
+ task :test => ["cucumber"]
data/bin/middleman ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ require "rubygems"
3
+
4
+ libdir = File.join(File.dirname(File.dirname(__FILE__)), "lib")
5
+ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
6
+
7
+ require 'middleman'
8
+ Middleman::CLI.start
data/bin/mm-build CHANGED
@@ -1,7 +1,2 @@
1
- #!/usr/bin/env ruby
2
-
3
- ENV['MM_ENV'] = "build"
4
-
5
- # Require app
6
- require File.join(File.dirname(__FILE__), "..", "lib", "middleman")
7
- Middleman::Builder.start
1
+ #!/bin/bash
2
+ /usr/bin/env middleman build $@
data/bin/mm-init CHANGED
@@ -1,27 +1,2 @@
1
- #!/usr/bin/env ruby
2
- require File.join(File.dirname(File.dirname(__FILE__)), 'lib', 'middleman')
3
- require "middleman/templates"
4
-
5
- module Middleman
6
- class Generator < ::Thor::Group
7
- include Thor::Actions
8
-
9
- argument :location, :type => :string, :desc => "New project location"
10
-
11
- available_templates = Middleman::Templates.registered_names.join(", ")
12
- class_option :template, :aliases => "-T", :default => "default", :desc => "Optionally use a pre-defined project template: #{available_templates}"
13
-
14
- class_option :css_dir, :default => "stylesheets", :desc => 'The path to the css files'
15
- class_option :js_dir, :default => "javascripts", :desc => 'The path to the javascript files'
16
- class_option :images_dir, :default => "images", :desc => 'The path to the image files'
17
-
18
- def create_project
19
- key = options[:template].to_sym
20
- key = :default unless Middleman::Templates.registered_templates.has_key?(key)
21
-
22
- Middleman::Templates.registered_templates[key].start
23
- end
24
- end
25
- end
26
-
27
- Middleman::Generator.start
1
+ #!/bin/bash
2
+ /usr/bin/env middleman init $@
data/bin/mm-server CHANGED
@@ -1,46 +1,2 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "rubygems"
4
- require "thor"
5
- require "thor/group"
6
-
7
- # Require Middleman
8
- require File.join(File.dirname(__FILE__), '..', 'lib', 'middleman')
9
-
10
- module Middleman
11
- class GuardServer < ::Thor::Group
12
- include Thor::Actions
13
-
14
- class_option :environment, :aliases => "-e", :default => ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development'
15
-
16
- class_option :port, :aliases => "-p", :default => "4567"
17
- class_option :"livereload-port", :default => "35729"
18
- class_option :"livereload", :default => false, :type => :boolean
19
-
20
- def start_guard
21
- if !File.exists?("config.rb")
22
- $stderr.puts "== Error: Could not find a Middleman project config, perhaps you are in the wrong folder?"
23
- return
24
- end
25
-
26
- # If the old directories exists, use it, but issue warning
27
- if File.exists?("views") || File.exists?("public")
28
- $stderr.puts "== Error: The views and public folders are have been combined. Create a new 'source' folder, add the contents of views and public to it and then remove the empty views and public folders."
29
- return
30
- end
31
-
32
- ENV['RACK_ENV'] = options[:environment]
33
-
34
- livereload_options = {
35
- :port => options[:"livereload-port"]
36
- }
37
- livereload_options = nil unless options[:"livereload"]
38
-
39
- ::Middleman::Guard.start({
40
- :port => options[:port],
41
- }, livereload_options)
42
- end
43
- end
44
- end
45
-
46
- Middleman::GuardServer.start
1
+ #!/bin/bash
2
+ /usr/bin/env middleman server $@
@@ -3,12 +3,12 @@ Feature: Alternate between multiple asset hosts
3
3
 
4
4
  Scenario: Rendering css with the feature enabled
5
5
  Given I am using an asset host
6
- And the Server is running
6
+ And the Server is running at "test-app"
7
7
  When I go to "/stylesheets/asset_host.css"
8
8
  Then I should see "http://assets"
9
9
 
10
10
  Scenario: Rendering html with the feature enabled
11
11
  Given I am using an asset host
12
- And the Server is running
12
+ And the Server is running at "test-app"
13
13
  When I go to "/asset_host.html"
14
14
  Then I should see "http://assets"
@@ -3,14 +3,14 @@ Feature: Automatically detect and insert image dimensions into tags
3
3
 
4
4
  Scenario: Rendering an image with the feature disabled
5
5
  Given "automatic_image_sizes" feature is "disabled"
6
- And the Server is running
6
+ And the Server is running at "test-app"
7
7
  When I go to "/auto-image-sizes.html"
8
8
  Then I should not see "width="
9
9
  And I should not see "height="
10
10
 
11
11
  Scenario: Rendering an image with the feature enabled
12
12
  Given "automatic_image_sizes" feature is "enabled"
13
- And the Server is running
13
+ And the Server is running at "test-app"
14
14
  When I go to "/auto-image-sizes.html"
15
15
  Then I should see "width="
16
16
  And I should see "height="
@@ -2,22 +2,22 @@ Feature: Builder
2
2
  In order to output static html and css for delivery
3
3
 
4
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/static.css" should exist and include "body"
14
- Then "_partial.html" should not exist
15
- Then "spaces in file.html" should exist and include "spaces"
16
- Then "images/Read me (example).txt" should exist
17
- Then "images/Child folder/regular_file(example).txt" should exist
18
- And cleanup built test app
5
+ Given a built app at "test-app"
6
+ Then "index.html" should exist at "test-app" and include "Comment in layout"
7
+ Then "javascripts/coffee_test.js" should exist at "test-app" and include "Array.prototype.slice"
8
+ Then "index.html" should exist at "test-app" and include "<h1>Welcome</h1>"
9
+ Then "static.html" should exist at "test-app" and include "Static, no code!"
10
+ Then "services/index.html" should exist at "test-app" and include "Services"
11
+ Then "stylesheets/site.css" should exist at "test-app" and include "html, body, div, span"
12
+ Then "stylesheets/site_scss.css" should exist at "test-app" and include "html, body, div, span"
13
+ Then "stylesheets/static.css" should exist at "test-app" and include "body"
14
+ Then "_partial.html" should not exist at "test-app"
15
+ Then "spaces in file.html" should exist at "test-app" and include "spaces"
16
+ Then "images/Read me (example).txt" should exist at "test-app"
17
+ Then "images/Child folder/regular_file(example).txt" should exist at "test-app"
18
+ And cleanup built app at "test-app"
19
19
 
20
20
  Scenario: Force relative assets
21
21
  Given a built test app with flags "--relative"
22
- Then "stylesheets/relative_assets.css" should exist and include "../"
23
- And cleanup built test app
22
+ Then "stylesheets/relative_assets.css" should exist at "test-app" and include "../"
23
+ And cleanup built app at "test-app"
@@ -3,24 +3,24 @@ Feature: Generate mtime-based query string for busting browser caches
3
3
 
4
4
  Scenario: Rendering css with the feature disabled
5
5
  Given "cache_buster" feature is "disabled"
6
- And the Server is running
6
+ And the Server is running at "test-app"
7
7
  When I go to "/stylesheets/relative_assets.css"
8
8
  Then I should not see "?"
9
9
 
10
10
  Scenario: Rendering html with the feature disabled
11
11
  Given "cache_buster" feature is "disabled"
12
- And the Server is running
12
+ And the Server is running at "test-app"
13
13
  When I go to "/cache-buster.html"
14
14
  Then I should not see "?"
15
15
 
16
16
  Scenario: Rendering css with the feature enabled
17
17
  Given "cache_buster" feature is "enabled"
18
- And the Server is running
18
+ And the Server is running at "test-app"
19
19
  When I go to "/stylesheets/relative_assets.css"
20
20
  Then I should see "?"
21
21
 
22
22
  Scenario: Rendering html with the feature enabled
23
23
  Given "cache_buster" feature is "enabled"
24
- And the Server is running
24
+ And the Server is running at "test-app"
25
25
  When I go to "/cache-buster.html"
26
26
  Then I should not see "?"
@@ -2,16 +2,16 @@ Feature: Support coffee-script
2
2
  In order to offer an alternative when writing Javascript
3
3
 
4
4
  Scenario: Rendering coffee script
5
- Given the Server is running
5
+ Given the Server is running at "test-app"
6
6
  When I go to "/javascripts/coffee_test.js"
7
7
  Then I should see "Array.prototype.slice"
8
8
 
9
9
  Scenario: Rendering coffee-script with :coffeescript haml-filter
10
- Given the Server is running
10
+ Given the Server is running at "test-app"
11
11
  When I go to "/inline-coffeescript.html"
12
12
  Then I should see "Array.prototype.slice"
13
13
 
14
14
  Scenario: Rendering broken coffee
15
- Given the Server is running
15
+ Given the Server is running at "test-app"
16
16
  When I go to "/javascripts/broken-coffee.js"
17
17
  Then I should see "Reserved word"
@@ -2,6 +2,6 @@ Feature: Local Data API
2
2
  In order to abstract content from structure
3
3
 
4
4
  Scenario: Rendering html
5
- Given the Server is running
5
+ Given the Server is running at "test-app"
6
6
  When I go to "/data.html"
7
7
  Then I should see "One:Two"
@@ -0,0 +1,27 @@
1
+ Feature: Directory Index
2
+ In order output Apache-friendly directories and indexes
3
+
4
+ Scenario: Checking built folder for content
5
+ Given a built app at "indexable-app"
6
+ Then "needs_index/index.html" should exist at "indexable-app" and include "Indexable"
7
+ Then "a_folder/needs_index/index.html" should exist at "indexable-app" and include "Indexable"
8
+ Then "leave_me_alone.html" should exist at "indexable-app" and include "Stay away"
9
+ Then "needs_index.html" should not exist at "indexable-app"
10
+ Then "a_folder/needs_index.html" should not exist at "indexable-app"
11
+ Then "leave_me_alone/index.html" should not exist at "indexable-app"
12
+ And cleanup built app at "indexable-app"
13
+
14
+ Scenario: Preview normal file
15
+ Given the Server is running at "indexable-app"
16
+ When I go to "/needs_index/"
17
+ Then I should see "Indexable"
18
+
19
+ Scenario: Preview normal file subdirectory
20
+ Given the Server is running at "indexable-app"
21
+ When I go to "/a_folder/needs_index/"
22
+ Then I should see "Indexable"
23
+
24
+ Scenario: Preview ignored file
25
+ Given the Server is running at "indexable-app"
26
+ When I go to "/leave_me_alone/"
27
+ Then I should see "File Not Found"
@@ -2,23 +2,32 @@ Feature: Dynamic Pages
2
2
  In order to use a single view to generate multiple output files
3
3
 
4
4
  Scenario: Checking built folder for content
5
- Given a built test app
6
- Then "fake.html" should exist and include "I am real"
7
- Then "fake/one.html" should exist and include "I am real: one"
8
- Then "fake/two.html" should exist and include "I am real: two"
9
- And cleanup built test app
5
+ Given a built app at "test-app"
6
+ Then "fake.html" should exist at "test-app" and include "I am real"
7
+ Then "fake/one.html" should exist at "test-app" and include "I am real: one"
8
+ Then "fake/two.html" should exist at "test-app" and include "I am real: two"
9
+ Then "target_ignore.html" should exist at "test-app" and include "Ignore me"
10
+ Then "should_be_ignored.html" should not exist at "test-app"
11
+ Then "should_be_ignored2.html" should not exist at "test-app"
12
+ Then "should_be_ignored3.html" should not exist at "test-app"
13
+ And cleanup built app at "test-app"
10
14
 
11
15
  Scenario: Preview basic proxy
12
- Given the Server is running
16
+ Given the Server is running at "test-app"
13
17
  When I go to "/fake.html"
14
18
  Then I should see "I am real"
15
19
 
16
20
  Scenario: Preview proxy with variable one
17
- Given the Server is running
21
+ Given the Server is running at "test-app"
18
22
  When I go to "/fake/one.html"
19
23
  Then I should see "I am real: one"
20
24
 
21
25
  Scenario: Preview proxy with variable two
22
- Given the Server is running
26
+ Given the Server is running at "test-app"
23
27
  When I go to "/fake/two.html"
24
- Then I should see "I am real: two"
28
+ Then I should see "I am real: two"
29
+
30
+ Scenario: Preview ignored paths
31
+ Given the Server is running at "test-app"
32
+ When I go to "/should_be_ignored.html"
33
+ Then I should see "File Not Found"
@@ -2,6 +2,6 @@ Feature: YAML Front Matter
2
2
  In order to specific options and data inline
3
3
 
4
4
  Scenario: Rendering html
5
- Given the Server is running
5
+ Given the Server is running at "test-app"
6
6
  When I go to "/front-matter.html"
7
7
  Then I should see "<h1>This is the title</h1>"
@@ -2,26 +2,26 @@ Feature: Built-in auto_javascript_include_tag view helper
2
2
  In order to simplify including javascript files
3
3
 
4
4
  Scenario: Viewing the root path
5
- Given the Server is running
5
+ Given the Server is running at "test-app"
6
6
  When I go to "/auto-js.html"
7
7
  Then I should see "javascripts/auto-js.js"
8
8
 
9
9
  Scenario: Viewing a tier-1 path
10
- Given the Server is running
10
+ Given the Server is running at "test-app"
11
11
  When I go to "/auto-js/auto-js.html"
12
12
  Then I should see "javascripts/auto-js/auto-js.js"
13
13
 
14
14
  Scenario: Viewing the index file of a tier-1 path, without filename
15
- Given the Server is running
15
+ Given the Server is running at "test-app"
16
16
  When I go to "/auto-js"
17
17
  Then I should see "javascripts/auto-js/index.js"
18
18
 
19
19
  Scenario: Viewing the index file of a tier-1 path, without filename, with a trailing slash
20
- Given the Server is running
20
+ Given the Server is running at "test-app"
21
21
  When I go to "/auto-js/"
22
22
  Then I should see "javascripts/auto-js/index.js"
23
23
 
24
24
  Scenario: Viewing a tier-2 path
25
- Given the Server is running
25
+ Given the Server is running at "test-app"
26
26
  When I go to "/auto-js/sub/auto-js.html"
27
27
  Then I should see "javascripts/auto-js/sub/auto-js.js"
@@ -2,26 +2,26 @@ Feature: Built-in auto_stylesheet_link_tag view helper
2
2
  In order to simplify including css files
3
3
 
4
4
  Scenario: Viewing the root path
5
- Given the Server is running
5
+ Given the Server is running at "test-app"
6
6
  When I go to "/auto-css.html"
7
7
  Then I should see "stylesheets/auto-css.css"
8
8
 
9
9
  Scenario: Viewing a tier-1 path
10
- Given the Server is running
10
+ Given the Server is running at "test-app"
11
11
  When I go to "/auto-css/auto-css.html"
12
12
  Then I should see "stylesheets/auto-css/auto-css.css"
13
13
 
14
14
  Scenario: Viewing the index file of a tier-1 path, without filename
15
- Given the Server is running
15
+ Given the Server is running at "test-app"
16
16
  When I go to "/auto-css"
17
17
  Then I should see "stylesheets/auto-css/index.css"
18
18
 
19
19
  Scenario: Viewing the index file of a tier-1 path, without filename, with a trailing slash
20
- Given the Server is running
20
+ Given the Server is running at "test-app"
21
21
  When I go to "/auto-css/"
22
22
  Then I should see "stylesheets/auto-css/index.css"
23
23
 
24
24
  Scenario: Viewing a tier-2 path
25
- Given the Server is running
25
+ Given the Server is running at "test-app"
26
26
  When I go to "/auto-css/sub/auto-css.html"
27
27
  Then I should see "stylesheets/auto-css/sub/auto-css.css"
@@ -2,16 +2,16 @@ Feature: Built-in page_classes view helper
2
2
  In order to generate body classes for views
3
3
 
4
4
  Scenario: Viewing the root path
5
- Given the Server is running
5
+ Given the Server is running at "test-app"
6
6
  When I go to "/page-classes.html"
7
7
  Then I should see "page-classes"
8
8
 
9
9
  Scenario: Viewing a tier-1 path
10
- Given the Server is running
10
+ Given the Server is running at "test-app"
11
11
  When I go to "/sub1/page-classes.html"
12
12
  Then I should see "sub1 sub1_page-classes"
13
13
 
14
14
  Scenario: Viewing a tier-2 path
15
- Given the Server is running
15
+ Given the Server is running at "test-app"
16
16
  When I go to "/sub1/sub2/page-classes.html"
17
17
  Then I should see "sub1 sub1_sub2 sub1_sub2_page-classes"