middleman 3.0.0.alpha.4 → 3.0.0.alpha.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.yardopts +7 -3
- data/CHANGELOG.md +4 -1
- data/bin/middleman +10 -24
- data/features/3rd_party_cli.feature +5 -0
- data/features/builder.feature +43 -25
- data/features/chained_templates.feature +8 -4
- data/features/clean_build.feature +24 -13
- data/features/cli.feature +121 -0
- data/features/coffee-script.feature +1 -1
- data/features/custom_layout_engines.feature +5 -2
- data/features/directory_index.feature +17 -10
- data/features/dynamic_pages.feature +11 -8
- data/features/fonts.feature +5 -2
- data/features/sprockets.feature +4 -2
- data/fixtures/3rd-party-command/config.rb +10 -0
- data/lib/middleman.rb +19 -12
- data/lib/middleman/base.rb +19 -5
- data/lib/middleman/cli.rb +36 -112
- data/lib/middleman/{builder.rb → cli/build.rb} +60 -51
- data/lib/middleman/cli/init.rb +47 -0
- data/lib/middleman/cli/server.rb +41 -0
- data/lib/middleman/core_extensions/assets.rb +1 -0
- data/lib/middleman/core_extensions/builder.rb +18 -0
- data/lib/middleman/core_extensions/compass.rb +6 -1
- data/lib/middleman/core_extensions/data.rb +66 -2
- data/lib/middleman/core_extensions/sprockets.rb +0 -1
- data/lib/middleman/guard.rb +41 -29
- data/lib/middleman/step_definitions.rb +7 -1
- data/lib/middleman/step_definitions/builder_steps.rb +22 -30
- data/lib/middleman/step_definitions/middleman_steps.rb +2 -0
- data/lib/middleman/templates.rb +12 -4
- data/lib/middleman/templates/default.rb +3 -1
- data/lib/middleman/templates/html5.rb +3 -1
- data/lib/middleman/templates/local.rb +5 -3
- data/lib/middleman/templates/mobile.rb +3 -1
- data/lib/middleman/version.rb +5 -1
- data/middleman-x86-mingw32.gemspec +11 -10
- data/middleman.gemspec +7 -11
- metadata +49 -44
data/.gitignore
CHANGED
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/
|
7
|
-
--
|
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
|
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!
|
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
|
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!
|
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
|
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!
|
48
|
+
start_cli!
|
49
49
|
end
|
50
50
|
|
51
|
-
def start_cli!
|
51
|
+
def start_cli!
|
52
52
|
require 'middleman'
|
53
|
-
Middleman::
|
53
|
+
Middleman::Cli::Base.start
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
|
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!
|
62
|
+
Middleman::ProjectLocator.start_cli!
|
77
63
|
end
|
data/features/builder.feature
CHANGED
@@ -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
|
-
|
7
|
-
Then
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
Then the
|
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
|
-
|
25
|
-
Then
|
26
|
-
|
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
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
-
|
14
|
-
Then
|
15
|
-
|
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"
|
4
|
-
And
|
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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
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 |
|
@@ -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
|
-
|
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
|
-
|
7
|
-
Then
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
Then
|
14
|
-
|
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
|
-
|
7
|
-
Then
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
Then
|
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"
|