middleman 3.0.0.alpha.2 → 3.0.0.alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.yardopts +5 -0
- data/CHANGELOG +5 -0
- data/README.md +3 -0
- data/Rakefile +0 -2
- data/bin/middleman +36 -33
- data/features/auto_layout.feature +37 -0
- data/features/builder.feature +1 -0
- data/features/chained_templates.feature +15 -0
- data/features/content_for.feature +16 -0
- data/features/directory_index.feature +1 -0
- data/features/front-matter.feature +2 -1
- data/features/partials.feature +35 -0
- data/features/support/env.rb +3 -3
- data/fixtures/chained-app/config.rb +0 -0
- data/fixtures/chained-app/data/article.yml +2 -0
- data/fixtures/chained-app/source/index.html.markdown.erb +8 -0
- data/fixtures/different-engine-layout/config.rb +0 -0
- data/fixtures/different-engine-layout/source/index.html.haml +1 -0
- data/fixtures/different-engine-layout/source/layout.erb +9 -0
- data/fixtures/engine-matching-layout/config.rb +0 -0
- data/fixtures/engine-matching-layout/source/index.html.erb +1 -0
- data/fixtures/engine-matching-layout/source/layout.erb +9 -0
- data/fixtures/indexable-app/source/.htaccess +1 -0
- data/fixtures/manual-layout-missing/config.rb +1 -0
- data/fixtures/manual-layout-missing/source/index.html.erb +1 -0
- data/fixtures/manual-layout-override/config.rb +3 -0
- data/fixtures/manual-layout-override/source/index.html.erb +1 -0
- data/fixtures/manual-layout-override/source/layouts/another.erb +9 -0
- data/fixtures/manual-layout-override/source/layouts/custom.erb +9 -0
- data/fixtures/manual-layout/config.rb +1 -0
- data/fixtures/manual-layout/source/index.html.erb +1 -0
- data/fixtures/manual-layout/source/layouts/custom.erb +9 -0
- data/fixtures/multiple-layouts/config.rb +0 -0
- data/fixtures/multiple-layouts/source/index.html.erb +1 -0
- data/fixtures/multiple-layouts/source/layout.erb +9 -0
- data/fixtures/multiple-layouts/source/layout.haml +6 -0
- data/fixtures/no-layout/config.rb +0 -0
- data/fixtures/no-layout/source/index.html.erb +1 -0
- data/fixtures/partials-app/config.rb +0 -0
- data/fixtures/partials-app/source/_locals.erb +1 -0
- data/fixtures/partials-app/source/_main.erb +1 -0
- data/fixtures/partials-app/source/_main.haml +1 -0
- data/fixtures/partials-app/source/index.html.erb +3 -0
- data/fixtures/partials-app/source/locals.html.erb +1 -0
- data/fixtures/partials-app/source/second.html.haml +3 -0
- data/fixtures/partials-app/source/shared/_footer.erb +1 -0
- data/fixtures/partials-app/source/shared/_header.erb +1 -0
- data/fixtures/partials-app/source/sub/_local.erb +1 -0
- data/fixtures/partials-app/source/sub/index.html.erb +3 -0
- data/fixtures/test-app/config.rb +6 -0
- data/fixtures/test-app/source/.htaccess +1 -0
- data/fixtures/test-app/source/content_for_erb.html.erb +5 -0
- data/fixtures/test-app/source/content_for_haml.html.haml +4 -0
- data/fixtures/test-app/source/content_for_slim.html.slim +4 -0
- data/fixtures/test-app/source/images/Chrome_Logo.svg +231 -0
- data/fixtures/test-app/source/images/cfb_tomb-perennial-energy.svgz +0 -0
- data/fixtures/test-app/source/index.html.haml +3 -0
- data/fixtures/test-app/source/layouts/content_for.erb +4 -0
- data/lib/middleman.rb +90 -105
- data/lib/middleman/base.rb +254 -239
- data/lib/middleman/builder.rb +51 -46
- data/lib/middleman/cache.rb +57 -0
- data/lib/middleman/cli.rb +7 -10
- data/lib/middleman/core_extensions/assets.rb +3 -3
- data/lib/middleman/core_extensions/compass.rb +25 -45
- data/lib/middleman/core_extensions/data.rb +14 -12
- data/lib/middleman/core_extensions/default_helpers.rb +11 -10
- data/lib/middleman/core_extensions/{features.rb → extensions.rb} +66 -20
- data/lib/middleman/core_extensions/front_matter.rb +16 -13
- data/lib/middleman/core_extensions/rendering.rb +224 -4
- data/lib/middleman/core_extensions/routing.rb +15 -12
- data/lib/middleman/core_extensions/sitemap.rb +6 -191
- data/lib/middleman/core_extensions/sprockets.rb +3 -2
- data/lib/middleman/extensions/asset_host.rb +34 -0
- data/lib/middleman/extensions/automatic_image_sizes.rb +38 -0
- data/lib/middleman/{features → extensions}/automatic_image_sizes/fastimage.rb +0 -0
- data/lib/middleman/extensions/cache_buster.rb +59 -0
- data/lib/middleman/extensions/directory_indexes.rb +62 -0
- data/lib/middleman/extensions/lorem.rb +130 -0
- data/lib/middleman/extensions/minify_css.rb +15 -0
- data/lib/middleman/{features → extensions}/minify_css/cssmin.rb +0 -0
- data/lib/middleman/extensions/minify_javascript.rb +54 -0
- data/lib/middleman/extensions/relative_assets.rb +46 -0
- data/lib/middleman/extensions/sitemap_tree.rb +38 -0
- data/lib/middleman/guard.rb +48 -35
- data/lib/middleman/renderers/erb.rb +3 -13
- data/lib/middleman/renderers/haml.rb +13 -0
- data/lib/middleman/renderers/liquid.rb +3 -3
- data/lib/middleman/renderers/markdown.rb +10 -12
- data/lib/middleman/renderers/sass.rb +3 -9
- data/lib/middleman/sitemap/page.rb +106 -0
- data/lib/middleman/sitemap/store.rb +141 -0
- data/lib/middleman/sitemap/template.rb +57 -0
- data/lib/middleman/step_definitions.rb +6 -0
- data/lib/middleman/step_definitions/builder_steps.rb +45 -0
- data/{features → lib/middleman}/step_definitions/generator_steps.rb +6 -6
- data/{features/step_definitions/middleman_steps.rb → lib/middleman/step_definitions/server_steps.rb} +3 -3
- data/lib/middleman/templates/default/source/index.html.erb +1 -1
- data/lib/middleman/version.rb +7 -1
- data/middleman-x86-mingw32.gemspec +1 -1
- data/middleman.gemspec +5 -3
- metadata +359 -381
- data/bin/mm-build +0 -9
- data/bin/mm-init +0 -9
- data/bin/mm-server +0 -9
- data/features/step_definitions/builder_steps.rb +0 -52
- data/features/tiny_src.feature +0 -15
- data/lib/middleman/features/asset_host.rb +0 -32
- data/lib/middleman/features/automatic_image_sizes.rb +0 -34
- data/lib/middleman/features/cache_buster.rb +0 -55
- data/lib/middleman/features/directory_indexes.rb +0 -59
- data/lib/middleman/features/lorem.rb +0 -126
- data/lib/middleman/features/minify_css.rb +0 -11
- data/lib/middleman/features/minify_javascript.rb +0 -50
- data/lib/middleman/features/relative_assets.rb +0 -42
- data/lib/middleman/features/sitemap_tree.rb +0 -34
data/.gitignore
CHANGED
data/.yardopts
ADDED
data/CHANGELOG
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
3.0.pre
|
2
2
|
====
|
3
3
|
Rewritten to work directly with Rack (Sinatra apps can still be mounted)
|
4
|
+
Sitemap maintains own state
|
5
|
+
New Extension Registration API
|
6
|
+
Remove old 1.x mm- binaries and messaging
|
7
|
+
New default layout functionality: https://github.com/tdreyno/middleman/issues/165
|
8
|
+
Enable chained templates outside of sprockets (file.html.markdown.erb)
|
4
9
|
|
5
10
|
2.1.pre
|
6
11
|
====
|
data/README.md
CHANGED
@@ -14,6 +14,9 @@ http://middlemanapp.com
|
|
14
14
|
|
15
15
|
If you have questions, answers can be found on community forum: https://convore.com/middleman/
|
16
16
|
|
17
|
+
## Generated Source Documentation
|
18
|
+
http://rubydoc.info/github/tdreyno/middleman/master/frames
|
19
|
+
|
17
20
|
## Copyright
|
18
21
|
|
19
22
|
Copyright (c) 2010 Thomas Reynolds. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -7,8 +7,6 @@ Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
|
7
7
|
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
8
8
|
end
|
9
9
|
|
10
|
-
#$LOAD_PATH.unshift 'lib'
|
11
|
-
|
12
10
|
require 'rake/testtask'
|
13
11
|
require 'rake/clean'
|
14
12
|
|
data/bin/middleman
CHANGED
@@ -8,48 +8,50 @@ require 'rubygems'
|
|
8
8
|
|
9
9
|
module Middleman
|
10
10
|
module ProjectLocator
|
11
|
-
|
12
|
-
|
11
|
+
class << self
|
12
|
+
def locate_middleman_root!(args)
|
13
|
+
cwd = Dir.pwd
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
if !in_middleman_project? && !in_middleman_project_subdirectory?
|
16
|
+
$stderr.puts "== Error: Could not find a Middleman project config, perhaps you are in the wrong folder?"
|
17
|
+
return
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
if in_middleman_project?
|
21
|
+
did_locate_middleman_project(cwd, args)
|
22
|
+
return
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
Dir.chdir("..") do
|
26
|
+
# Recurse in a chdir block: if the search fails we want to be sure
|
27
|
+
# the application is generated in the original working directory.
|
28
|
+
locate_middleman_root!(args) unless cwd == Dir.pwd
|
29
|
+
end
|
30
|
+
rescue SystemCallError
|
31
|
+
# could not chdir, no problem just return
|
28
32
|
end
|
29
|
-
rescue SystemCallError
|
30
|
-
# could not chdir, no problem just return
|
31
|
-
end
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
def in_middleman_project?
|
35
|
+
File.exists?('config.rb')
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
def in_middleman_project_subdirectory?(path = Pathname.new(Dir.pwd))
|
39
|
+
File.exists?(File.join(path, 'config.rb')) || !path.root? && in_middleman_project_subdirectory?(path.parent)
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
def did_locate_middleman_project(path, args)
|
43
|
+
# Set up gems listed in the Gemfile.
|
44
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile', path)
|
44
45
|
|
45
|
-
|
46
|
+
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
46
47
|
|
47
|
-
|
48
|
-
|
48
|
+
start_cli!(args)
|
49
|
+
end
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
def start_cli!(args)
|
52
|
+
require 'middleman'
|
53
|
+
Middleman::CLI.start(args)
|
54
|
+
end
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|
@@ -59,7 +61,8 @@ args = ARGV.dup
|
|
59
61
|
ARG_ALIASES = {
|
60
62
|
"s" => "server",
|
61
63
|
"b" => "build",
|
62
|
-
"i" => "init"
|
64
|
+
"i" => "init",
|
65
|
+
"w" => "watch"
|
63
66
|
}
|
64
67
|
|
65
68
|
if ARG_ALIASES.has_key?(args[0])
|
@@ -0,0 +1,37 @@
|
|
1
|
+
Feature: Provide Sane Defaults for Layout Behavior
|
2
|
+
|
3
|
+
Scenario: Template and Layout of same engine exist
|
4
|
+
Given the Server is running at "engine-matching-layout"
|
5
|
+
When I go to "/index.html"
|
6
|
+
Then I should see "Comment in layout"
|
7
|
+
|
8
|
+
Scenario: Template and Layout of different engine
|
9
|
+
Given the Server is running at "different-engine-layout"
|
10
|
+
When I go to "/index.html"
|
11
|
+
Then I should see "Comment in layout"
|
12
|
+
|
13
|
+
Scenario: Multiple layouts exist, prefer same engine
|
14
|
+
Given the Server is running at "multiple-layouts"
|
15
|
+
When I go to "/index.html"
|
16
|
+
Then I should see "ERb Comment in layout"
|
17
|
+
|
18
|
+
Scenario: No layout exists
|
19
|
+
Given the Server is running at "no-layout"
|
20
|
+
When I go to "/index.html"
|
21
|
+
Then I should not see "Comment in layout"
|
22
|
+
|
23
|
+
Scenario: Manually set default layout in config (exists)
|
24
|
+
Given the Server is running at "manual-layout"
|
25
|
+
When I go to "/index.html"
|
26
|
+
Then I should see "Custom Comment in layout"
|
27
|
+
|
28
|
+
Scenario: Manually set default layout in config (does not exist)
|
29
|
+
Given the Server is running at "manual-layout-missing"
|
30
|
+
When I go to "/index.html"
|
31
|
+
Then I should see "Error"
|
32
|
+
|
33
|
+
Scenario: Overwrite manual layout
|
34
|
+
Given the Server is running at "manual-layout-override"
|
35
|
+
When I go to "/index.html"
|
36
|
+
Then I should see "Another Comment in layout"
|
37
|
+
|
data/features/builder.feature
CHANGED
@@ -15,6 +15,7 @@ Feature: Builder
|
|
15
15
|
Then "spaces in file.html" should exist at "test-app" and include "spaces"
|
16
16
|
Then "images/Read me (example).txt" should exist at "test-app"
|
17
17
|
Then "images/Child folder/regular_file(example).txt" should exist at "test-app"
|
18
|
+
Then ".htaccess" should exist at "test-app"
|
18
19
|
|
19
20
|
Scenario: Build glob
|
20
21
|
Given a built app at "glob-app" with flags "--glob '*.css'"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Feature: Templates should be chainable
|
2
|
+
In order to insert variables and data in "static" engines
|
3
|
+
|
4
|
+
Scenario: Data in Erb in Markdown
|
5
|
+
Given the Server is running at "chained-app"
|
6
|
+
When I go to "/index.html"
|
7
|
+
Then I should see "Title</h1>"
|
8
|
+
And I should see "Subtitle</h2>"
|
9
|
+
And I should see "Sup</h3>"
|
10
|
+
|
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>"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Support content_for and yield_content helpers
|
2
|
+
|
3
|
+
Scenario: content_for works as expected in erb
|
4
|
+
Given the Server is running at "test-app"
|
5
|
+
When I go to "/content_for_erb.html"
|
6
|
+
Then I should see "In Layout: I am the yielded content erb"
|
7
|
+
|
8
|
+
Scenario: content_for works as expected in haml
|
9
|
+
Given the Server is running at "test-app"
|
10
|
+
When I go to "/content_for_haml.html"
|
11
|
+
Then I should see "In Layout: I am the yielded content haml"
|
12
|
+
|
13
|
+
Scenario: content_for works as expected in slim
|
14
|
+
Given the Server is running at "test-app"
|
15
|
+
When I go to "/content_for_slim.html"
|
16
|
+
Then I should see "In Layout: I am the yielded content slim"
|
@@ -11,6 +11,7 @@ Feature: Directory Index
|
|
11
11
|
Then "needs_index.html" should not exist at "indexable-app"
|
12
12
|
Then "a_folder/needs_index.html" should not exist at "indexable-app"
|
13
13
|
Then "leave_me_alone/index.html" should not exist at "indexable-app"
|
14
|
+
Then ".htaccess" should exist at "indexable-app"
|
14
15
|
|
15
16
|
Scenario: Preview normal file
|
16
17
|
Given the Server is running at "indexable-app"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: Provide Sane Defaults for Partial Behavior
|
2
|
+
|
3
|
+
Scenario: Finds shared partials relative to the root
|
4
|
+
Given the Server is running at "partials-app"
|
5
|
+
When I go to "/index.html"
|
6
|
+
Then I should see "Header"
|
7
|
+
And I should see "Footer"
|
8
|
+
|
9
|
+
Scenario: Finds shared partials relative to the root (sub)
|
10
|
+
Given the Server is running at "partials-app"
|
11
|
+
When I go to "/sub/index.html"
|
12
|
+
Then I should see "Header"
|
13
|
+
And I should see "Footer"
|
14
|
+
|
15
|
+
Scenario: Prefers partials of the same engine type
|
16
|
+
Given the Server is running at "partials-app"
|
17
|
+
When I go to "/index.html"
|
18
|
+
Then I should see "ERb Main"
|
19
|
+
|
20
|
+
Scenario: Prefers partials of the same engine type
|
21
|
+
Given the Server is running at "partials-app"
|
22
|
+
When I go to "/second.html"
|
23
|
+
Then I should see "Haml Main"
|
24
|
+
And I should see "Header"
|
25
|
+
And I should see "Footer"
|
26
|
+
|
27
|
+
Scenario: Finds partial relative to template
|
28
|
+
Given the Server is running at "partials-app"
|
29
|
+
When I go to "/sub/index.html"
|
30
|
+
Then I should see "Local Partial"
|
31
|
+
|
32
|
+
Scenario: Partials can be passed locals
|
33
|
+
Given the Server is running at "partials-app"
|
34
|
+
When I go to "/locals.html"
|
35
|
+
Then I should see "Local var is bar"
|
data/features/support/env.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
require File.join(
|
3
|
-
require
|
1
|
+
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
|
2
|
+
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman')
|
3
|
+
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman', 'step_definitions')
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
%h1 Welcome
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Welcome</h1>
|
@@ -0,0 +1 @@
|
|
1
|
+
# I'm an htaccess file!
|
@@ -0,0 +1 @@
|
|
1
|
+
set :layout, :custom
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Welcome</h1>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Welcome</h1>
|
@@ -0,0 +1 @@
|
|
1
|
+
set :layout, :custom
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Welcome</h1>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Welcome</h1>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Welcome</h1>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
Local var is <%= foo %>
|
@@ -0,0 +1 @@
|
|
1
|
+
ERb Main
|
@@ -0,0 +1 @@
|
|
1
|
+
Haml Main
|