split into middleman-core and middleman-more

This commit is contained in:
Thomas Reynolds 2011-12-29 15:09:51 -08:00
parent 8e66929a3f
commit c8a134a386
767 changed files with 738 additions and 301 deletions

17
Gemfile
View file

@ -1,3 +1,16 @@
source :rubygems source :rubygems
gemspec :name => "middleman" group :development do
gem "cucumber", "~> 1.1.0"
gem "aruba", "~> 0.4.11"
gem "rake", "~> 0.9.2"
gem "rspec", "~> 2.7"
gem "rdoc", "~> 3.9"
gem "yard"
# For actual tests
gem "sinatra"
end
gem "middleman-core", :path => "middleman-core"
# gem "middleman-more", :path => "middleman-more"

View file

@ -1,17 +1,7 @@
require 'bundler' ROOT = File.expand_path(File.dirname(__FILE__))
Bundler::GemHelper.install_tasks :name => ENV["NAME"] || "middleman"
require 'cucumber/rake/task' task :test do
["middleman-core"].each do |g|
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t| sh "cd #{File.join(ROOT, g)} && bundle exec rake test"
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}" end
end end
require 'rake/clean'
task :test => ["cucumber"]
desc "Build HTML documentation"
task :doc do
sh 'bundle exec yard'
end

View file

@ -1,3 +0,0 @@
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman')
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman', 'step_definitions')

View file

@ -1,8 +0,0 @@
---
layout: false
sup: "Sup"
---
# <%= data.article.title %>
## <%= data.article.subtitle %>
### <%= data.page.sup %>

View file

@ -1 +0,0 @@
h1 Welcome

View file

@ -1,2 +0,0 @@
activate :directory_indexes

View file

@ -1 +0,0 @@
Fun times

View file

@ -1 +0,0 @@
set :erb, :layout_engine => :haml

View file

@ -1,6 +0,0 @@
%html
%head
%title My Sample Site
/ Comment in layout
%body
= yield

View file

@ -1,3 +0,0 @@
%html
%body
= yield

View file

@ -1 +0,0 @@
%h1 Welcome

View file

@ -1 +0,0 @@
footer Slim Footer

View file

@ -1,6 +0,0 @@
%h1 Welcome
:markdown
## H2
Paragraph

View file

@ -1,6 +0,0 @@
%html
%head
%title My Sample Site
/ Haml Comment in layout
%body
= yield

View file

@ -1 +0,0 @@
Haml Main

View file

@ -1,3 +0,0 @@
= partial "shared/header"
= partial "main"
= partial "shared/footer"

View file

@ -1 +0,0 @@
%h1 Welcome

View file

@ -1,6 +0,0 @@
%html
%head
%title My Sample Site
/ Comment in layout
%body
= yield

View file

@ -1,5 +0,0 @@
%html
%head
%title Custom Layout
%body
= yield

View file

@ -1 +0,0 @@
@import "compass/reset"

23
gem_rake_helper.rb Normal file
View file

@ -0,0 +1,23 @@
require 'rubygems' unless defined?(Gem)
require 'rake'
require 'cucumber/rake/task'
require 'bundler/gem_tasks'
require 'yard'
# Skip the releasing tag
# class Bundler::GemHelper
# def release_gem
# guard_clean
# guard_already_tagged
# built_gem_path = build_gem
# rubygem_push(built_gem_path)
# end
# end
Cucumber::Rake::Task.new(:test, 'Run features that should pass') do |t|
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
end
YARD::Rake::YardocTask.new
task :default => :test

View file

@ -1,3 +0,0 @@
source "http://rubygems.org"
gem "middleman", "~><%= Middleman::VERSION %>"

View file

@ -1,13 +0,0 @@
# Using for version parsing
require "rubygems"
module Middleman
# Current Version
# @return [String]
VERSION = "3.0.0.alpha.6"
# Parsed version for RubyGems
# @private
# @return [String]
GEM_VERSION = ::Gem::Version.create(VERSION)
end

View file

@ -34,7 +34,7 @@ end
ARGV << "server" if ARGV.length < 1 ARGV << "server" if ARGV.length < 1
# Require Middleman # Require Middleman
require 'middleman' require 'middleman-core'
# Change directory to the root # Change directory to the root
Dir.chdir(ENV["MM_ROOT"] || Dir.pwd) do Dir.chdir(ENV["MM_ROOT"] || Dir.pwd) do

View file

@ -33,5 +33,4 @@ Feature: Provide Sane Defaults for Layout Behavior
Scenario: Overwrite manual layout Scenario: Overwrite manual layout
Given the Server is running at "manual-layout-override" Given the Server is running at "manual-layout-override"
When I go to "/index.html" When I go to "/index.html"
Then I should see "Another Comment in layout" Then I should see "Another Comment in layout"

View file

@ -2,15 +2,12 @@ Feature: Builder
In order to output static html and css for delivery In order to output static html and css for delivery
Scenario: Checking built folder for content Scenario: Checking built folder for content
Given a successfully built app at "test-app" Given a successfully built app at "large-build-app"
When I cd to "build" When I cd to "build"
Then the following files should exist: Then the following files should exist:
| index.html | | index.html |
| javascripts/coffee_test.js |
| static.html | | static.html |
| services/index.html | | services/index.html |
| stylesheets/site.css |
| stylesheets/site_scss.css |
| stylesheets/static.css | | stylesheets/static.css |
| spaces in file.html | | spaces in file.html |
| images/blank.gif | | images/blank.gif |
@ -19,7 +16,6 @@ Feature: Builder
| .htaccess | | .htaccess |
Then the following files should not exist: Then the following files should not exist:
| _partial | | _partial |
| _liquid_partial |
| layout | | layout |
| other_layout | | other_layout |
| layouts/custom | | layouts/custom |
@ -27,11 +23,8 @@ Feature: Builder
And the file "index.html" should contain "Comment in layout" And the file "index.html" should contain "Comment in layout"
And the file "index.html" should contain "<h1>Welcome</h1>" And the file "index.html" should contain "<h1>Welcome</h1>"
And the file "javascripts/coffee_test.js" should contain "Array.prototype.slice"
And the file "static.html" should contain "Static, no code!" And the file "static.html" should contain "Static, no code!"
And the file "services/index.html" should contain "Services" And the file "services/index.html" should contain "Services"
And the file "stylesheets/site.css" should contain "html, body, div, span"
And the file "stylesheets/site_scss.css" should contain "html, body, div, span"
And the file "stylesheets/static.css" should contain "body" And the file "stylesheets/static.css" should contain "body"
And the file "spaces in file.html" should contain "spaces" And the file "spaces in file.html" should contain "spaces"
@ -52,6 +45,6 @@ Feature: Builder
Then the exit status should be 1 Then the exit status should be 1
Scenario: Build alias (b) Scenario: Build alias (b)
Given a fixture app "test-app" Given a fixture app "large-build-app"
When I run `middleman b` When I run `middleman b`
Then was successfully built Then was successfully built

View file

@ -0,0 +1,6 @@
Feature: Support content_for and yield_content helpers
Scenario: content_for works as expected in erb
Given the Server is running at "content-for-app"
When I go to "/content_for_erb.html"
Then I should see "In Layout: I am the yielded content erb"

View file

@ -1,6 +1,6 @@
Feature: Support old request.path object used by many extensions Feature: Support old request.path object used by many extensions
Scenario: Viewing the root path Scenario: Viewing the root path
Given the Server is running at "test-app" Given the Server is running at "current-page-app"
When I go to "/request-path.html" When I go to "/request-path.html"
Then I should see "true" Then I should see "true"

View file

@ -5,9 +5,4 @@ Feature: Custom Layout Engine
When I cd to "build" When I cd to "build"
Then the following files should exist: Then the following files should exist:
| index.html | | index.html |
And the file "index.html" should contain "Comment in layout" And the file "index.html" should contain "Comment in layout"
Scenario: Checking server for content
Given the Server is running at "test-app"
When I go to "/index.html"
Then I should see "Comment in layout"

View file

@ -3,19 +3,19 @@ Feature: Custom layouts
Scenario: Using custom :layout attribute Scenario: Using custom :layout attribute
Given page "/custom-layout.html" has layout "custom" Given page "/custom-layout.html" has layout "custom"
And the Server is running at "test-app" And the Server is running at "custom-layout-app2"
When I go to "/custom-layout.html" When I go to "/custom-layout.html"
Then I should see "Custom Layout" Then I should see "Custom Layout"
Scenario: Using with_layout block Scenario: Using with_layout block
Given "/custom-layout.html" with_layout block has layout "custom" Given "/custom-layout.html" with_layout block has layout "custom"
And the Server is running at "test-app" And the Server is running at "custom-layout-app2"
When I go to "/custom-layout.html" When I go to "/custom-layout.html"
Then I should see "Custom Layout" Then I should see "Custom Layout"
Scenario: Using custom :layout attribute with folders Scenario: Using custom :layout attribute with folders
Given page "/custom-layout-dir/" has layout "custom" Given page "/custom-layout-dir/" has layout "custom"
And the Server is running at "test-app" And the Server is running at "custom-layout-app2"
When I go to "/custom-layout-dir" When I go to "/custom-layout-dir"
Then I should see "Custom Layout" Then I should see "Custom Layout"
When I go to "/custom-layout-dir/" When I go to "/custom-layout-dir/"
@ -25,7 +25,7 @@ Feature: Custom layouts
Scenario: Using custom :layout attribute with folders Scenario: Using custom :layout attribute with folders
Given page "/custom-layout-dir" has layout "custom" Given page "/custom-layout-dir" has layout "custom"
And the Server is running at "test-app" And the Server is running at "custom-layout-app2"
When I go to "/custom-layout-dir" When I go to "/custom-layout-dir"
Then I should see "Custom Layout" Then I should see "Custom Layout"
When I go to "/custom-layout-dir/" When I go to "/custom-layout-dir/"
@ -35,7 +35,7 @@ Feature: Custom layouts
Scenario: Using custom :layout attribute with folders Scenario: Using custom :layout attribute with folders
Given page "/custom-layout-dir/index.html" has layout "custom" Given page "/custom-layout-dir/index.html" has layout "custom"
And the Server is running at "test-app" And the Server is running at "custom-layout-app2"
When I go to "/custom-layout-dir" When I go to "/custom-layout-dir"
Then I should see "Custom Layout" Then I should see "Custom Layout"
When I go to "/custom-layout-dir/" When I go to "/custom-layout-dir/"

View file

@ -2,19 +2,19 @@ Feature: Local Data API
In order to abstract content from structure In order to abstract content from structure
Scenario: Rendering html Scenario: Rendering html
Given the Server is running at "test-app" Given the Server is running at "basic-data-app"
When I go to "/data.html" When I go to "/data.html"
Then I should see "One:Two" Then I should see "One:Two"
Scenario: Rendering json Scenario: Rendering json
Given the Server is running at "test-app" Given the Server is running at "basic-data-app"
When I go to "/data3.html" When I go to "/data3.html"
Then I should see "One:Two" Then I should see "One:Two"
Scenario: Rendering liquid # Scenario: Rendering liquid
Given the Server is running at "test-app" # Given the Server is running at "basic-data-app"
When I go to "/data2.html" # When I go to "/data2.html"
Then I should see "OneTwo" # Then I should see "OneTwo"
Scenario: Using data in config.rb Scenario: Using data in config.rb
Given the Server is running at "data-app" Given the Server is running at "data-app"

View file

@ -2,7 +2,7 @@ Feature: Dynamic Pages
In order to use a single view to generate multiple output files In order to use a single view to generate multiple output files
Scenario: Checking built folder for content Scenario: Checking built folder for content
Given a successfully built app at "test-app" Given a successfully built app at "dynamic-pages-app"
When I cd to "build" When I cd to "build"
Then the following files should exist: Then the following files should exist:
| fake.html | | fake.html |
@ -32,7 +32,7 @@ Feature: Dynamic Pages
| should_be_ignored8.html | | should_be_ignored8.html |
Scenario: Preview basic proxy Scenario: Preview basic proxy
Given the Server is running at "test-app" Given the Server is running at "dynamic-pages-app"
When I go to "/fake.html" When I go to "/fake.html"
Then I should see "I am real" Then I should see "I am real"
When I go to "/fake2.html" When I go to "/fake2.html"
@ -43,7 +43,7 @@ Feature: Dynamic Pages
Then I should see "I am real" Then I should see "I am real"
Scenario: Preview proxy with variable one Scenario: Preview proxy with variable one
Given the Server is running at "test-app" Given the Server is running at "dynamic-pages-app"
When I go to "/fake/one.html" When I go to "/fake/one.html"
Then I should see "I am real: one" Then I should see "I am real: one"
When I go to "/fake2/one.html" When I go to "/fake2/one.html"
@ -54,7 +54,7 @@ Feature: Dynamic Pages
Then I should see "I am real: one" Then I should see "I am real: one"
Scenario: Preview proxy with variable two Scenario: Preview proxy with variable two
Given the Server is running at "test-app" Given the Server is running at "dynamic-pages-app"
When I go to "/fake/two.html" When I go to "/fake/two.html"
Then I should see "I am real: two" Then I should see "I am real: two"
When I go to "/fake2/two.html" When I go to "/fake2/two.html"
@ -65,7 +65,7 @@ Feature: Dynamic Pages
Then I should see "I am real: two" Then I should see "I am real: two"
Scenario: Target ignore Scenario: Target ignore
Given the Server is running at "test-app" Given the Server is running at "dynamic-pages-app"
When I go to "/target_ignore.html" When I go to "/target_ignore.html"
Then I should see "Ignore me! 3" Then I should see "Ignore me! 3"
When I go to "/target_ignore2.html" When I go to "/target_ignore2.html"
@ -76,7 +76,7 @@ Feature: Dynamic Pages
Then I should see "Ignore me! 8" Then I should see "Ignore me! 8"
Scenario: Preview ignored paths Scenario: Preview ignored paths
Given the Server is running at "test-app" Given the Server is running at "dynamic-pages-app"
When I go to "/should_be_ignored.html" When I go to "/should_be_ignored.html"
Then I should see "File Not Found" Then I should see "File Not Found"
When I go to "/should_be_ignored2.html" When I go to "/should_be_ignored2.html"

View file

@ -2,7 +2,7 @@ Feature: Built-in macro view helpers
In order to simplify generating HTML In order to simplify generating HTML
Scenario: Using the link_to helper Scenario: Using the link_to helper
Given the Server is running at "test-app" Given the Server is running at "padrino-helpers-app"
When I go to "/former_padrino_test.html" When I go to "/former_padrino_test.html"
And I should see 'href="test2.com"' And I should see 'href="test2.com"'
And I should see 'src="/images/test2.png"' And I should see 'src="/images/test2.png"'

View file

@ -2,7 +2,7 @@ Feature: YAML Front Matter
In order to specific options and data inline In order to specific options and data inline
Scenario: Rendering html Scenario: Rendering html
Given the Server is running at "test-app" Given the Server is running at "frontmatter-app"
When I go to "/front-matter.html" When I go to "/front-matter.html"
Then I should see "<h1>This is the title</h1>" Then I should see "<h1>This is the title</h1>"
Then I should not see "---" Then I should not see "---"
@ -12,7 +12,7 @@ Feature: YAML Front Matter
Then I should not see "---" Then I should not see "---"
Scenario: A template changes frontmatter during preview Scenario: A template changes frontmatter during preview
Given the Server is running at "test-app" Given the Server is running at "frontmatter-app"
And the file "source/front-matter-change.html.erb" has the contents And the file "source/front-matter-change.html.erb" has the contents
""" """
--- ---

View file

@ -2,26 +2,26 @@ Feature: Built-in auto_javascript_include_tag view helper
In order to simplify including javascript files In order to simplify including javascript files
Scenario: Viewing the root path Scenario: Viewing the root path
Given the Server is running at "test-app" Given the Server is running at "auto-js-app"
When I go to "/auto-js.html" When I go to "/auto-js.html"
Then I should see "javascripts/auto-js.js" Then I should see "javascripts/auto-js.js"
Scenario: Viewing a tier-1 path Scenario: Viewing a tier-1 path
Given the Server is running at "test-app" Given the Server is running at "auto-js-app"
When I go to "/auto-js/auto-js.html" When I go to "/auto-js/auto-js.html"
Then I should see "javascripts/auto-js/auto-js.js" Then I should see "javascripts/auto-js/auto-js.js"
Scenario: Viewing the index file of a tier-1 path, without filename Scenario: Viewing the index file of a tier-1 path, without filename
Given the Server is running at "test-app" Given the Server is running at "auto-js-app"
When I go to "/auto-js" When I go to "/auto-js"
Then I should see "javascripts/auto-js/index.js" Then I should see "javascripts/auto-js/index.js"
Scenario: Viewing the index file of a tier-1 path, without filename, with a trailing slash Scenario: Viewing the index file of a tier-1 path, without filename, with a trailing slash
Given the Server is running at "test-app" Given the Server is running at "auto-js-app"
When I go to "/auto-js/" When I go to "/auto-js/"
Then I should see "javascripts/auto-js/index.js" Then I should see "javascripts/auto-js/index.js"
Scenario: Viewing a tier-2 path Scenario: Viewing a tier-2 path
Given the Server is running at "test-app" Given the Server is running at "auto-js-app"
When I go to "/auto-js/sub/auto-js.html" When I go to "/auto-js/sub/auto-js.html"
Then I should see "javascripts/auto-js/sub/auto-js.js" Then I should see "javascripts/auto-js/sub/auto-js.js"

View file

@ -2,26 +2,26 @@ Feature: Built-in auto_stylesheet_link_tag view helper
In order to simplify including css files In order to simplify including css files
Scenario: Viewing the root path Scenario: Viewing the root path
Given the Server is running at "test-app" Given the Server is running at "auto-css-app"
When I go to "/auto-css.html" When I go to "/auto-css.html"
Then I should see "stylesheets/auto-css.css" Then I should see "stylesheets/auto-css.css"
Scenario: Viewing a tier-1 path Scenario: Viewing a tier-1 path
Given the Server is running at "test-app" Given the Server is running at "auto-css-app"
When I go to "/auto-css/auto-css.html" When I go to "/auto-css/auto-css.html"
Then I should see "stylesheets/auto-css/auto-css.css" Then I should see "stylesheets/auto-css/auto-css.css"
Scenario: Viewing the index file of a tier-1 path, without filename Scenario: Viewing the index file of a tier-1 path, without filename
Given the Server is running at "test-app" Given the Server is running at "auto-css-app"
When I go to "/auto-css" When I go to "/auto-css"
Then I should see "stylesheets/auto-css/index.css" Then I should see "stylesheets/auto-css/index.css"
Scenario: Viewing the index file of a tier-1 path, without filename, with a trailing slash Scenario: Viewing the index file of a tier-1 path, without filename, with a trailing slash
Given the Server is running at "test-app" Given the Server is running at "auto-css-app"
When I go to "/auto-css/" When I go to "/auto-css/"
Then I should see "stylesheets/auto-css/index.css" Then I should see "stylesheets/auto-css/index.css"
Scenario: Viewing a tier-2 path Scenario: Viewing a tier-2 path
Given the Server is running at "test-app" Given the Server is running at "auto-css-app"
When I go to "/auto-css/sub/auto-css.html" When I go to "/auto-css/sub/auto-css.html"
Then I should see "stylesheets/auto-css/sub/auto-css.css" Then I should see "stylesheets/auto-css/sub/auto-css.css"

View file

@ -1,6 +1,6 @@
Feature: Lorem generating helper Feature: Lorem generating helper
Scenario: Lorem Helper Scenario: Lorem Helper
Given the Server is running at "test-app" Given the Server is running at "lorem-app"
Then going to "/lorem.html" should not raise an exception Then going to "/lorem.html" should not raise an exception
And I should see "http://placekitten.com/100" And I should see "http://placekitten.com/100"

View file

@ -2,16 +2,16 @@ Feature: Built-in page_classes view helper
In order to generate body classes for views In order to generate body classes for views
Scenario: Viewing the root path Scenario: Viewing the root path
Given the Server is running at "test-app" Given the Server is running at "page-classes-app"
When I go to "/page-classes.html" When I go to "/page-classes.html"
Then I should see "page-classes" Then I should see "page-classes"
Scenario: Viewing a tier-1 path Scenario: Viewing a tier-1 path
Given the Server is running at "test-app" Given the Server is running at "page-classes-app"
When I go to "/sub1/page-classes.html" When I go to "/sub1/page-classes.html"
Then I should see "sub1 sub1_page-classes" Then I should see "sub1 sub1_page-classes"
Scenario: Viewing a tier-2 path Scenario: Viewing a tier-2 path
Given the Server is running at "test-app" Given the Server is running at "page-classes-app"
When I go to "/sub1/sub2/page-classes.html" When I go to "/sub1/sub2/page-classes.html"
Then I should see "sub1 sub1_sub2 sub1_sub2_page-classes" Then I should see "sub1 sub1_sub2 sub1_sub2_page-classes"

View file

@ -20,7 +20,7 @@ Feature: Provide Sane Defaults for Partial Behavior
Scenario: Prefers partials of the same engine type Scenario: Prefers partials of the same engine type
Given the Server is running at "partials-app" Given the Server is running at "partials-app"
When I go to "/second.html" When I go to "/second.html"
Then I should see "Haml Main" Then I should see "Str Main"
And I should see "Header" And I should see "Header"
And I should see "Footer" And I should see "Footer"
@ -38,4 +38,4 @@ Feature: Provide Sane Defaults for Partial Behavior
Given the Server is running at "different-engine-partial" Given the Server is running at "different-engine-partial"
When I go to "/index.html" When I go to "/index.html"
Then I should see "ERb Header" Then I should see "ERb Header"
And I should see "Slim Footer" And I should see "Str Footer"

View file

@ -0,0 +1,3 @@
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-core')
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-core', 'step_definitions')

View file

@ -0,0 +1,11 @@
with_layout false do
%w{
/auto-css.html
/auto-css
/auto-css/
/auto-css/auto-css.html
/auto-css/sub/auto-css.html
}.each do |path|
page path
end
end

View file

@ -0,0 +1 @@
<%= auto_stylesheet_link_tag %>

View file

@ -0,0 +1 @@
<%= auto_stylesheet_link_tag %>

View file

@ -0,0 +1 @@
<%= auto_stylesheet_link_tag %>

View file

@ -0,0 +1 @@
<%= auto_stylesheet_link_tag %>

View file

@ -0,0 +1,11 @@
with_layout false do
%w{
/auto-js.html
/auto-js
/auto-js/
/auto-js/auto-js.html
/auto-js/sub/auto-js.html
}.each do |path|
page path
end
end

View file

@ -0,0 +1 @@
<%= auto_javascript_include_tag %>

View file

@ -0,0 +1 @@
<%= auto_javascript_include_tag %>

View file

@ -0,0 +1 @@
<%= auto_javascript_include_tag %>

View file

@ -0,0 +1 @@
<%= auto_javascript_include_tag %>

View file

@ -0,0 +1,4 @@
with_layout false do
page "/data.html"
page "/data3.html"
end

View file

@ -0,0 +1,8 @@
---
layout: false
sup: "Sup"
---
<h1>#{"<%= data.article.title %>"}</h1>
<h2>#{"<%= data.article.subtitle %>"}</h2>
<h3>#{"<%= data.page.sup %>"}</h3>

View file

@ -0,0 +1,8 @@
<html>
<head>
<title>Custom Layout</title>
</head>
<body>
<%= yield %>
</body>
</html>

View file

@ -0,0 +1 @@
activate :directory_indexes

View file

@ -0,0 +1 @@
Fun times

View file

@ -0,0 +1,3 @@
with_layout :content_for do
page "/content_for_erb.html"
end

Some files were not shown because too many files have changed in this diff Show more