Start getting middleman-more tests passing. About 50% done
This commit is contained in:
parent
c8a134a386
commit
73913f0ace
|
@ -3,3 +3,7 @@ rvm:
|
||||||
- 1.9.2
|
- 1.9.2
|
||||||
- 1.9.3
|
- 1.9.3
|
||||||
script: "bundle exec rake test"
|
script: "bundle exec rake test"
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
10
Gemfile
10
Gemfile
|
@ -7,10 +7,18 @@ group :development do
|
||||||
gem "rspec", "~> 2.7"
|
gem "rspec", "~> 2.7"
|
||||||
gem "rdoc", "~> 3.9"
|
gem "rdoc", "~> 3.9"
|
||||||
gem "yard"
|
gem "yard"
|
||||||
|
end
|
||||||
|
|
||||||
|
group :test do
|
||||||
# For actual tests
|
# For actual tests
|
||||||
gem "sinatra"
|
gem "sinatra"
|
||||||
|
gem "slim"
|
||||||
|
gem "coffee-filter", "~> 0.1.1"
|
||||||
|
gem "liquid", "~> 2.2"
|
||||||
|
gem "jquery-rails"
|
||||||
|
gem "bootstrap-rails", "0.0.5"
|
||||||
end
|
end
|
||||||
|
|
||||||
gem "middleman-core", :path => "middleman-core"
|
gem "middleman-core", :path => "middleman-core"
|
||||||
# gem "middleman-more", :path => "middleman-more"
|
gem "middleman-more", :path => "middleman-more"
|
||||||
|
gem "middleman", :path => "middleman"
|
22
Rakefile
22
Rakefile
|
@ -1,7 +1,25 @@
|
||||||
ROOT = File.expand_path(File.dirname(__FILE__))
|
require 'rubygems' unless defined?(Gem)
|
||||||
|
# require 'fileutils' unless defined?(FileUtils)
|
||||||
|
require 'rake'
|
||||||
|
require 'yard'
|
||||||
|
# require File.expand_path("../middleman-core/lib/middleman-core/version.rb", __FILE__)
|
||||||
|
|
||||||
|
ROOT = File.expand_path(File.dirname(__FILE__))
|
||||||
|
GEM_NAME = 'middleman'
|
||||||
|
|
||||||
|
middleman_gems = %w(middleman-core middleman-more)
|
||||||
|
|
||||||
|
desc "Run tests for all middleman gems"
|
||||||
task :test do
|
task :test do
|
||||||
["middleman-core"].each do |g|
|
middleman_gems.each do |g|
|
||||||
sh "cd #{File.join(ROOT, g)} && bundle exec rake test"
|
sh "cd #{File.join(ROOT, g)} && bundle exec rake test"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "Run tests for all middleman gems"
|
||||||
|
task :default => :test
|
||||||
|
|
||||||
|
desc "Generate documentation"
|
||||||
|
task :doc do
|
||||||
|
YARD::CLI::Yardoc.new.run
|
||||||
|
end
|
|
@ -5,19 +5,17 @@ require 'bundler/gem_tasks'
|
||||||
require 'yard'
|
require 'yard'
|
||||||
|
|
||||||
# Skip the releasing tag
|
# Skip the releasing tag
|
||||||
# class Bundler::GemHelper
|
class Bundler::GemHelper
|
||||||
# def release_gem
|
def release_gem
|
||||||
# guard_clean
|
guard_clean
|
||||||
# guard_already_tagged
|
guard_already_tagged
|
||||||
# built_gem_path = build_gem
|
built_gem_path = build_gem
|
||||||
# rubygem_push(built_gem_path)
|
rubygem_push(built_gem_path)
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
|
|
||||||
Cucumber::Rake::Task.new(:test, 'Run features that should pass') do |t|
|
Cucumber::Rake::Task.new(:test, 'Run features that should pass') do |t|
|
||||||
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
||||||
end
|
end
|
||||||
|
|
||||||
YARD::Rake::YardocTask.new
|
|
||||||
|
|
||||||
task :default => :test
|
task :default => :test
|
|
@ -36,6 +36,14 @@ ARGV << "server" if ARGV.length < 1
|
||||||
# Require Middleman
|
# Require Middleman
|
||||||
require 'middleman-core'
|
require 'middleman-core'
|
||||||
|
|
||||||
|
begin
|
||||||
|
# Rubygems
|
||||||
|
require "middleman-more"
|
||||||
|
rescue LoadError
|
||||||
|
# Local
|
||||||
|
require File.expand_path(File.join(File.dirname(File.dirname(libdir)), "middleman-more", "lib", "middleman-more"))
|
||||||
|
end
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
|
|
12
middleman-core/features/asset_host.feature
Normal file
12
middleman-core/features/asset_host.feature
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
Feature: Alternate between multiple asset hosts
|
||||||
|
In order to speed up page loading
|
||||||
|
|
||||||
|
# Scenario: Rendering css with the feature enabled
|
||||||
|
# Given the Server is running at "asset-host-app"
|
||||||
|
# When I go to "/stylesheets/asset_host.css"
|
||||||
|
# Then I should see "http://assets"
|
||||||
|
|
||||||
|
Scenario: Rendering html with the feature enabled
|
||||||
|
Given the Server is running at "asset-host-app"
|
||||||
|
When I go to "/asset_host.html"
|
||||||
|
Then I should see "http://assets"
|
|
@ -3,14 +3,14 @@ Feature: Automatically detect and insert image dimensions into tags
|
||||||
|
|
||||||
Scenario: Rendering an image with the feature disabled
|
Scenario: Rendering an image with the feature disabled
|
||||||
Given "automatic_image_sizes" feature is "disabled"
|
Given "automatic_image_sizes" feature is "disabled"
|
||||||
And the Server is running at "test-app"
|
And the Server is running at "automatic-image-size-app"
|
||||||
When I go to "/auto-image-sizes.html"
|
When I go to "/auto-image-sizes.html"
|
||||||
Then I should not see "width="
|
Then I should not see "width="
|
||||||
And I should not see "height="
|
And I should not see "height="
|
||||||
|
|
||||||
Scenario: Rendering an image with the feature enabled
|
Scenario: Rendering an image with the feature enabled
|
||||||
Given "automatic_image_sizes" feature is "enabled"
|
Given "automatic_image_sizes" feature is "enabled"
|
||||||
And the Server is running at "test-app"
|
And the Server is running at "automatic-image-size-app"
|
||||||
When I go to "/auto-image-sizes.html"
|
When I go to "/auto-image-sizes.html"
|
||||||
Then I should see "width="
|
Then I should see "width="
|
||||||
And I should see "height="
|
And I should see "height="
|
1
middleman-core/fixtures/asset-host-app/source/asset_host.html.erb
Executable file
1
middleman-core/fixtures/asset-host-app/source/asset_host.html.erb
Executable file
|
@ -0,0 +1 @@
|
||||||
|
<%= image_tag "blank.gif" %>
|
Before Width: | Height: | Size: 43 B After Width: | Height: | Size: 43 B |
|
@ -0,0 +1 @@
|
||||||
|
<%= image_tag "blank.gif" %>
|
Before Width: | Height: | Size: 43 B After Width: | Height: | Size: 43 B |
|
@ -20,8 +20,8 @@ require "middleman-core/vendor/hooks-0.2.0/lib/hooks"
|
||||||
|
|
||||||
# Top-level Middleman object
|
# Top-level Middleman object
|
||||||
module Middleman
|
module Middleman
|
||||||
WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i)
|
WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i) unless const_defined?(:WINDOWS)
|
||||||
JRUBY = !!(RbConfig::CONFIG["RUBY_INSTALL_NAME"] =~ /^jruby/i)
|
JRUBY = !!(RbConfig::CONFIG["RUBY_INSTALL_NAME"] =~ /^jruby/i) unless const_defined?(:JRUBY)
|
||||||
|
|
||||||
# Auto-load modules on-demand
|
# Auto-load modules on-demand
|
||||||
autoload :Base, "middleman-core/base"
|
autoload :Base, "middleman-core/base"
|
||||||
|
@ -90,6 +90,16 @@ module Middleman
|
||||||
# Lorem provides a handful of helpful prototyping methods to generate
|
# Lorem provides a handful of helpful prototyping methods to generate
|
||||||
# words, paragraphs, fake images, names and email addresses.
|
# words, paragraphs, fake images, names and email addresses.
|
||||||
autoload :Lorem, "middleman-core/extensions/lorem"
|
autoload :Lorem, "middleman-core/extensions/lorem"
|
||||||
|
|
||||||
|
# AutomaticImageSizes inspects the images used in your dynamic templates
|
||||||
|
# and automatically adds width and height attributes to their HTML
|
||||||
|
# elements.
|
||||||
|
autoload :AutomaticImageSizes, "middleman-core/extensions/automatic_image_sizes"
|
||||||
|
|
||||||
|
# AssetHost allows you to setup multiple domains to host your static
|
||||||
|
# assets. Calls to asset paths in dynamic templates will then rotate
|
||||||
|
# through each of the asset servers to better spread the load.
|
||||||
|
autoload :AssetHost, "middleman-core/extensions/asset_host"
|
||||||
end
|
end
|
||||||
|
|
||||||
module Extensions
|
module Extensions
|
||||||
|
@ -117,7 +127,7 @@ module Middleman
|
||||||
end
|
end
|
||||||
|
|
||||||
registered[name.to_sym] = if !passed_version_check
|
registered[name.to_sym] = if !passed_version_check
|
||||||
"== #{name} failed version check. Requested #{version}, got #{Middleman::Core::VERSION}"
|
"== #{name} failed version check. Requested #{version}, got #{Middleman::VERSION}"
|
||||||
elsif block_given?
|
elsif block_given?
|
||||||
block
|
block
|
||||||
elsif namespace
|
elsif namespace
|
||||||
|
@ -141,7 +151,7 @@ module Middleman
|
||||||
end
|
end
|
||||||
|
|
||||||
# Where to look in gems for extensions to auto-register
|
# Where to look in gems for extensions to auto-register
|
||||||
EXTENSION_FILE = File.join("lib", "middleman_extension.rb")
|
EXTENSION_FILE = File.join("lib", "middleman_extension.rb") unless const_defined?(:EXTENSION_FILE)
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
||||||
|
@ -222,12 +232,16 @@ module Middleman
|
||||||
# @param [Hash] options to pass to Rack::Server.new
|
# @param [Hash] options to pass to Rack::Server.new
|
||||||
# @return [Rack::Server]
|
# @return [Rack::Server]
|
||||||
def start_server(options={})
|
def start_server(options={})
|
||||||
|
require "webrick"
|
||||||
|
|
||||||
opts = {
|
opts = {
|
||||||
:Port => options[:port] || 4567,
|
:Port => options[:port] || 4567,
|
||||||
:Host => options[:host] || "0.0.0.0",
|
:Host => options[:host] || "0.0.0.0",
|
||||||
:AccessLog => []
|
:AccessLog => []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts[:Logger] = WEBrick::Log::new("/dev/null", 7) if !options[:logging]
|
||||||
|
|
||||||
app_class = options[:app] ||= ::Middleman.server.inst
|
app_class = options[:app] ||= ::Middleman.server.inst
|
||||||
opts[:app] = app_class
|
opts[:app] = app_class
|
||||||
|
|
||||||
|
@ -235,6 +249,7 @@ module Middleman
|
||||||
# require "thin"
|
# require "thin"
|
||||||
# ::Thin::Logging.silent = !options[:logging]
|
# ::Thin::Logging.silent = !options[:logging]
|
||||||
# opts[:server] = 'thin'
|
# opts[:server] = 'thin'
|
||||||
|
opts[:server] = 'webrick'
|
||||||
|
|
||||||
server = ::Rack::Server.new(opts)
|
server = ::Rack::Server.new(opts)
|
||||||
server.start
|
server.start
|
||||||
|
|
|
@ -198,7 +198,7 @@ class Middleman::Base
|
||||||
|
|
||||||
# Automatically loaded extensions
|
# Automatically loaded extensions
|
||||||
# @return [Array<Symbol>]
|
# @return [Array<Symbol>]
|
||||||
set :default_extensions, [:lorem]
|
set :default_extensions, [ :lorem ]
|
||||||
|
|
||||||
# Default layout name
|
# Default layout name
|
||||||
# @return [String, Symbold]
|
# @return [String, Symbold]
|
||||||
|
@ -242,6 +242,10 @@ class Middleman::Base
|
||||||
Middleman::Extensions::DirectoryIndexes }
|
Middleman::Extensions::DirectoryIndexes }
|
||||||
Middleman::Extensions.register(:lorem) {
|
Middleman::Extensions.register(:lorem) {
|
||||||
Middleman::Extensions::Lorem }
|
Middleman::Extensions::Lorem }
|
||||||
|
Middleman::Extensions.register(:automatic_image_sizes) {
|
||||||
|
Middleman::Extensions::AutomaticImageSizes }
|
||||||
|
Middleman::Extensions.register(:asset_host) {
|
||||||
|
Middleman::Extensions::AssetHost }
|
||||||
|
|
||||||
# Backwards-compatibility with old request.path signature
|
# Backwards-compatibility with old request.path signature
|
||||||
attr :request
|
attr :request
|
||||||
|
@ -258,7 +262,7 @@ class Middleman::Base
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def current_path=(path)
|
def current_path=(path)
|
||||||
@_current_path = path
|
@_current_path = path
|
||||||
@request = Thor::CoreExt::HashWithIndifferentAccess.new({ :path => path })
|
@request = ::Thor::CoreExt::HashWithIndifferentAccess.new({ :path => path })
|
||||||
end
|
end
|
||||||
|
|
||||||
# Initialize the Middleman project
|
# Initialize the Middleman project
|
||||||
|
|
|
@ -11,7 +11,7 @@ module Middleman::Cli
|
||||||
desc "version", "Show version"
|
desc "version", "Show version"
|
||||||
def version
|
def version
|
||||||
require 'middleman-core/version'
|
require 'middleman-core/version'
|
||||||
say "Middleman #{Middleman::Core::VERSION}"
|
say "Middleman #{Middleman::VERSION}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Override the Thor help method to find help for subtasks
|
# Override the Thor help method to find help for subtasks
|
||||||
|
|
|
@ -4,11 +4,11 @@ module Middleman::Extensions
|
||||||
def registered(app)
|
def registered(app)
|
||||||
app.set :asset_host, false
|
app.set :asset_host, false
|
||||||
|
|
||||||
app.compass_config do |config|
|
# app.compass_config do |config|
|
||||||
if asset_host.is_a?(Proc)
|
# if asset_host.is_a?(Proc)
|
||||||
config.asset_host(&asset_host)
|
# config.asset_host(&asset_host)
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
app.send :include, InstanceMethods
|
app.send :include, InstanceMethods
|
||||||
end
|
end
|
|
@ -1,3 +1,3 @@
|
||||||
source :rubygems
|
source :rubygems
|
||||||
|
|
||||||
gem "middleman", "~><%= Middleman::Core::VERSION %>"
|
gem "middleman", "~><%= Middleman::VERSION %>"
|
|
@ -1,7 +1,13 @@
|
||||||
|
# Using for version parsing
|
||||||
|
require "rubygems"
|
||||||
|
|
||||||
module Middleman
|
module Middleman
|
||||||
module Core
|
|
||||||
# Current Version
|
# Current Version
|
||||||
# @return [String]
|
# @return [String]
|
||||||
VERSION = "3.0.0.alpha.6"
|
VERSION = "3.0.0.alpha.7" unless const_defined?(:VERSION)
|
||||||
end
|
|
||||||
|
# Parsed version for RubyGems
|
||||||
|
# @private
|
||||||
|
# @return [String]
|
||||||
|
GEM_VERSION = ::Gem::Version.create(VERSION) unless const_defined?(:GEM_VERSION)
|
||||||
end
|
end
|
|
@ -4,7 +4,7 @@ require "middleman-core/version"
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "middleman-core"
|
s.name = "middleman-core"
|
||||||
s.version = Middleman::Core::VERSION
|
s.version = Middleman::VERSION
|
||||||
s.platform = Gem::Platform::RUBY
|
s.platform = Gem::Platform::RUBY
|
||||||
s.license = "MIT"
|
s.license = "MIT"
|
||||||
s.authors = ["Thomas Reynolds"]
|
s.authors = ["Thomas Reynolds"]
|
||||||
|
@ -18,11 +18,16 @@ Gem::Specification.new do |s|
|
||||||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
|
|
||||||
|
# Thin
|
||||||
|
# s.add_dependency("thin", ["~> 1.3.1"])
|
||||||
|
|
||||||
# Core
|
# Core
|
||||||
s.add_dependency("rack", ["~> 1.3.5"])
|
s.add_dependency("rack", ["~> 1.3.5"])
|
||||||
s.add_dependency("rack-test", ["~> 0.6.1"])
|
|
||||||
s.add_dependency("tilt", ["~> 1.3.1"])
|
s.add_dependency("tilt", ["~> 1.3.1"])
|
||||||
|
|
||||||
|
# Builder
|
||||||
|
s.add_dependency("rack-test", ["~> 0.6.1"])
|
||||||
|
|
||||||
# CLI
|
# CLI
|
||||||
s.add_dependency("thor", ["~> 0.14.0"])
|
s.add_dependency("thor", ["~> 0.14.0"])
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
source :rubygems
|
|
||||||
|
|
||||||
gemspec :name => "middleman-more"
|
|
|
@ -1,17 +1,5 @@
|
||||||
require 'bundler'
|
# coding:utf-8
|
||||||
Bundler::GemHelper.install_tasks :name => ENV["NAME"] || "middleman"
|
RAKE_ROOT = __FILE__
|
||||||
|
|
||||||
require 'cucumber/rake/task'
|
require 'rubygems'
|
||||||
|
require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper')
|
||||||
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
|
||||||
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
|
||||||
end
|
|
||||||
|
|
||||||
require 'rake/clean'
|
|
||||||
|
|
||||||
task :test => ["cucumber"]
|
|
||||||
|
|
||||||
desc "Build HTML documentation"
|
|
||||||
task :doc do
|
|
||||||
sh 'bundle exec yard'
|
|
||||||
end
|
|
|
@ -5,8 +5,3 @@ Feature: Alternate between multiple asset hosts
|
||||||
Given the Server is running at "asset-host-app"
|
Given the Server is running at "asset-host-app"
|
||||||
When I go to "/stylesheets/asset_host.css"
|
When I go to "/stylesheets/asset_host.css"
|
||||||
Then I should see "http://assets"
|
Then I should see "http://assets"
|
||||||
|
|
||||||
Scenario: Rendering html with the feature enabled
|
|
||||||
Given the Server is running at "asset-host-app"
|
|
||||||
When I go to "/asset_host.html"
|
|
||||||
Then I should see "http://assets"
|
|
|
@ -3,24 +3,24 @@ Feature: Generate mtime-based query string for busting browser caches
|
||||||
|
|
||||||
Scenario: Rendering css with the feature disabled
|
Scenario: Rendering css with the feature disabled
|
||||||
Given "cache_buster" feature is "disabled"
|
Given "cache_buster" feature is "disabled"
|
||||||
And the Server is running at "test-app"
|
And the Server is running at "cache-buster-app"
|
||||||
When I go to "/stylesheets/relative_assets.css"
|
When I go to "/stylesheets/relative_assets.css"
|
||||||
Then I should not see "?"
|
Then I should not see "?"
|
||||||
|
|
||||||
Scenario: Rendering html with the feature disabled
|
Scenario: Rendering html with the feature disabled
|
||||||
Given "cache_buster" feature is "disabled"
|
Given "cache_buster" feature is "disabled"
|
||||||
And the Server is running at "test-app"
|
And the Server is running at "cache-buster-app"
|
||||||
When I go to "/cache-buster.html"
|
When I go to "/cache-buster.html"
|
||||||
Then I should not see "?"
|
Then I should not see "?"
|
||||||
|
|
||||||
Scenario: Rendering css with the feature enabled
|
Scenario: Rendering css with the feature enabled
|
||||||
Given "cache_buster" feature is "enabled"
|
Given "cache_buster" feature is "enabled"
|
||||||
And the Server is running at "test-app"
|
And the Server is running at "cache-buster-app"
|
||||||
When I go to "/stylesheets/relative_assets.css"
|
When I go to "/stylesheets/relative_assets.css"
|
||||||
Then I should see "?"
|
Then I should see "?"
|
||||||
|
|
||||||
Scenario: Rendering html with the feature enabled
|
Scenario: Rendering html with the feature enabled
|
||||||
Given "cache_buster" feature is "enabled"
|
Given "cache_buster" feature is "enabled"
|
||||||
And the Server is running at "test-app"
|
And the Server is running at "cache-buster-app"
|
||||||
When I go to "/cache-buster.html"
|
When I go to "/cache-buster.html"
|
||||||
Then I should see "?"
|
Then I should see "?"
|
|
@ -2,16 +2,16 @@ Feature: Support coffee-script
|
||||||
In order to offer an alternative when writing Javascript
|
In order to offer an alternative when writing Javascript
|
||||||
|
|
||||||
Scenario: Rendering coffee script
|
Scenario: Rendering coffee script
|
||||||
Given the Server is running at "test-app"
|
Given the Server is running at "coffeescript-app"
|
||||||
When I go to "/javascripts/coffee_test.js"
|
When I go to "/javascripts/coffee_test.js"
|
||||||
Then I should see "Array.prototype.slice"
|
Then I should see "Array.prototype.slice"
|
||||||
|
|
||||||
Scenario: Rendering coffee-script with :coffeescript haml-filter
|
Scenario: Rendering coffee-script with :coffeescript haml-filter
|
||||||
Given the Server is running at "test-app"
|
Given the Server is running at "coffeescript-app"
|
||||||
When I go to "/inline-coffeescript.html"
|
When I go to "/inline-coffeescript.html"
|
||||||
Then I should see "Array.prototype.slice"
|
Then I should see "Array.prototype.slice"
|
||||||
|
|
||||||
Scenario: Rendering broken coffee
|
Scenario: Rendering broken coffee
|
||||||
Given the Server is running at "test-app"
|
Given the Server is running at "coffeescript-app"
|
||||||
When I go to "/javascripts/broken-coffee.js"
|
When I go to "/javascripts/broken-coffee.js"
|
||||||
Then I should see "Error"
|
Then I should see "Error"
|
|
@ -1,10 +1,5 @@
|
||||||
Feature: Support content_for and yield_content helpers
|
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"
|
|
||||||
|
|
||||||
Scenario: content_for works as expected in haml
|
Scenario: content_for works as expected in haml
|
||||||
Given the Server is running at "content-for-app"
|
Given the Server is running at "content-for-app"
|
||||||
When I go to "/content_for_haml.html"
|
When I go to "/content_for_haml.html"
|
||||||
|
|
|
@ -2,11 +2,11 @@ Feature: Support SCSS Syntax
|
||||||
In order to offer an alternative when writing Sass
|
In order to offer an alternative when writing Sass
|
||||||
|
|
||||||
Scenario: Rendering scss
|
Scenario: Rendering scss
|
||||||
Given the Server is running at "test-app"
|
Given the Server is running at "scss-app"
|
||||||
When I go to "/stylesheets/site_scss.css"
|
When I go to "/stylesheets/site_scss.css"
|
||||||
Then I should see "html"
|
Then I should see "html"
|
||||||
|
|
||||||
Scenario: Rendering scss
|
Scenario: Rendering scss
|
||||||
Given the Server is running at "test-app"
|
Given the Server is running at "scss-app"
|
||||||
When I go to "/stylesheets/layout.css"
|
When I go to "/stylesheets/layout.css"
|
||||||
Then I should see "html"
|
Then I should see "html"
|
|
@ -2,6 +2,6 @@ Feature: Support slim templating language
|
||||||
In order to offer an alternative to Haml
|
In order to offer an alternative to Haml
|
||||||
|
|
||||||
Scenario: Rendering Slim
|
Scenario: Rendering Slim
|
||||||
Given the Server is running at "test-app"
|
Given the Server is running at "slim-app"
|
||||||
When I go to "/slim.html"
|
When I go to "/slim.html"
|
||||||
Then I should see "<h1>Welcome to Slim</h1>"
|
Then I should see "<h1>Welcome to Slim</h1>"
|
|
@ -1,7 +1,7 @@
|
||||||
Feature: Sprockets
|
Feature: Sprockets
|
||||||
|
|
||||||
Scenario: Sprockets JS require
|
Scenario: Sprockets JS require
|
||||||
Given the Server is running at "test-app"
|
Given the Server is running at "sprockets-app2"
|
||||||
When I go to "/javascripts/sprockets_base.js"
|
When I go to "/javascripts/sprockets_base.js"
|
||||||
Then I should see "sprockets_sub_function"
|
Then I should see "sprockets_sub_function"
|
||||||
|
|
||||||
|
@ -16,23 +16,23 @@ Feature: Sprockets
|
||||||
Then I should see "helloWorld"
|
Then I should see "helloWorld"
|
||||||
|
|
||||||
Scenario: Sprockets JS should have access to yaml data
|
Scenario: Sprockets JS should have access to yaml data
|
||||||
Given the Server is running at "test-app"
|
Given the Server is running at "sprockets-app2"
|
||||||
When I go to "/javascripts/multiple_engines.js"
|
When I go to "/javascripts/multiple_engines.js"
|
||||||
Then I should see "Hello One"
|
Then I should see "Hello One"
|
||||||
|
|
||||||
Scenario: Multiple engine files should build correctly
|
Scenario: Multiple engine files should build correctly
|
||||||
Given a successfully built app at "test-app"
|
Given a successfully built app at "sprockets-app2"
|
||||||
When I cd to "build"
|
When I cd to "build"
|
||||||
Then a file named "javascripts/multiple_engines.js" should exist
|
Then a file named "javascripts/multiple_engines.js" should exist
|
||||||
And the file "javascripts/multiple_engines.js" should contain "Hello One"
|
And the file "javascripts/multiple_engines.js" should contain "Hello One"
|
||||||
|
|
||||||
Scenario: Sprockets CSS require //require
|
Scenario: Sprockets CSS require //require
|
||||||
Given the Server is running at "test-app"
|
Given the Server is running at "sprockets-app2"
|
||||||
When I go to "/stylesheets/sprockets_base1.css"
|
When I go to "/stylesheets/sprockets_base1.css"
|
||||||
Then I should see "hello"
|
Then I should see "hello"
|
||||||
|
|
||||||
Scenario: Sprockets CSS require @import
|
Scenario: Sprockets CSS require @import
|
||||||
Given the Server is running at "test-app"
|
Given the Server is running at "sprockets-app2"
|
||||||
When I go to "/stylesheets/sprockets_base2.css"
|
When I go to "/stylesheets/sprockets_base2.css"
|
||||||
Then I should see "hello"
|
Then I should see "hello"
|
||||||
|
|
||||||
|
|
7
middleman-more/features/support/env.rb
Normal file
7
middleman-more/features/support/env.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
|
||||||
|
|
||||||
|
core_root = File.expand_path("../../../../middleman-core/lib/middleman-core", __FILE__)
|
||||||
|
|
||||||
|
require core_root
|
||||||
|
require File.join(core_root, "step_definitions")
|
||||||
|
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-more')
|
|
@ -1 +0,0 @@
|
||||||
= image_tag "blank.gif"
|
|
2
middleman-more/fixtures/cache-buster-app/source/cache-buster.html.erb
Executable file
2
middleman-more/fixtures/cache-buster-app/source/cache-buster.html.erb
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
<%= stylesheet_link_tag "site.css" %>
|
||||||
|
<%= javascript_include_tag "empty-with-include.js" %>
|
BIN
middleman-more/fixtures/cache-buster-app/source/images/blank.gif
Executable file
BIN
middleman-more/fixtures/cache-buster-app/source/images/blank.gif
Executable file
Binary file not shown.
After Width: | Height: | Size: 43 B |
|
@ -0,0 +1 @@
|
||||||
|
@import "compass/reset"
|
1
middleman-more/fixtures/coffeescript-app/config.rb
Normal file
1
middleman-more/fixtures/coffeescript-app/config.rb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
require "coffee-filter"
|
|
@ -0,0 +1,3 @@
|
||||||
|
:coffeescript
|
||||||
|
race = (winner, runners...) ->
|
||||||
|
print winner, runners
|
|
@ -0,0 +1,3 @@
|
||||||
|
function test() {
|
||||||
|
hello
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Splats:
|
||||||
|
race = (winner, runners...) ->
|
||||||
|
print winner, runners
|
|
@ -1,5 +1,6 @@
|
||||||
|
require "slim"
|
||||||
|
|
||||||
with_layout :content_for do
|
with_layout :content_for do
|
||||||
page "/content_for_erb.html"
|
page "/content_for_haml.html"
|
||||||
# page "/content_for_haml.html"
|
page "/content_for_slim.html"
|
||||||
# page "/content_for_slim.html"
|
|
||||||
end
|
end
|
|
@ -1,5 +0,0 @@
|
||||||
<% content_for :from_template do %>
|
|
||||||
I am the yielded content erb
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
I am in the template
|
|
0
middleman-more/fixtures/fonts-app/config.rb
Normal file
0
middleman-more/fixtures/fonts-app/config.rb
Normal file
0
middleman-more/fixtures/relative-app/config.rb
Normal file
0
middleman-more/fixtures/relative-app/config.rb
Normal file
BIN
middleman-more/fixtures/relative-app/source/images/blank.gif
Executable file
BIN
middleman-more/fixtures/relative-app/source/images/blank.gif
Executable file
Binary file not shown.
After Width: | Height: | Size: 43 B |
0
middleman-more/fixtures/scss-app/config.rb
Normal file
0
middleman-more/fixtures/scss-app/config.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
html
|
||||||
|
test: value
|
1
middleman-more/fixtures/scss-app/source/stylesheets/site_scss.css.scss
Executable file
1
middleman-more/fixtures/scss-app/source/stylesheets/site_scss.css.scss
Executable file
|
@ -0,0 +1 @@
|
||||||
|
@import "compass/reset";
|
1
middleman-more/fixtures/slim-app/config.rb
Normal file
1
middleman-more/fixtures/slim-app/config.rb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
require "slim"
|
7
middleman-more/fixtures/slim-app/source/slim.html.slim
Normal file
7
middleman-more/fixtures/slim-app/source/slim.html.slim
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
doctype 5
|
||||||
|
html lang='en'
|
||||||
|
head
|
||||||
|
meta charset="utf-8"
|
||||||
|
|
||||||
|
body
|
||||||
|
h1 Welcome to Slim
|
0
middleman-more/fixtures/sprockets-app2/config.rb
Normal file
0
middleman-more/fixtures/sprockets-app2/config.rb
Normal file
4
middleman-more/fixtures/sprockets-app2/data/test.yml
Normal file
4
middleman-more/fixtures/sprockets-app2/data/test.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
-
|
||||||
|
title: "One"
|
||||||
|
-
|
||||||
|
title: "Two"
|
4
middleman-more/fixtures/sprockets-app2/data/test2.json
Normal file
4
middleman-more/fixtures/sprockets-app2/data/test2.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[
|
||||||
|
{ "title": "One" },
|
||||||
|
{ "title": "Two" }
|
||||||
|
]
|
|
@ -0,0 +1 @@
|
||||||
|
alert "Hello <%= data.test[0].title %>"
|
|
@ -0,0 +1,5 @@
|
||||||
|
//= require "sprockets_sub"
|
||||||
|
|
||||||
|
function base() {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
function sprockets_sub_function() {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
//= require "sprockets_sub"
|
|
@ -0,0 +1 @@
|
||||||
|
@import "sprockets_sub";
|
|
@ -0,0 +1 @@
|
||||||
|
hello { world: "hi"; }
|
|
@ -2,6 +2,8 @@
|
||||||
libdir = File.expand_path(File.dirname(__FILE__))
|
libdir = File.expand_path(File.dirname(__FILE__))
|
||||||
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
||||||
|
|
||||||
|
require "middleman-core"
|
||||||
|
|
||||||
# Top-level Middleman object
|
# Top-level Middleman object
|
||||||
module Middleman
|
module Middleman
|
||||||
|
|
||||||
|
@ -11,15 +13,18 @@ module Middleman
|
||||||
autoload :Sass, "middleman-more/renderers/sass"
|
autoload :Sass, "middleman-more/renderers/sass"
|
||||||
autoload :Markdown, "middleman-more/renderers/markdown"
|
autoload :Markdown, "middleman-more/renderers/markdown"
|
||||||
autoload :Liquid, "middleman-more/renderers/liquid"
|
autoload :Liquid, "middleman-more/renderers/liquid"
|
||||||
|
autoload :Slim, "middleman-more/renderers/slim"
|
||||||
end
|
end
|
||||||
|
|
||||||
module Extensions
|
module CoreExtensions
|
||||||
# Compass framework for Sass
|
# Compass framework for Sass
|
||||||
autoload :Compass, "middleman-more/core_extensions/compass"
|
autoload :Compass, "middleman-more/core_extensions/compass"
|
||||||
|
|
||||||
# Sprockets 2
|
# Sprockets 2
|
||||||
autoload :Sprockets, "middleman-more/core_extensions/sprockets"
|
autoload :Sprockets, "middleman-more/core_extensions/sprockets"
|
||||||
|
end
|
||||||
|
|
||||||
|
module Extensions
|
||||||
# RelativeAssets allow any asset path in dynamic templates to be either
|
# RelativeAssets allow any asset path in dynamic templates to be either
|
||||||
# relative to the root of the project or use an absolute URL.
|
# relative to the root of the project or use an absolute URL.
|
||||||
autoload :RelativeAssets, "middleman-more/extensions/relative_assets"
|
autoload :RelativeAssets, "middleman-more/extensions/relative_assets"
|
||||||
|
@ -44,4 +49,26 @@ module Middleman
|
||||||
# MinifyJavascript uses the YUI compressor to shrink JS files
|
# MinifyJavascript uses the YUI compressor to shrink JS files
|
||||||
autoload :MinifyJavascript, "middleman-more/extensions/minify_javascript"
|
autoload :MinifyJavascript, "middleman-more/extensions/minify_javascript"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require "coffee_script"
|
||||||
|
Base.register Middleman::Renderers::Haml
|
||||||
|
Base.register Middleman::Renderers::Sass
|
||||||
|
Base.register Middleman::Renderers::Markdown
|
||||||
|
Base.register Middleman::Renderers::Liquid
|
||||||
|
Base.register Middleman::Renderers::Slim
|
||||||
|
|
||||||
|
# Compass framework
|
||||||
|
Base.register Middleman::CoreExtensions::Compass
|
||||||
|
|
||||||
|
# Sprockets asset handling
|
||||||
|
Base.register Middleman::CoreExtensions::Sprockets
|
||||||
|
|
||||||
|
Extensions.register(:cache_buster) {
|
||||||
|
::Middleman::Extensions::CacheBuster }
|
||||||
|
Extensions.register(:minify_css) {
|
||||||
|
::Middleman::Extensions::MinifyCss }
|
||||||
|
Extensions.register(:minify_javascript) {
|
||||||
|
::Middleman::Extensions::MinifyJavascript }
|
||||||
|
Extensions.register(:relative_assets) {
|
||||||
|
::Middleman::Extensions::RelativeAssets }
|
||||||
end
|
end
|
15
middleman-more/lib/middleman-more/renderers/slim.rb
Normal file
15
middleman-more/lib/middleman-more/renderers/slim.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
module Middleman::Renderers::Slim
|
||||||
|
class << self
|
||||||
|
def registered(app)
|
||||||
|
# Slim is not included in the default gems,
|
||||||
|
# but we'll support it if available.
|
||||||
|
begin
|
||||||
|
require "slim"
|
||||||
|
|
||||||
|
Slim::Engine.set_default_options(:buffer => '@_out_buf', :generator => Temple::Generators::StringBuffer) if defined?(Slim)
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
|
end
|
||||||
|
alias :included :registered
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,39 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
require "coffee_script"
|
|
||||||
app.register Middleman::Renderers::Haml
|
|
||||||
app.register Middleman::Renderers::Sass
|
|
||||||
app.register Middleman::Renderers::Markdown
|
|
||||||
app.register Middleman::Renderers::Liquid
|
|
||||||
|
|
||||||
|
|
||||||
set :default_extensions, [
|
|
||||||
:lorem
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Compass framework
|
|
||||||
register Middleman::CoreExtensions::Compass
|
|
||||||
|
|
||||||
# Sprockets asset handling
|
|
||||||
register Middleman::CoreExtensions::Sprockets
|
|
||||||
|
|
||||||
# Activate built-in helpers
|
|
||||||
register Middleman::CoreExtensions::DefaultHelpers
|
|
||||||
|
|
||||||
|
|
||||||
Middleman::Extensions.register(:asset_host) {
|
|
||||||
Middleman::Extensions::AssetHost }
|
|
||||||
Middleman::Extensions.register(:automatic_image_sizes) {
|
|
||||||
Middleman::Extensions::AutomaticImageSizes }
|
|
||||||
Middleman::Extensions.register(:cache_buster) {
|
|
||||||
Middleman::Extensions::CacheBuster }
|
|
||||||
Middleman::Extensions.register(:lorem) {
|
|
||||||
Middleman::Extensions::Lorem }
|
|
||||||
Middleman::Extensions.register(:minify_css) {
|
|
||||||
Middleman::Extensions::MinifyCss }
|
|
||||||
Middleman::Extensions.register(:minify_javascript) {
|
|
||||||
Middleman::Extensions::MinifyJavascript }
|
|
||||||
Middleman::Extensions.register(:relative_assets) {
|
|
||||||
Middleman::Extensions::RelativeAssets }
|
|
|
@ -1,7 +0,0 @@
|
||||||
module Middleman
|
|
||||||
module More
|
|
||||||
# Current Version
|
|
||||||
# @return [String]
|
|
||||||
VERSION = "3.0.0.alpha.6"
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,10 +1,10 @@
|
||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
$:.push File.expand_path("../lib", __FILE__)
|
$:.push File.expand_path("../lib", __FILE__)
|
||||||
require "middleman-more/version"
|
require File.expand_path("../../middleman-core/lib/middleman-core/version.rb", __FILE__)
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "middleman-more"
|
s.name = "middleman-more"
|
||||||
s.version = Middleman::More::VERSION
|
s.version = Middleman::VERSION
|
||||||
s.platform = Gem::Platform::RUBY
|
s.platform = Gem::Platform::RUBY
|
||||||
s.license = "MIT"
|
s.license = "MIT"
|
||||||
s.authors = ["Thomas Reynolds"]
|
s.authors = ["Thomas Reynolds"]
|
||||||
|
@ -18,30 +18,15 @@ Gem::Specification.new do |s|
|
||||||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
|
|
||||||
s.add_dependency("middleman-core")
|
s.add_dependency("middleman-core", Middleman::VERSION)
|
||||||
s.add_dependency("thin", ["~> 1.3.1"])
|
|
||||||
s.add_dependency("i18n", ["~> 0.6.0"])
|
|
||||||
s.add_dependency("uglifier", ["~> 1.2.0"])
|
s.add_dependency("uglifier", ["~> 1.2.0"])
|
||||||
s.add_dependency("haml", ["~> 3.1.0"])
|
s.add_dependency("haml", ["~> 3.1.0"])
|
||||||
s.add_dependency("sass", ["~> 3.1.7"])
|
s.add_dependency("sass", ["~> 3.1.7"])
|
||||||
s.add_dependency("compass", ["~> 0.11.3"])
|
s.add_dependency("compass", ["~> 0.11.3"])
|
||||||
s.add_dependency("coffee-script", ["~> 2.2.0"])
|
s.add_dependency("coffee-script", ["~> 2.2.0"])
|
||||||
s.add_dependency("execjs", ["~> 1.2.7"])
|
s.add_dependency("execjs", ["~> 1.2.7"])
|
||||||
|
s.add_dependency("sprockets", ["~> 2.1.0"])
|
||||||
s.add_dependency("sprockets-sass", ["~> 0.6.0"])
|
s.add_dependency("sprockets-sass", ["~> 0.6.0"])
|
||||||
s.add_dependency("redcarpet", ["~> 2.0.0"])
|
s.add_dependency("redcarpet", ["~> 2.0.0"])
|
||||||
|
|
||||||
# Development and test
|
|
||||||
s.add_development_dependency("slim")
|
|
||||||
s.add_development_dependency("sinatra")
|
|
||||||
s.add_development_dependency("coffee-filter", ["~> 0.1.1"])
|
|
||||||
s.add_development_dependency("liquid", ["~> 2.2"])
|
|
||||||
s.add_development_dependency("cucumber", ["~> 1.1.0"])
|
|
||||||
s.add_development_dependency("aruba", ["~> 0.4.11"])
|
|
||||||
s.add_development_dependency("rake", ["~> 0.9.2"])
|
|
||||||
s.add_development_dependency("rspec", ["~> 2.7"])
|
|
||||||
s.add_development_dependency("rdoc", ["~> 3.9"])
|
|
||||||
s.add_development_dependency("yard")
|
|
||||||
s.add_development_dependency("jquery-rails")
|
|
||||||
s.add_development_dependency("bootstrap-rails", ["0.0.5"])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require "middleman-core/version"
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "middleman"
|
s.name = "middleman"
|
||||||
s.version = Middleman::Core::VERSION
|
s.version = Middleman::VERSION
|
||||||
s.platform = "x86-mingw32"
|
s.platform = "x86-mingw32"
|
||||||
s.license = "MIT"
|
s.license = "MIT"
|
||||||
s.authors = ["Thomas Reynolds"]
|
s.authors = ["Thomas Reynolds"]
|
||||||
|
|
24
middleman/middleman.gemspec
Normal file
24
middleman/middleman.gemspec
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
$:.push File.expand_path("../lib", __FILE__)
|
||||||
|
require File.expand_path("../../middleman-core/lib/middleman-core/version.rb", __FILE__)
|
||||||
|
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = "middleman"
|
||||||
|
s.version = Middleman::VERSION
|
||||||
|
s.platform = Gem::Platform::RUBY
|
||||||
|
s.license = "MIT"
|
||||||
|
s.authors = ["Thomas Reynolds"]
|
||||||
|
s.email = ["me@tdreyno.com"]
|
||||||
|
s.homepage = "http://middlemanapp.com"
|
||||||
|
s.summary = "Hand-crafted frontend development"
|
||||||
|
s.description = "A static site generator based on Sinatra. Providing dozens of templating languages (Haml, Sass, Compass, Slim, CoffeeScript, and more). Makes minification, compression, cache busting, Yaml data (and more) an easy part of your development cycle."
|
||||||
|
|
||||||
|
s.files = `git ls-files`.split("\n")
|
||||||
|
s.test_files = `git ls-files -- {fixtures,features}/*`.split("\n")
|
||||||
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
||||||
|
s.require_paths = ["lib"]
|
||||||
|
|
||||||
|
s.add_dependency("middleman-core", Middleman::VERSION)
|
||||||
|
s.add_dependency("middleman-more", Middleman::VERSION)
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue