middleman 3.0.0.alpha.3 → 3.0.0.alpha.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -2
- data/.yardopts +2 -0
- data/CHANGELOG.md +97 -0
- data/README.md +84 -13
- data/Rakefile +6 -2
- data/bin/middleman +5 -4
- data/features/builder.feature +7 -0
- data/features/clean_build.feature +11 -0
- data/features/current_page_request_path_backwards.feature +6 -0
- data/features/front-matter.feature +28 -1
- data/features/generator.feature +4 -4
- data/features/helpers_external.feature +6 -0
- data/features/helpers_lorem.feature +5 -0
- data/features/instance_vars.feature +20 -0
- data/features/markdown.feature +23 -3
- data/features/minify_css.feature +6 -1
- data/features/minify_javascript.feature +33 -1
- data/features/mount_rack.feature +8 -0
- data/features/partials.feature +7 -1
- data/features/preview_changes.feature +18 -0
- data/features/wildcard_page_helper.feature +19 -0
- data/fixtures/build-with-errors-app/config.rb +1 -0
- data/fixtures/build-with-errors-app/source/index.html.erb +1 -0
- data/fixtures/clean-app/source/index.html.haml +1 -6
- data/fixtures/clean-dir-app/config.rb +2 -0
- data/fixtures/clean-dir-app/source/about.html +1 -0
- data/fixtures/different-engine-partial/config.rb +0 -0
- data/fixtures/different-engine-partial/source/index.html.erb +1 -0
- data/fixtures/different-engine-partial/source/layouts/layout.erb +7 -0
- data/fixtures/different-engine-partial/source/shared/_footer.slim +1 -0
- data/fixtures/different-engine-partial/source/shared/_header.erb +1 -0
- data/fixtures/external-helpers/config.rb +4 -0
- data/fixtures/external-helpers/lib/hello_helper.rb +5 -0
- data/fixtures/external-helpers/source/index.html.erb +1 -0
- data/fixtures/instance-vars-app/config.rb +0 -0
- data/fixtures/instance-vars-app/source/_vartial.erb +5 -0
- data/fixtures/instance-vars-app/source/instance-var-set.html.erb +2 -0
- data/fixtures/instance-vars-app/source/layout.erb +3 -0
- data/fixtures/instance-vars-app/source/no-instance-var.html.erb +1 -0
- data/fixtures/markdown-app/config.rb +9 -0
- data/fixtures/markdown-app/source/autolink.html.markdown +5 -0
- data/fixtures/markdown-app/source/fenced_code_blocks.html.markdown +7 -0
- data/fixtures/markdown-app/source/index.html.markdown +4 -0
- data/fixtures/markdown-app/source/no_intra_emphasis.html.markdown +5 -0
- data/fixtures/markdown-app/source/smarty_pants.html.markdown +5 -0
- data/fixtures/markdown-app/source/space_after_headers.html.markdown +5 -0
- data/fixtures/markdown-app/source/strikethrough.html.markdown +5 -0
- data/fixtures/markdown-app/source/superscript.html.markdown +5 -0
- data/fixtures/markdown-app/source/tables.html.markdown +8 -0
- data/fixtures/passthrough-app/config.rb +17 -0
- data/fixtures/passthrough-app/source/.htaccess +1 -0
- data/fixtures/passthrough-app/source/inline-coffeescript.html.haml +3 -0
- data/fixtures/passthrough-app/source/inline-css.html.haml +4 -0
- data/fixtures/passthrough-app/source/inline-js.html.haml +7 -0
- data/fixtures/passthrough-app/source/javascripts/coffee_test.js.coffee +3 -0
- data/fixtures/passthrough-app/source/javascripts/js_test.js +8 -0
- data/fixtures/passthrough-app/source/stylesheets/site.css.sass +1 -0
- data/fixtures/preview-app/config.rb +0 -0
- data/fixtures/preview-app/source/content.html.erb +1 -0
- data/fixtures/preview-app/source/layout.erb +1 -0
- data/fixtures/sinatra-app/config.rb +11 -0
- data/fixtures/sinatra-app/source/index.html.erb +5 -0
- data/fixtures/test-app/config.rb +2 -2
- data/fixtures/test-app/source/front-matter-2.php.erb +7 -0
- data/fixtures/test-app/source/front-matter-change.html.erb +5 -0
- data/fixtures/test-app/source/index.html.slim +9 -0
- data/fixtures/test-app/source/javascripts/js_test.js +8 -0
- data/fixtures/test-app/source/lorem.html.erb +12 -0
- data/fixtures/test-app/source/request-path.html.erb +1 -0
- data/fixtures/wildcard-app/config.rb +1 -0
- data/fixtures/wildcard-app/source/admin/index.html.erb +1 -0
- data/fixtures/wildcard-app/source/admin/page.html.erb +1 -0
- data/fixtures/wildcard-app/source/index.html.erb +1 -0
- data/fixtures/wildcard-app/source/layouts/admin.erb +2 -0
- data/fixtures/wildcard-app/source/layouts/layout.erb +2 -0
- data/fixtures/wildcard-directory-index-app/config.rb +2 -0
- data/fixtures/wildcard-directory-index-app/source/admin/index.html.erb +1 -0
- data/fixtures/wildcard-directory-index-app/source/admin/page.html.erb +1 -0
- data/fixtures/wildcard-directory-index-app/source/index.html.erb +1 -0
- data/fixtures/wildcard-directory-index-app/source/layouts/admin.erb +2 -0
- data/fixtures/wildcard-directory-index-app/source/layouts/layout.erb +2 -0
- data/lib/middleman.rb +63 -8
- data/lib/middleman/base.rb +56 -12
- data/lib/middleman/builder.rb +18 -12
- data/lib/middleman/cli.rb +5 -5
- data/lib/middleman/core_extensions/assets.rb +12 -0
- data/lib/middleman/core_extensions/builder.rb +4 -4
- data/lib/middleman/core_extensions/extensions.rb +5 -51
- data/lib/middleman/core_extensions/front_matter.rb +30 -11
- data/lib/middleman/core_extensions/rendering.rb +18 -12
- data/lib/middleman/core_extensions/routing.rb +12 -0
- data/lib/middleman/core_extensions/show_exceptions.rb +16 -0
- data/lib/middleman/core_extensions/sitemap.rb +10 -4
- data/lib/middleman/extensions/minify_css.rb +4 -2
- data/lib/middleman/extensions/minify_javascript.rb +8 -6
- data/lib/middleman/guard.rb +80 -76
- data/lib/middleman/renderers/markdown.rb +8 -13
- data/lib/middleman/sitemap/page.rb +3 -2
- data/lib/middleman/sitemap/store.rb +3 -1
- data/lib/middleman/sitemap/template.rb +19 -5
- data/lib/middleman/step_definitions.rb +1 -0
- data/lib/middleman/step_definitions/builder_steps.rb +6 -1
- data/lib/middleman/step_definitions/generator_steps.rb +9 -13
- data/lib/middleman/step_definitions/middleman_steps.rb +13 -0
- data/lib/middleman/step_definitions/server_steps.rb +7 -0
- data/lib/middleman/templates.rb +42 -21
- data/lib/middleman/templates/default.rb +5 -0
- data/lib/middleman/templates/html5.rb +6 -0
- data/lib/middleman/templates/local.rb +5 -6
- data/lib/middleman/templates/mobile.rb +6 -0
- data/lib/middleman/version.rb +1 -1
- data/middleman-x86-mingw32.gemspec +1 -1
- data/middleman.gemspec +3 -2
- metadata +531 -242
- data/CHANGELOG +0 -98
- data/fixtures/test-app/source/index.html.haml +0 -9
- data/fixtures/test-app/source/markdown.html.markdown +0 -1
@@ -0,0 +1,8 @@
|
|
1
|
+
Feature: Support Rack apps mounted using map
|
2
|
+
|
3
|
+
Scenario: Mounted Rack App at /sinatra
|
4
|
+
Given the Server is running at "sinatra-app"
|
5
|
+
When I go to "/"
|
6
|
+
Then I should see "Hello World (Middleman)"
|
7
|
+
When I go to "/sinatra/"
|
8
|
+
Then I should see "Hello World (Sinatra)"
|
data/features/partials.feature
CHANGED
@@ -32,4 +32,10 @@ Feature: Provide Sane Defaults for Partial Behavior
|
|
32
32
|
Scenario: Partials can be passed locals
|
33
33
|
Given the Server is running at "partials-app"
|
34
34
|
When I go to "/locals.html"
|
35
|
-
Then I should see "Local var is bar"
|
35
|
+
Then I should see "Local var is bar"
|
36
|
+
|
37
|
+
Scenario: Partial and Layout use different engines
|
38
|
+
Given the Server is running at "different-engine-partial"
|
39
|
+
When I go to "/index.html"
|
40
|
+
Then I should see "ERb Header"
|
41
|
+
And I should see "Slim Footer"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature: Preview Changes
|
2
|
+
In order to run quickly, we should update internal caches on file changes
|
3
|
+
|
4
|
+
Scenario: A template changes contents during preview
|
5
|
+
Given the Server is running at "preview-app"
|
6
|
+
And the file "source/content.html.erb" has the contents
|
7
|
+
"""
|
8
|
+
Hello World
|
9
|
+
"""
|
10
|
+
When I go to "/content.html"
|
11
|
+
Then I should see "Hello World"
|
12
|
+
And the file "source/content.html.erb" has the contents
|
13
|
+
"""
|
14
|
+
Hola Mundo
|
15
|
+
"""
|
16
|
+
When I go to "/content.html"
|
17
|
+
Then I should see "Hola Mundo"
|
18
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Feature: Wildcards in Page helper
|
2
|
+
|
3
|
+
Scenario: Setting the layout for a folder
|
4
|
+
Given the Server is running at "wildcard-app"
|
5
|
+
When I go to "/index.html"
|
6
|
+
Then I should see "Normal Layout"
|
7
|
+
When I go to "/admin/index.html"
|
8
|
+
Then I should see "Admin Layout"
|
9
|
+
When I go to "/admin/page.html"
|
10
|
+
Then I should see "Admin Layout"
|
11
|
+
|
12
|
+
Scenario: Setting the layout for a folder
|
13
|
+
Given the Server is running at "wildcard-directory-index-app"
|
14
|
+
When I go to "/"
|
15
|
+
Then I should see "Normal Layout"
|
16
|
+
When I go to "/admin/"
|
17
|
+
Then I should see "Admin Layout"
|
18
|
+
When I go to "/admin/page.html"
|
19
|
+
Then I should see "Admin Layout"
|
@@ -0,0 +1 @@
|
|
1
|
+
set :layout, false
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= error_error_error %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Fun times
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
Index
|
@@ -0,0 +1 @@
|
|
1
|
+
footer Slim Footer
|
@@ -0,0 +1 @@
|
|
1
|
+
<header>ERb Header</header>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= hello %>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= partial 'vartial' %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ::PassThrough
|
2
|
+
def self.compress(data)
|
3
|
+
data
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
set :js_compressor, ::PassThrough
|
8
|
+
set :css_compressor, ::PassThrough
|
9
|
+
|
10
|
+
activate :minify_javascript
|
11
|
+
activate :minify_css
|
12
|
+
|
13
|
+
with_layout false do
|
14
|
+
page "/inline-css.html"
|
15
|
+
page "/inline-js.html"
|
16
|
+
page "/inline-coffeescript.html"
|
17
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# I'm an htaccess file!
|
@@ -0,0 +1 @@
|
|
1
|
+
@import "compass/reset"
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
Hola Mundo
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
data/fixtures/test-app/config.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require "maruku"
|
2
1
|
require "slim"
|
3
2
|
require "liquid"
|
4
3
|
require "coffee-filter"
|
@@ -22,7 +21,8 @@ with_layout :content_for do
|
|
22
21
|
end
|
23
22
|
|
24
23
|
with_layout false do
|
25
|
-
page "/
|
24
|
+
page "/request-path.html"
|
25
|
+
page "/lorem.html"
|
26
26
|
page "/relative_image.html"
|
27
27
|
page "/inline-css.html"
|
28
28
|
page "/inline-js.html"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= lorem.word %>
|
2
|
+
<%= lorem.words(5) %>
|
3
|
+
<%= lorem.sentence %>
|
4
|
+
<%= lorem.sentences(2) %>
|
5
|
+
<%= lorem.paragraph %>
|
6
|
+
<%= lorem.paragraphs(2) %>
|
7
|
+
<%= lorem.date %>
|
8
|
+
<%= lorem.name %>
|
9
|
+
<%= lorem.first_name %>
|
10
|
+
<%= lorem.last_name %>
|
11
|
+
<%= lorem.email %>
|
12
|
+
<%= lorem.image(100) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= current_path == request.path %>
|
@@ -0,0 +1 @@
|
|
1
|
+
page "/admin/*", :layout => :admin
|
@@ -0,0 +1 @@
|
|
1
|
+
Index
|
@@ -0,0 +1 @@
|
|
1
|
+
Page
|
@@ -0,0 +1 @@
|
|
1
|
+
Index
|
@@ -0,0 +1 @@
|
|
1
|
+
Index
|
@@ -0,0 +1 @@
|
|
1
|
+
Page
|
@@ -0,0 +1 @@
|
|
1
|
+
Index
|
data/lib/middleman.rb
CHANGED
@@ -5,12 +5,12 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
|
5
5
|
# Top-level Middleman object
|
6
6
|
module Middleman
|
7
7
|
# Auto-load modules on-demand
|
8
|
-
autoload :Base,
|
9
|
-
autoload :Cache,
|
10
|
-
autoload :Builder,
|
11
|
-
autoload :CLI,
|
12
|
-
autoload :Templates,
|
13
|
-
autoload :Guard,
|
8
|
+
autoload :Base, "middleman/base"
|
9
|
+
autoload :Cache, "middleman/cache"
|
10
|
+
autoload :Builder, "middleman/builder"
|
11
|
+
autoload :CLI, "middleman/cli"
|
12
|
+
autoload :Templates, "middleman/templates"
|
13
|
+
autoload :Guard, "middleman/guard"
|
14
14
|
|
15
15
|
# Custom Renderers
|
16
16
|
module Renderers
|
@@ -57,13 +57,16 @@ module Middleman
|
|
57
57
|
autoload :Rendering, "middleman/core_extensions/rendering"
|
58
58
|
|
59
59
|
# Compass framework for Sass
|
60
|
-
autoload :Compass,
|
60
|
+
autoload :Compass, "middleman/core_extensions/compass"
|
61
61
|
|
62
62
|
# Sprockets 2
|
63
|
-
autoload :Sprockets,
|
63
|
+
autoload :Sprockets, "middleman/core_extensions/sprockets"
|
64
64
|
|
65
65
|
# Pass custom options to views
|
66
66
|
autoload :Routing, "middleman/core_extensions/routing"
|
67
|
+
|
68
|
+
# Catch and show exceptions at the Rack level
|
69
|
+
autoload :ShowExceptions, "middleman/core_extensions/show_exceptions"
|
67
70
|
end
|
68
71
|
|
69
72
|
module Extensions
|
@@ -100,6 +103,52 @@ module Middleman
|
|
100
103
|
|
101
104
|
# Organize the sitemap as a tree
|
102
105
|
autoload :SitemapTree, "middleman/extensions/sitemap_tree"
|
106
|
+
|
107
|
+
class << self
|
108
|
+
def registered
|
109
|
+
@_registered ||= {}
|
110
|
+
end
|
111
|
+
|
112
|
+
def register(name, namespace=nil, version=nil, &block)
|
113
|
+
# If we've already got a matching extension that passed the
|
114
|
+
# version check, bail out.
|
115
|
+
return if registered.has_key?(name.to_sym) &&
|
116
|
+
!registered[name.to_sym].is_a?(String)
|
117
|
+
|
118
|
+
if block_given?
|
119
|
+
version = namespace
|
120
|
+
end
|
121
|
+
|
122
|
+
passed_version_check = true
|
123
|
+
if !version.nil?
|
124
|
+
requirement = ::Gem::Requirement.create(version)
|
125
|
+
if !requirement.satisfied_by?(Middleman::GEM_VERSION)
|
126
|
+
passed_version_check = false
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
registered[name.to_sym] = if !passed_version_check
|
131
|
+
"== #{name} failed version check. Requested #{version}, got #{Middleman::VERSION}"
|
132
|
+
elsif block_given?
|
133
|
+
block
|
134
|
+
elsif namespace
|
135
|
+
namespace
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def load(name)
|
140
|
+
name = name.to_sym
|
141
|
+
return nil unless registered.has_key?(name)
|
142
|
+
|
143
|
+
extension = registered[name]
|
144
|
+
if extension.is_a?(Proc)
|
145
|
+
extension = extension.call() || nil
|
146
|
+
registered[name] = extension
|
147
|
+
end
|
148
|
+
|
149
|
+
extension
|
150
|
+
end
|
151
|
+
end
|
103
152
|
end
|
104
153
|
|
105
154
|
# Where to look in gems for extensions to auto-register
|
@@ -107,6 +156,12 @@ module Middleman
|
|
107
156
|
|
108
157
|
class << self
|
109
158
|
|
159
|
+
# Where to look for custom templates
|
160
|
+
# @returns [String]
|
161
|
+
def templates_path
|
162
|
+
File.join(File.expand_path("~/"), ".middleman")
|
163
|
+
end
|
164
|
+
|
110
165
|
# Automatically load extensions from available RubyGems
|
111
166
|
# which contain the EXTENSION_FILE
|
112
167
|
#
|