middleman 3.0.0.alpha.5 → 3.0.0.alpha.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +3 -2
- data/README.md +7 -7
- data/bin/middleman +3 -2
- data/features/builder.feature +4 -0
- data/features/cli.feature +10 -11
- data/features/nested_layouts.feature +24 -0
- data/features/sitemap_traversal.features +56 -0
- data/fixtures/empty-app/not-config.rb +0 -0
- data/fixtures/nested-layout-app/config.rb +1 -0
- data/fixtures/nested-layout-app/source/data-one.html.erb +5 -0
- data/fixtures/nested-layout-app/source/data-two.html.erb +5 -0
- data/fixtures/nested-layout-app/source/index.html.erb +1 -0
- data/fixtures/nested-layout-app/source/layouts/inner.erb +4 -0
- data/fixtures/nested-layout-app/source/layouts/master.erb +3 -0
- data/fixtures/nested-layout-app/source/layouts/outer.erb +4 -0
- data/fixtures/traversal-app/config.rb +2 -0
- data/fixtures/traversal-app/source/index.html.erb +0 -0
- data/fixtures/traversal-app/source/layout.erb +13 -0
- data/fixtures/traversal-app/source/proxied.html.erb +0 -0
- data/fixtures/traversal-app/source/root.html.erb +0 -0
- data/fixtures/traversal-app/source/sub/index.html.erb +0 -0
- data/fixtures/traversal-app/source/sub/sibling.html.erb +0 -0
- data/fixtures/traversal-app/source/sub/sibling2.html.erb +0 -0
- data/fixtures/traversal-app/source/sub/sub2/index.html.erb +0 -0
- data/fixtures/traversal-app/source/sub/sub3/deep.html.erb +0 -0
- data/lib/middleman.rb +0 -3
- data/lib/middleman/base.rb +3 -28
- data/lib/middleman/cli/server.rb +0 -1
- data/lib/middleman/core_extensions/builder.rb +1 -7
- data/lib/middleman/core_extensions/default_helpers.rb +27 -1
- data/lib/middleman/core_extensions/extensions.rb +20 -4
- data/lib/middleman/core_extensions/file_watcher.rb +25 -8
- data/lib/middleman/core_extensions/front_matter.rb +5 -12
- data/lib/middleman/core_extensions/rendering.rb +10 -0
- data/lib/middleman/core_extensions/sitemap.rb +4 -0
- data/lib/middleman/guard.rb +11 -11
- data/lib/middleman/sitemap/page.rb +55 -0
- data/lib/middleman/sitemap/template.rb +9 -3
- data/lib/middleman/step_definitions.rb +0 -1
- data/lib/middleman/templates/default.rb +7 -2
- data/lib/middleman/templates/default/source/images/background.png +0 -0
- data/lib/middleman/templates/default/source/images/middleman.png +0 -0
- data/lib/middleman/templates/default/source/index.html.erb +9 -4
- data/lib/middleman/templates/default/source/javascripts/all.js +1 -0
- data/lib/middleman/templates/default/source/layouts/layout.erb +19 -0
- data/lib/middleman/templates/default/source/stylesheets/_animate.scss +23 -0
- data/lib/middleman/templates/default/source/stylesheets/_normalize.scss +431 -0
- data/lib/middleman/templates/default/source/stylesheets/all.css.scss +40 -0
- data/lib/middleman/templates/shared/config.tt +4 -16
- data/lib/middleman/version.rb +1 -1
- data/middleman-x86-mingw32.gemspec +1 -1
- data/middleman.gemspec +1 -1
- metadata +54 -13
- data/features/generator.feature +0 -8
- data/lib/middleman/extensions/sitemap_tree.rb +0 -38
- data/lib/middleman/step_definitions/generator_steps.rb +0 -26
- data/lib/middleman/templates/default/source/layout.erb +0 -19
- data/lib/middleman/templates/default/source/stylesheets/site.css.scss +0 -32
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
* Sitemap maintains own state
|
5
5
|
* New Extension Registration API
|
6
6
|
* Remove old 1.x mm- binaries and messaging
|
7
|
-
* New default layout functionality: https://github.com/
|
7
|
+
* New default layout functionality: https://github.com/middleman/middleman/issues/165
|
8
8
|
* Enable chained templates outside of sprockets (file.html.markdown.erb)
|
9
9
|
* Finally support Compass in Sprockets! Thanks to @xdite and @petebrowne
|
10
10
|
* Sitemap object representing the known world
|
@@ -14,8 +14,9 @@
|
|
14
14
|
* Activate mobile html5boilerplate template
|
15
15
|
* Update to Redcarpet for Markdown (breaks Haml :markdown filter)
|
16
16
|
* Return correct exit codes (0 for success, 1 for failure) from CLI
|
17
|
-
* Yard code docs: http://rubydoc.info/github/
|
17
|
+
* Yard code docs: http://rubydoc.info/github/middleman/middleman
|
18
18
|
* config.rb and extensions can add command-line commands
|
19
|
+
* Nested layouts using `wrap_layout` helper
|
19
20
|
|
20
21
|
2.0.14
|
21
22
|
====
|
data/README.md
CHANGED
@@ -50,10 +50,10 @@ A full set of in-depth instructional guides are available on the official websit
|
|
50
50
|
|
51
51
|
The community maintains it's own collection of tips and tricks in the GitHub wiki:
|
52
52
|
|
53
|
-
https://github.com/
|
53
|
+
https://github.com/middleman/middleman/wiki
|
54
54
|
|
55
55
|
Finally, up-to-date generated code documentation is available on RubyDoc:
|
56
|
-
http://rubydoc.info/github/
|
56
|
+
http://rubydoc.info/github/middleman/middleman
|
57
57
|
|
58
58
|
# Community
|
59
59
|
|
@@ -65,18 +65,18 @@ The official community forum is available on Convore at:
|
|
65
65
|
|
66
66
|
GitHub Issues are used for managing bug reports and feature requests. If you run into issues, please search the issues and submit new problems:
|
67
67
|
|
68
|
-
https://github.com/
|
68
|
+
https://github.com/middleman/middleman/issues
|
69
69
|
|
70
70
|
The best way to get quick responses to your issues and swift fixes to your bugs is to submit detailed bug reports, include test cases and respond to developer questions in a timely manner. Even better, if you know Ruby, you can submit Pull Requests containing Cucumber Features which describe how your feature should work or exploit the bug you are submitting.
|
71
71
|
|
72
72
|
# Build & Dependency Status
|
73
73
|
|
74
|
-
[![Build Status](http://travis-ci.org/
|
75
|
-
[![Dependency Status](https://gemnasium.com/
|
74
|
+
[![Build Status](http://travis-ci.org/middleman/middleman.png)](http://travis-ci.org/middleman/middleman)
|
75
|
+
[![Dependency Status](https://gemnasium.com/middleman/middleman.png?travis)](https://gemnasium.com/middleman/middleman)
|
76
76
|
|
77
77
|
# How to Run Cucumber Tests
|
78
78
|
|
79
|
-
1. Checkout Repository: `git clone https://tdreyno@github.com/
|
79
|
+
1. Checkout Repository: `git clone https://tdreyno@github.com/middleman/middleman.git`
|
80
80
|
2. Install Bundler: `gem install bundler`
|
81
81
|
3. Run `bundle` inside the project root to install the gem dependencies.
|
82
82
|
4. Run test cases: `bundle exec rake test`
|
@@ -90,4 +90,4 @@ The best way to get quick responses to your issues and swift fixes to your bugs
|
|
90
90
|
Copyright (c) 2010 Thomas Reynolds. MIT Licensed, see [LICENSE] for details.
|
91
91
|
|
92
92
|
[RubyInstaller]: http://rubyinstaller.org/
|
93
|
-
[LICENSE]: https://github.com/
|
93
|
+
[LICENSE]: https://github.com/middleman/middleman/blob/master/LICENSE
|
data/bin/middleman
CHANGED
@@ -14,7 +14,7 @@ module Middleman
|
|
14
14
|
|
15
15
|
if !in_middleman_project? && !in_middleman_project_subdirectory?
|
16
16
|
$stderr.puts "== Error: Could not find a Middleman project config, perhaps you are in the wrong folder?"
|
17
|
-
|
17
|
+
exit(1)
|
18
18
|
end
|
19
19
|
|
20
20
|
if in_middleman_project?
|
@@ -56,7 +56,8 @@ module Middleman
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
if ARGV.length < 1
|
59
|
+
ARGV << "server" if ARGV.length < 1
|
60
|
+
if %w(server s build b).include?(ARGV[0])
|
60
61
|
Middleman::ProjectLocator.locate_middleman_root!
|
61
62
|
else
|
62
63
|
Middleman::ProjectLocator.start_cli!
|
data/features/builder.feature
CHANGED
@@ -45,6 +45,10 @@ Feature: Builder
|
|
45
45
|
Scenario: Build with errors
|
46
46
|
Given a built app at "build-with-errors-app"
|
47
47
|
Then the exit status should be 1
|
48
|
+
|
49
|
+
Scenario: Build empty errors
|
50
|
+
Given a built app at "empty-app"
|
51
|
+
Then the exit status should be 1
|
48
52
|
|
49
53
|
Scenario: Build alias (b)
|
50
54
|
Given a fixture app "test-app"
|
data/features/cli.feature
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
Feature: Middleman CLI
|
2
2
|
|
3
3
|
Scenario: Create a new project
|
4
|
-
|
5
|
-
Then
|
4
|
+
Given I run `middleman init MY_PROJECT`
|
5
|
+
Then the exit status should be 0
|
6
6
|
When I cd to "MY_PROJECT"
|
7
7
|
Then the following files should exist:
|
8
8
|
| config.rb |
|
9
|
-
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
|
16
|
-
|
|
17
|
-
| stylesheets/site.css.scss |
|
9
|
+
| source/index.html.erb |
|
10
|
+
| source/images/background.png |
|
11
|
+
| source/images/middleman.png |
|
12
|
+
| source/layouts/layout.erb |
|
13
|
+
| source/javascripts/all.js |
|
14
|
+
| source/stylesheets/all.css.scss |
|
15
|
+
| source/stylesheets/_animate.scss |
|
16
|
+
| source/stylesheets/_normalize.scss |
|
18
17
|
|
19
18
|
Scenario: Create a new project (alias i)
|
20
19
|
When I run `middleman i MY_PROJECT`
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Feature: Allow nesting of layouts
|
2
|
+
|
3
|
+
Scenario: A page uses an inner layout when uses an outer layout
|
4
|
+
Given the Server is running at "nested-layout-app"
|
5
|
+
When I go to "/index.html"
|
6
|
+
Then I should see "Template"
|
7
|
+
And I should see "Inner"
|
8
|
+
And I should see "Outer"
|
9
|
+
And I should see "Master"
|
10
|
+
|
11
|
+
Scenario: YAML Front Matter isn't clobbered with nested layouts
|
12
|
+
Given the Server is running at "nested-layout-app"
|
13
|
+
When I go to "/data-one.html"
|
14
|
+
Then I should see "Page Number One"
|
15
|
+
And I should see "Inner"
|
16
|
+
When I go to "/data-two.html"
|
17
|
+
Then I should see "Page Number Two"
|
18
|
+
And I should not see "Inner"
|
19
|
+
When I go to "/data-one.html"
|
20
|
+
Then I should see "Page Number One"
|
21
|
+
And I should see "Inner"
|
22
|
+
When I go to "/data-two.html"
|
23
|
+
Then I should see "Page Number Two"
|
24
|
+
And I should not see "Inner"
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Feature: Step through sitemap as a tree
|
2
|
+
|
3
|
+
Scenario: Root
|
4
|
+
Given the Server is running at "traversal-app"
|
5
|
+
When I go to "/index.html"
|
6
|
+
Then I should not see "Parent: index.html"
|
7
|
+
Then I should see "Child: sub/index.html"
|
8
|
+
Then I should see "Child: root.html"
|
9
|
+
Then I should not see "Child: proxied.html"
|
10
|
+
|
11
|
+
Scenario: Directories have children and a parent
|
12
|
+
Given the Server is running at "traversal-app"
|
13
|
+
When I go to "/sub/index.html"
|
14
|
+
Then I should see "Parent: index.html"
|
15
|
+
Then I should see "Child: sub/fake.html"
|
16
|
+
Then I should see "Child: sub/fake2.html"
|
17
|
+
Then I should see "Child: sub/sibling.html"
|
18
|
+
Then I should see "Child: sub/sibling2.html"
|
19
|
+
Then I should see "Child: sub/sub2/index.html"
|
20
|
+
Then I should see "Sibling: root.html"
|
21
|
+
|
22
|
+
Scenario: Page has siblings
|
23
|
+
Given the Server is running at "traversal-app"
|
24
|
+
When I go to "/sub/sibling.html"
|
25
|
+
Then I should see "Sibling: sub/fake.html"
|
26
|
+
Then I should see "Sibling: sub/fake2.html"
|
27
|
+
Then I should see "Sibling: sub/sibling2.html"
|
28
|
+
Then I should see "Sibling: sub/sub2/index.html"
|
29
|
+
|
30
|
+
Scenario: Proxied page has siblings
|
31
|
+
Given the Server is running at "traversal-app"
|
32
|
+
When I go to "/sub/fake.html"
|
33
|
+
Then I should see "Sibling: sub/fake2.html"
|
34
|
+
Then I should see "Sibling: sub/sibling.html"
|
35
|
+
Then I should see "Sibling: sub/sibling2.html"
|
36
|
+
Then I should see "Sibling: sub/sub2/index.html"
|
37
|
+
|
38
|
+
Scenario: Page has parent
|
39
|
+
Given the Server is running at "traversal-app"
|
40
|
+
When I go to "/sub/sibling.html"
|
41
|
+
Then I should see "Parent: sub/index.html"
|
42
|
+
|
43
|
+
Scenario: Proxied page has parent
|
44
|
+
Given the Server is running at "traversal-app"
|
45
|
+
When I go to "/sub/fake.html"
|
46
|
+
Then I should see "Parent: sub/index.html"
|
47
|
+
|
48
|
+
Scenario: Page has source_file
|
49
|
+
Given the Server is running at "traversal-app"
|
50
|
+
When I go to "/sub/sibling.html"
|
51
|
+
Then I should see "Source: source/sub/sibling.html.erb"
|
52
|
+
|
53
|
+
Scenario: Proxied page has source_file
|
54
|
+
Given the Server is running at "traversal-app"
|
55
|
+
When I go to "/sub/fake.html"
|
56
|
+
Then I should see "Source: source/proxied.html.erb"
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
set :layout, :inner
|
@@ -0,0 +1 @@
|
|
1
|
+
Template
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Source: <%= current_page.source_file.sub(root + "/", "") %>
|
2
|
+
|
3
|
+
<% if current_page.parent %>
|
4
|
+
Parent: <%= current_page.parent.path %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<% current_page.children.each do |p| %>
|
8
|
+
Child: <%= p.path %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<% current_page.siblings.each do |p| %>
|
12
|
+
Sibling: <%= p.path %>
|
13
|
+
<% end %>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/middleman.rb
CHANGED
@@ -111,9 +111,6 @@ module Middleman
|
|
111
111
|
# Automatically convert filename.html files into filename/index.html
|
112
112
|
autoload :DirectoryIndexes, "middleman/extensions/directory_indexes"
|
113
113
|
|
114
|
-
# Organize the sitemap as a tree
|
115
|
-
autoload :SitemapTree, "middleman/extensions/sitemap_tree"
|
116
|
-
|
117
114
|
class << self
|
118
115
|
def registered
|
119
116
|
@_registered ||= {}
|
data/lib/middleman/base.rb
CHANGED
@@ -192,8 +192,7 @@ class Middleman::Base
|
|
192
192
|
# Automatically loaded extensions
|
193
193
|
# @return [Array<Symbol>]
|
194
194
|
set :default_extensions, [
|
195
|
-
:lorem
|
196
|
-
# :sitemap_tree
|
195
|
+
:lorem
|
197
196
|
]
|
198
197
|
|
199
198
|
# Default layout name
|
@@ -256,8 +255,6 @@ class Middleman::Base
|
|
256
255
|
Middleman::Extensions::MinifyJavascript }
|
257
256
|
Middleman::Extensions.register(:relative_assets) {
|
258
257
|
Middleman::Extensions::RelativeAssets }
|
259
|
-
Middleman::Extensions.register(:sitemap_tree) {
|
260
|
-
Middleman::Extensions::SitemapTree }
|
261
258
|
|
262
259
|
# Backwards-compatibility with old request.path signature
|
263
260
|
attr :request
|
@@ -304,14 +301,7 @@ class Middleman::Base
|
|
304
301
|
def self.cache
|
305
302
|
@_cache ||= ::Middleman::Cache.new
|
306
303
|
end
|
307
|
-
|
308
|
-
# Cache accessor for instance, simply forwards to class
|
309
|
-
#
|
310
|
-
# @private
|
311
|
-
# @return [Middleman::Cache] The cache
|
312
|
-
def cache
|
313
|
-
self.class.cache
|
314
|
-
end
|
304
|
+
delegate :cache, :to => :"self.class"
|
315
305
|
|
316
306
|
# Rack env
|
317
307
|
attr :env
|
@@ -465,22 +455,7 @@ protected
|
|
465
455
|
@res.finish
|
466
456
|
end
|
467
457
|
|
468
|
-
|
469
|
-
def helpers(*extensions, &block)
|
470
|
-
self.class.helpers(*extensions, &block)
|
471
|
-
end
|
472
|
-
|
473
|
-
# Set middleware at the class level
|
474
|
-
# @return [void]
|
475
|
-
def use(middleware, *args, &block)
|
476
|
-
self.class.use(middleware, *args, &block)
|
477
|
-
end
|
478
|
-
|
479
|
-
# Set mapped rack app at the class level
|
480
|
-
# @return [void]
|
481
|
-
def map(map, &block)
|
482
|
-
self.class.map(map, &block)
|
483
|
-
end
|
458
|
+
delegate :helpers, :use, :map, :to => :"self.class"
|
484
459
|
|
485
460
|
# Immediately send static file
|
486
461
|
#
|
data/lib/middleman/cli/server.rb
CHANGED
@@ -8,6 +8,7 @@ module Middleman::CoreExtensions::Builder
|
|
8
8
|
app.define_hook :after_build
|
9
9
|
app.extend ClassMethods
|
10
10
|
app.send :include, InstanceMethods
|
11
|
+
app.delegate :build_reroute, :to => :"self.class"
|
11
12
|
end
|
12
13
|
alias :included :registered
|
13
14
|
end
|
@@ -26,13 +27,6 @@ module Middleman::CoreExtensions::Builder
|
|
26
27
|
|
27
28
|
# Build Instance Methods
|
28
29
|
module InstanceMethods
|
29
|
-
# Forward to class method
|
30
|
-
#
|
31
|
-
# @return [Array<Proc>]
|
32
|
-
def build_reroute(&block)
|
33
|
-
self.class.build_reroute(&block)
|
34
|
-
end
|
35
|
-
|
36
30
|
# Run through callbacks and get the new values
|
37
31
|
#
|
38
32
|
# @param [String] destination The current destination of the built file
|
@@ -9,8 +9,12 @@ require 'active_support/inflector' # humanize
|
|
9
9
|
|
10
10
|
FileSet.glob_require('../vendor/padrino-helpers-0.10.5/lib/padrino-helpers/**/*.rb', __FILE__)
|
11
11
|
|
12
|
+
# Built-in helpers
|
12
13
|
module Middleman::CoreExtensions::DefaultHelpers
|
14
|
+
|
15
|
+
# Extension registered
|
13
16
|
class << self
|
17
|
+
# @private
|
14
18
|
def registered(app)
|
15
19
|
app.helpers ::Padrino::Helpers::OutputHelpers
|
16
20
|
app.helpers ::Padrino::Helpers::TagHelpers
|
@@ -30,19 +34,34 @@ module Middleman::CoreExtensions::DefaultHelpers
|
|
30
34
|
alias :included :registered
|
31
35
|
end
|
32
36
|
|
37
|
+
# The helpers
|
33
38
|
module Helpers
|
39
|
+
# Output a stylesheet link tag based on the current path
|
40
|
+
#
|
41
|
+
# @param [String] separator How to break up path in parts
|
42
|
+
# @return [String]
|
34
43
|
def auto_stylesheet_link_tag(separator="/")
|
35
44
|
auto_tag(:css, separator) do |path|
|
36
45
|
stylesheet_link_tag path
|
37
46
|
end
|
38
47
|
end
|
39
48
|
|
49
|
+
# Output a javascript tag based on the current path
|
50
|
+
#
|
51
|
+
# @param [String] separator How to break up path in parts
|
52
|
+
# @return [String]
|
40
53
|
def auto_javascript_include_tag(separator="/")
|
41
54
|
auto_tag(:js, separator) do |path|
|
42
55
|
javascript_include_tag path
|
43
56
|
end
|
44
57
|
end
|
45
58
|
|
59
|
+
# Output a stylesheet link tag based on the current path
|
60
|
+
#
|
61
|
+
# @param [Symbol] asset_ext The type of asset
|
62
|
+
# @param [String] separator How to break up path in parts
|
63
|
+
# @param [String] asset_dir Where to look for assets
|
64
|
+
# @return [void]
|
46
65
|
def auto_tag(asset_ext, separator="/", asset_dir=nil)
|
47
66
|
if asset_dir.nil?
|
48
67
|
asset_dir = case asset_ext
|
@@ -61,6 +80,9 @@ module Middleman::CoreExtensions::DefaultHelpers
|
|
61
80
|
yield path if sitemap.exists?(File.join(asset_dir, path))
|
62
81
|
end
|
63
82
|
|
83
|
+
# Generate body css classes based on the current path
|
84
|
+
#
|
85
|
+
# @return [String]
|
64
86
|
def page_classes
|
65
87
|
path = current_path.dup
|
66
88
|
path << index_file if path.match(%r{/$})
|
@@ -73,7 +95,11 @@ module Middleman::CoreExtensions::DefaultHelpers
|
|
73
95
|
classes.join(' ')
|
74
96
|
end
|
75
97
|
|
76
|
-
#
|
98
|
+
# Get the path of a file of a given type
|
99
|
+
#
|
100
|
+
# @param [Symbol] kind The type of file
|
101
|
+
# @param [String] source The path to the file
|
102
|
+
# @return [String]
|
77
103
|
def asset_path(kind, source)
|
78
104
|
return source if source =~ /^http/
|
79
105
|
asset_folder = case kind
|