middleman 3.0.0.alpha.4 → 3.0.0.alpha.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.
Files changed (40) hide show
  1. data/.gitignore +1 -0
  2. data/.yardopts +7 -3
  3. data/CHANGELOG.md +4 -1
  4. data/bin/middleman +10 -24
  5. data/features/3rd_party_cli.feature +5 -0
  6. data/features/builder.feature +43 -25
  7. data/features/chained_templates.feature +8 -4
  8. data/features/clean_build.feature +24 -13
  9. data/features/cli.feature +121 -0
  10. data/features/coffee-script.feature +1 -1
  11. data/features/custom_layout_engines.feature +5 -2
  12. data/features/directory_index.feature +17 -10
  13. data/features/dynamic_pages.feature +11 -8
  14. data/features/fonts.feature +5 -2
  15. data/features/sprockets.feature +4 -2
  16. data/fixtures/3rd-party-command/config.rb +10 -0
  17. data/lib/middleman.rb +19 -12
  18. data/lib/middleman/base.rb +19 -5
  19. data/lib/middleman/cli.rb +36 -112
  20. data/lib/middleman/{builder.rb → cli/build.rb} +60 -51
  21. data/lib/middleman/cli/init.rb +47 -0
  22. data/lib/middleman/cli/server.rb +41 -0
  23. data/lib/middleman/core_extensions/assets.rb +1 -0
  24. data/lib/middleman/core_extensions/builder.rb +18 -0
  25. data/lib/middleman/core_extensions/compass.rb +6 -1
  26. data/lib/middleman/core_extensions/data.rb +66 -2
  27. data/lib/middleman/core_extensions/sprockets.rb +0 -1
  28. data/lib/middleman/guard.rb +41 -29
  29. data/lib/middleman/step_definitions.rb +7 -1
  30. data/lib/middleman/step_definitions/builder_steps.rb +22 -30
  31. data/lib/middleman/step_definitions/middleman_steps.rb +2 -0
  32. data/lib/middleman/templates.rb +12 -4
  33. data/lib/middleman/templates/default.rb +3 -1
  34. data/lib/middleman/templates/html5.rb +3 -1
  35. data/lib/middleman/templates/local.rb +5 -3
  36. data/lib/middleman/templates/mobile.rb +3 -1
  37. data/lib/middleman/version.rb +5 -1
  38. data/middleman-x86-mingw32.gemspec +11 -10
  39. data/middleman.gemspec +7 -11
  40. metadata +49 -44
data/.gitignore CHANGED
@@ -13,3 +13,4 @@ fixtures/generator-test
13
13
  build
14
14
  doc
15
15
  .yardoc
16
+ tmp
data/.yardopts CHANGED
@@ -1,7 +1,11 @@
1
1
  lib/**/*.rb
2
- --exclude lib/middleman/vendor
2
+ --exclude lib/middleman/vendor/
3
3
  --exclude lib/middleman/extensions/automatic_image_sizes/fastimage.rb
4
4
  --exclude lib/middleman/extensions/minify_css/cssmin.rb
5
5
  --exclude lib/middleman/step_definitions
6
- --exclude lib/middleman/step_definitions.rb
7
- --no-private
6
+ --exclude lib/middleman/templates/default/
7
+ --exclude lib/middleman/templates/html5/
8
+ --exclude lib/middleman/templates/mobile/
9
+ --exclude lib/middleman/templates/shared/
10
+ --no-private
11
+ --hide-void-return
data/CHANGELOG.md CHANGED
@@ -10,9 +10,12 @@
10
10
  * Sitemap object representing the known world
11
11
  * FileWatcher proxies file change events
12
12
  * Unified callback solution
13
- * Removed Slim and Maruku from base install. Will need to be installed and required by the user (in - config.rb)
13
+ * Removed Slim from base install. Will need to be installed and required by the user (in - config.rb)
14
14
  * Activate mobile html5boilerplate template
15
15
  * Update to Redcarpet for Markdown (breaks Haml :markdown filter)
16
+ * Return correct exit codes (0 for success, 1 for failure) from CLI
17
+ * Yard code docs: http://rubydoc.info/github/tdreyno/middleman
18
+ * config.rb and extensions can add command-line commands
16
19
 
17
20
  2.0.14
18
21
  ====
data/bin/middleman CHANGED
@@ -9,7 +9,7 @@ require 'rubygems'
9
9
  module Middleman
10
10
  module ProjectLocator
11
11
  class << self
12
- def locate_middleman_root!(args)
12
+ def locate_middleman_root!
13
13
  cwd = Dir.pwd
14
14
 
15
15
  if !in_middleman_project? && !in_middleman_project_subdirectory?
@@ -18,14 +18,14 @@ module Middleman
18
18
  end
19
19
 
20
20
  if in_middleman_project?
21
- did_locate_middleman_project(cwd, args)
21
+ did_locate_middleman_project(cwd)
22
22
  return
23
23
  end
24
24
 
25
25
  Dir.chdir("..") do
26
26
  # Recurse in a chdir block: if the search fails we want to be sure
27
27
  # the application is generated in the original working directory.
28
- locate_middleman_root!(args) unless cwd == Dir.pwd
28
+ locate_middleman_root! unless cwd == Dir.pwd
29
29
  end
30
30
  rescue SystemCallError
31
31
  # could not chdir, no problem just return
@@ -39,39 +39,25 @@ module Middleman
39
39
  File.exists?(File.join(path, 'config.rb')) || !path.root? && in_middleman_project_subdirectory?(path.parent)
40
40
  end
41
41
 
42
- def did_locate_middleman_project(path, args)
42
+ def did_locate_middleman_project(path)
43
43
  # Set up gems listed in the Gemfile.
44
44
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile', path)
45
45
 
46
46
  require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
47
47
 
48
- start_cli!(args)
48
+ start_cli!
49
49
  end
50
50
 
51
- def start_cli!(args)
51
+ def start_cli!
52
52
  require 'middleman'
53
- Middleman::CLI.start(args)
53
+ Middleman::Cli::Base.start
54
54
  end
55
55
  end
56
56
  end
57
57
  end
58
58
 
59
- args = ARGV.dup
60
-
61
- ARG_ALIASES = {
62
- "s" => "server",
63
- "b" => "build",
64
- "i" => "init",
65
- "new" => "init",
66
- "n" => "init"
67
- }
68
-
69
- if ARG_ALIASES.has_key?(args[0])
70
- args[0] = ARG_ALIASES[args[0]]
71
- end
72
-
73
- if args.length < 1 || %w(server build migrate).include?(args.first)
74
- Middleman::ProjectLocator.locate_middleman_root!(args)
59
+ if ARGV.length < 1 || %w(server build migrate).include?(ARGV.first)
60
+ Middleman::ProjectLocator.locate_middleman_root!
75
61
  else
76
- Middleman::ProjectLocator.start_cli!(args)
62
+ Middleman::ProjectLocator.start_cli!
77
63
  end
@@ -0,0 +1,5 @@
1
+ Feature: Allow config.rb and extensions to add CLI commands
2
+ Scenario: Test 3rd Party Command
3
+ Given a fixture app "3rd-party-command"
4
+ When I run `middleman hello`
5
+ Then the output should contain "Hello World"
@@ -2,33 +2,51 @@ 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 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/blank.gif" should exist at "test-app"
17
- Then "images/Read me (example).txt" should exist at "test-app"
18
- Then "images/Child folder/regular_file(example).txt" should exist at "test-app"
19
- Then ".htaccess" should exist at "test-app"
20
- Then the last exit code should be "0"
5
+ Given a successfully built app at "test-app"
6
+ When I cd to "build"
7
+ Then the following files should exist:
8
+ | index.html |
9
+ | javascripts/coffee_test.js |
10
+ | static.html |
11
+ | services/index.html |
12
+ | stylesheets/site.css |
13
+ | stylesheets/site_scss.css |
14
+ | stylesheets/static.css |
15
+ | spaces in file.html |
16
+ | images/blank.gif |
17
+ | images/Read me (example).txt |
18
+ | images/Child folder/regular_file(example).txt |
19
+ | .htaccess |
20
+ Then the following files should not exist:
21
+ | _partial |
22
+ | _liquid_partial |
23
+ | layout |
24
+ | layouts/custom |
25
+ | layouts/content_for |
26
+
27
+ And the file "index.html" should contain "Comment in layout"
28
+ And the file "index.html" should contain "<h1>Welcome</h1>"
29
+ And the file "javascripts/coffee_test.js" should contain "Array.prototype.slice"
30
+ And the file "static.html" should contain "Static, no code!"
31
+ And the file "services/index.html" should contain "Services"
32
+ And the file "stylesheets/site.css" should contain "html, body, div, span"
33
+ And the file "stylesheets/site_scss.css" should contain "html, body, div, span"
34
+ And the file "stylesheets/static.css" should contain "body"
35
+ And the file "spaces in file.html" should contain "spaces"
21
36
 
22
37
  Scenario: Build glob
23
- Given a built app at "glob-app" with flags "--glob '*.css'"
24
- Then "stylesheets/site.css" should exist at "glob-app" and include "html"
25
- Then "index.html" should not exist at "glob-app"
26
- Then the last exit code should be "0"
38
+ Given a successfully built app at "glob-app" with flags "--glob '*.css'"
39
+ When I cd to "build"
40
+ Then the following files should not exist:
41
+ | index.html |
42
+ Then the following files should exist:
43
+ | stylesheets/site.css |
27
44
 
28
45
  Scenario: Build with errors
29
46
  Given a built app at "build-with-errors-app"
30
- Then the last exit code should be "1"
31
-
32
- # Scenario: Force relative assets
33
- # Given a built app at "relative-app" with flags "--relative"
34
- # Then "stylesheets/relative_assets.css" should exist at "relative-app" and include "../"
47
+ Then the exit status should be 1
48
+
49
+ Scenario: Build alias (b)
50
+ Given a fixture app "test-app"
51
+ When I run `middleman b`
52
+ Then was successfully built
@@ -9,7 +9,11 @@ Feature: Templates should be chainable
9
9
  And I should see "Sup</h3>"
10
10
 
11
11
  Scenario: Build chained template
12
- Given a built app at "chained-app"
13
- Then "index.html" should exist at "chained-app" and include "Title</h1>"
14
- Then "index.html" should exist at "chained-app" and include "Subtitle</h2>"
15
- Then "index.html" should exist at "chained-app" and include "Sup</h3>"
12
+ Given a successfully built app at "chained-app"
13
+ When I cd to "build"
14
+ Then the following files should exist:
15
+ | index.html |
16
+
17
+ And the file "index.html" should contain "Title</h1>"
18
+ And the file "index.html" should contain "Subtitle</h2>"
19
+ And the file "index.html" should contain "Sup</h3>"
@@ -1,20 +1,31 @@
1
1
  Feature: Build Clean
2
2
  Scenario: Build and Clean an app
3
- Given app "clean-app" is using config "empty"
4
- And a built app at "clean-app"
3
+ Given a fixture app "clean-app"
4
+ And app "clean-app" is using config "empty"
5
+ And a successfully built app at "clean-app"
5
6
  And app "clean-app" is using config "complications"
6
- And a built app at "clean-app" with flags "--clean"
7
- Then "should_be_ignored.html" should not exist at "clean-app"
8
- And "should_be_ignored2.html" should not exist at "clean-app"
9
- And "should_be_ignored3.html" should not exist at "clean-app"
7
+
8
+ Given a successfully built app at "clean-app" with flags "--clean"
9
+ When I cd to "build"
10
+ Then the following files should not exist:
11
+ | should_be_ignored.html |
12
+ | should_be_ignored2.html |
13
+ | should_be_ignored3.html |
14
+ And the file "index.html" should contain "Comment in layout"
10
15
 
11
16
  Scenario: Clean an app with directory indexes
12
- Given a built app at "clean-dir-app"
13
- Then "about/index.html" should exist at "clean-dir-app"
14
- Given a built app at "clean-dir-app" with flags "--clean"
15
- Then "about/index.html" should exist at "clean-dir-app"
16
- Then cleanup built app at "clean-dir-app"
17
+ Given a successfully built app at "clean-dir-app"
18
+ When I cd to "build"
19
+ Then the following files should exist:
20
+ | about/index.html |
21
+
22
+ Given a successfully built app at "clean-dir-app" with flags "--clean"
23
+ When I cd to "build"
24
+ Then the following files should exist:
25
+ | about/index.html |
17
26
 
18
27
  Scenario: Clean build an app that's never been built
19
- Given a built app at "clean-dir-app" with flags "--clean"
20
- Then "about/index.html" should exist at "clean-dir-app"
28
+ Given a successfully built app at "clean-dir-app" with flags "--clean"
29
+ When I cd to "build"
30
+ Then the following files should exist:
31
+ | about/index.html |
@@ -0,0 +1,121 @@
1
+ Feature: Middleman CLI
2
+
3
+ Scenario: Create a new project
4
+ When I run `middleman init MY_PROJECT`
5
+ Then a directory named "MY_PROJECT" should exist
6
+ When I cd to "MY_PROJECT"
7
+ Then the following files should exist:
8
+ | config.rb |
9
+ Then the following files should not exist:
10
+ | config.ru |
11
+ | Gemfile |
12
+ Then a directory named "source" should exist
13
+ When I cd to "source"
14
+ Then the following files should exist:
15
+ | index.html.erb |
16
+ | layout.erb |
17
+ | stylesheets/site.css.scss |
18
+
19
+ Scenario: Create a new project (alias i)
20
+ When I run `middleman i MY_PROJECT`
21
+ Then a directory named "MY_PROJECT" should exist
22
+
23
+ Scenario: Create a new project (alias i)
24
+ When I run `middleman new MY_PROJECT`
25
+ Then a directory named "MY_PROJECT" should exist
26
+
27
+ Scenario: Create a new project (alias i)
28
+ When I run `middleman n MY_PROJECT`
29
+ Then a directory named "MY_PROJECT" should exist
30
+
31
+ Scenario: Create a new project with Rack
32
+ When I run `middleman init MY_PROJECT --rack`
33
+ Then a directory named "MY_PROJECT" should exist
34
+ When I cd to "MY_PROJECT"
35
+ Then the following files should exist:
36
+ | config.rb |
37
+ | config.ru |
38
+ Then the following files should not exist:
39
+ | Gemfile |
40
+
41
+ Scenario: Create a new project with Bundler
42
+ When I run `middleman init MY_PROJECT --bundler`
43
+ Then a directory named "MY_PROJECT" should exist
44
+ When I cd to "MY_PROJECT"
45
+ Then the following files should exist:
46
+ | config.rb |
47
+ | Gemfile |
48
+ Then the following files should not exist:
49
+ | config.ru |
50
+
51
+ Scenario: Create a new HTML5 project
52
+ When I run `middleman init MY_PROJECT --template=html5`
53
+ Then a directory named "MY_PROJECT" should exist
54
+ When I cd to "MY_PROJECT"
55
+ Then the following files should exist:
56
+ | config.rb |
57
+ Then the following files should not exist:
58
+ | config.ru |
59
+ | Gemfile |
60
+ Then a directory named "source" should exist
61
+ When I cd to "source"
62
+ Then the following files should exist:
63
+ | index.html |
64
+ | humans.txt |
65
+ | js/script.js |
66
+
67
+ Scenario: Create a new HTML5 project with Rack
68
+ When I run `middleman init MY_PROJECT --rack --template=html5`
69
+ Then a directory named "MY_PROJECT" should exist
70
+ When I cd to "MY_PROJECT"
71
+ Then the following files should exist:
72
+ | config.rb |
73
+ | config.ru |
74
+ Then the following files should not exist:
75
+ | Gemfile |
76
+
77
+ Scenario: Create a new HTML5 project with Bundler
78
+ When I run `middleman init MY_PROJECT --bundler --template=html5`
79
+ Then a directory named "MY_PROJECT" should exist
80
+ When I cd to "MY_PROJECT"
81
+ Then the following files should exist:
82
+ | config.rb |
83
+ | Gemfile |
84
+ Then the following files should not exist:
85
+ | config.ru |
86
+
87
+ Scenario: Create a new Mobile HTML5 project
88
+ When I run `middleman init MY_PROJECT --template=mobile`
89
+ Then a directory named "MY_PROJECT" should exist
90
+ When I cd to "MY_PROJECT"
91
+ Then the following files should exist:
92
+ | config.rb |
93
+ Then the following files should not exist:
94
+ | config.ru |
95
+ | Gemfile |
96
+ Then a directory named "source" should exist
97
+ When I cd to "source"
98
+ Then the following files should exist:
99
+ | index.html |
100
+ | humans.txt |
101
+ | js/libs/respond.min.js |
102
+
103
+ Scenario: Create a new Mobile HTML5 project with Rack
104
+ When I run `middleman init MY_PROJECT --rack --template=mobile`
105
+ Then a directory named "MY_PROJECT" should exist
106
+ When I cd to "MY_PROJECT"
107
+ Then the following files should exist:
108
+ | config.rb |
109
+ | config.ru |
110
+ Then the following files should not exist:
111
+ | Gemfile |
112
+
113
+ Scenario: Create a new Mobile HTML5 project with Bundler
114
+ When I run `middleman init MY_PROJECT --bundler --template=mobile`
115
+ Then a directory named "MY_PROJECT" should exist
116
+ When I cd to "MY_PROJECT"
117
+ Then the following files should exist:
118
+ | config.rb |
119
+ | Gemfile |
120
+ Then the following files should not exist:
121
+ | config.ru |
@@ -14,4 +14,4 @@ Feature: Support coffee-script
14
14
  Scenario: Rendering broken coffee
15
15
  Given the Server is running at "test-app"
16
16
  When I go to "/javascripts/broken-coffee.js"
17
- Then I should see "ProgramError"
17
+ Then I should see "Error"
@@ -1,8 +1,11 @@
1
1
  Feature: Custom Layout Engine
2
2
 
3
3
  Scenario: Checking built folder for content
4
- Given a built app at "custom-layout-app"
5
- Then "index.html" should exist at "custom-layout-app" and include "Comment in layout"
4
+ Given a successfully built app at "custom-layout-app"
5
+ When I cd to "build"
6
+ Then the following files should exist:
7
+ | index.html |
8
+ And the file "index.html" should contain "Comment in layout"
6
9
 
7
10
  Scenario: Checking server for content
8
11
  Given the Server is running at "test-app"
@@ -2,16 +2,23 @@ Feature: Directory Index
2
2
  In order output Apache-friendly directories and indexes
3
3
 
4
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 "regular/index.html" should exist at "indexable-app" and include "Regular"
10
- Then "regular/index/index.html" should not exist at "indexable-app"
11
- Then "needs_index.html" should not exist at "indexable-app"
12
- Then "a_folder/needs_index.html" should not exist at "indexable-app"
13
- Then "leave_me_alone/index.html" should not exist at "indexable-app"
14
- Then ".htaccess" should exist at "indexable-app"
5
+ Given a successfully built app at "indexable-app"
6
+ When I cd to "build"
7
+ Then the following files should exist:
8
+ | needs_index/index.html |
9
+ | a_folder/needs_index/index.html |
10
+ | leave_me_alone.html |
11
+ | regular/index.html |
12
+ | .htaccess |
13
+ Then the following files should not exist:
14
+ | egular/index/index.html |
15
+ | needs_index.html |
16
+ | a_folder/needs_index.html |
17
+ | leave_me_alone/index.html |
18
+ And the file "needs_index/index.html" should contain "Indexable"
19
+ And the file "a_folder/needs_index/index.html" should contain "Indexable"
20
+ And the file "leave_me_alone.html" should contain "Stay away"
21
+ And the file "regular/index.html" should contain "Regular"
15
22
 
16
23
  Scenario: Preview normal file
17
24
  Given the Server is running at "indexable-app"
@@ -2,14 +2,17 @@ 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 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"
5
+ Given a successfully built app at "test-app"
6
+ When I cd to "build"
7
+ Then the following files should exist:
8
+ | fake.html |
9
+ | fake/one.html |
10
+ | fake/two.html |
11
+ | target_ignore.html |
12
+ Then the following files should not exist:
13
+ | should_be_ignored.html |
14
+ | should_be_ignored2.html |
15
+ | should_be_ignored3.html |
13
16
 
14
17
  Scenario: Preview basic proxy
15
18
  Given the Server is running at "test-app"