a fully-bundled middleman

This commit is contained in:
tdreyno 2009-11-17 15:26:23 -08:00
parent adf9cde5b3
commit 4692ceff07
33 changed files with 133 additions and 96 deletions

View file

@ -1,6 +1,7 @@
source "http://gemcutter.org"
bin_path "vendor/bin"
disable_rubygems
disable_system_gems
gem "thin"
gem "shotgun"
@ -8,12 +9,13 @@ gem "templater"
gem "sprockets"
gem "sinatra"
gem "sinatra-content-for"
gem "rack-test", "0.5.1"
gem "rack-test"
gem "yui-compressor"
gem "haml"
gem "compass"
gem "smusher"
gem "rspec"
gem "rdoc"
gem "sdoc"
gem "cucumber"

View file

@ -1,4 +1,3 @@
require 'rubygems'
require 'lib/middleman'
require 'rake'
require 'cucumber/rake/task'
@ -24,6 +23,7 @@ begin
gem.add_dependency("smusher")
gem.add_dependency("haml", ">=2.1.0")
gem.add_dependency("compass")
gem.add_development_dependency("rdoc")
gem.add_development_dependency("rspec")
gem.add_development_dependency("sdoc")
gem.add_development_dependency("cucumber")
@ -53,37 +53,35 @@ task :spec => :check_dependencies
task :default => :spec
unless ENV["RUN_CODE_RUN"]
require 'rake/rdoctask'
require 'sdoc'
require 'rake/rdoctask'
require 'sdoc'
Rake::RDocTask.new do |rdoc|
if File.exist?('VERSION')
version = File.read('VERSION')
else
version = ""
end
# rdoc.template = 'direct'
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "middleman #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
rdoc.rdoc_files.exclude('lib/middleman/features/sprockets+ruby19.rb')
rdoc.rdoc_files.exclude('lib/middleman/templater+dynamic_renderer.rb')
Rake::RDocTask.new do |rdoc|
if File.exist?('VERSION')
version = File.read('VERSION')
else
version = ""
end
desc "Build and publish documentation using GitHub Pages."
task :pages do
if !`git status`.include?('nothing to commit')
abort "dirty index - not publishing!"
end
# rdoc.template = 'direct'
Rake::Task[:rerdoc].invoke
`git checkout gh-pages`
`ls -1 | grep -v rdoc | xargs rm -rf; mv rdoc/* .; rm -rf rdoc`
`git commit -a -m "update docs"; git push origin gh-pages`
`git checkout master`
end
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "middleman #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
rdoc.rdoc_files.exclude('lib/middleman/features/sprockets+ruby19.rb')
rdoc.rdoc_files.exclude('lib/middleman/templater+dynamic_renderer.rb')
end
desc "Build and publish documentation using GitHub Pages."
task :pages do
if !`git status`.include?('nothing to commit')
abort "dirty index - not publishing!"
end
Rake::Task[:rerdoc].invoke
`git checkout gh-pages`
`ls -1 | grep -v rdoc | xargs rm -rf; mv rdoc/* .; rm -rf rdoc`
`git commit -a -m "update docs"; git push origin gh-pages`
`git checkout master`
end

View file

@ -1,5 +1,5 @@
#!/usr/bin/env ruby
require 'rubygems'
require File.join(File.dirname(File.dirname(__FILE__)), 'lib', 'middleman')
require 'templater'
module Generators

View file

@ -2,5 +2,5 @@ libdir = File.dirname(__FILE__)
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
# Bundler
require File.join(File.dirname(libdir), "vendor", "gems", "environment") if ENV["RUN_CODE_RUN"]
require File.join(File.dirname(libdir), "vendor", "gems", "environment")# if ENV["RUN_CODE_RUN"]
require 'middleman/base'

View file

@ -1,6 +1,3 @@
# Be nice to other library systems, like the wonderful Rip
require 'rubygems' unless ENV['NO_RUBYGEMS']
# We're riding on Sinatra, so let's include it
require 'sinatra/base'

View file

@ -1,9 +1,8 @@
require 'rubygems'
#require 'rubygems'
require File.join(File.dirname(File.dirname(__FILE__)), 'lib', 'middleman')
require 'spec'
require 'rack/test'
require File.join(File.dirname(File.dirname(__FILE__)), 'lib', 'middleman')
Spec::Runner.configure do |config|
end

View file

@ -3,71 +3,73 @@ module Bundler
file = File.expand_path(__FILE__)
dir = File.dirname(file)
ENV["GEM_HOME"] = dir
ENV["GEM_PATH"] = dir
ENV["PATH"] = "#{dir}/../bin:#{ENV["PATH"]}"
ENV["RUBYOPT"] = "-r#{file} #{ENV["RUBYOPT"]}"
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/term-ansicolor-1.0.4/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/term-ansicolor-1.0.4/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/httpclient-2.1.5.2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/httpclient-2.1.5.2/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/builder-2.1.2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/builder-2.1.2/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/polyglot-0.2.9/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/polyglot-0.2.9/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/treetop-1.4.2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/treetop-1.4.2/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rake-0.8.7/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rake-0.8.7/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rdoc-2.4.3/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rdoc-2.4.3/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/term-ansicolor-1.0.4/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/term-ansicolor-1.0.4/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/extlib-0.9.13/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/extlib-0.9.13/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/highline-1.5.1/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/highline-1.5.1/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/diff-lcs-1.1.2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/diff-lcs-1.1.2/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/cucumber-0.4.4/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/cucumber-0.4.4/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rspec-1.2.9/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rspec-1.2.9/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/templater-1.0.0/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/templater-1.0.0/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/eventmachine-0.12.10/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/eventmachine-0.12.10/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/daemons-1.0.10/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/daemons-1.0.10/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/haml-2.2.13/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/haml-2.2.13/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/json-1.2.0/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/json-1.2.0/ext/json/ext")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/json-1.2.0/ext")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/json-1.2.0/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/smusher-0.4.2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/smusher-0.4.2/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/configuration-1.1.0/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/configuration-1.1.0/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/extlib-0.9.13/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/extlib-0.9.13/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/diff-lcs-1.1.2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/diff-lcs-1.1.2/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/launchy-0.3.3/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/launchy-0.3.3/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sdoc-0.2.14.1/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sdoc-0.2.14.1/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rspec-1.2.9/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rspec-1.2.9/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/cucumber-0.4.4/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/cucumber-0.4.4/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/daemons-1.0.10/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/daemons-1.0.10/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/yui-compressor-0.9.1/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/yui-compressor-0.9.1/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/highline-1.5.1/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/highline-1.5.1/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/haml-2.2.13/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/haml-2.2.13/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/compass-0.8.17/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/compass-0.8.17/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/eventmachine-0.12.10/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/eventmachine-0.12.10/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/httpclient-2.1.5.2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/httpclient-2.1.5.2/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rake-0.8.7/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rake-0.8.7/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sprockets-1.0.2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sprockets-1.0.2/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/templater-1.0.0/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/templater-1.0.0/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/smusher-0.4.2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/smusher-0.4.2/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-1.0.1/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-1.0.1/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/thin-1.2.5/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/thin-1.2.5/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-test-0.5.2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-test-0.5.2/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/configuration-1.1.0/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/configuration-1.1.0/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/launchy-0.3.3/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/launchy-0.3.3/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/shotgun-0.4/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/shotgun-0.4/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sinatra-0.9.4/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sinatra-0.9.4/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rdoc-2.4.3/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rdoc-2.4.3/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sdoc-0.2.14.1/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sdoc-0.2.14.1/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sinatra-content-for-0.2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sinatra-content-for-0.2/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/thin-1.2.5/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/thin-1.2.5/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-1.0.1/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-1.0.1/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-test-0.5.1/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-test-0.5.1/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/compass-0.8.17/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/compass-0.8.17/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/yui-compressor-0.9.1/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/yui-compressor-0.9.1/lib")
@gemfile = "#{dir}/../../Gemfile"

View file

@ -1,3 +1,10 @@
== 0.5.2 / 2009-11-13
* Bug fixes
* Call close on response body after iteration, not before (Simon Rozet)
* Add missing require for time in cookie_jar.rb (Jerry West)
== 0.5.1 / 2009-10-27
* Bug fixes

View file

@ -28,9 +28,10 @@ module Rack
env["HTTP_COOKIE"] ||= cookie_jar.for(uri)
@last_request = Rack::Request.new(env)
status, headers, body = @app.call(@last_request.env)
body.close if body.respond_to?(:close)
@last_response = MockResponse.new(status, headers, body, env["rack.errors"].flush)
body.close if body.respond_to?(:close)
cookie_jar.merge(last_response.headers["Set-Cookie"], uri)
@after_request.each { |hook| hook.call }

View file

@ -9,7 +9,7 @@ require "rack/test/uploaded_file"
module Rack
module Test
VERSION = "0.5.1"
VERSION = "0.5.2"
DEFAULT_HOST = "example.org"
MULTIPART_BOUNDARY = "----------XnJLe9ZIbbGUYtzPQJ16u1"

View file

@ -1,4 +1,5 @@
require "uri"
require "time"
module Rack
module Test

View file

@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = %q{rack-test}
s.version = "0.5.1"
s.version = "0.5.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Bryan Helmkamp"]
s.date = %q{2009-10-27}
s.date = %q{2009-11-13}
s.description = %q{Rack::Test is a small, simple testing API for Rack apps. It can be used on its
own or as a reusable starting point for Web frameworks and testing libraries
to build on. Most of its initial functionality is an extraction of Merb 1.0's

View file

@ -106,13 +106,43 @@ describe Rack::Test::Session do
last_request.env["rack.input"].read.should == "foo[bar]=1"
end
it "closes response's body" do
body = "Hello, World!"
body.should_receive(:close)
app = lambda {|env|
[200, {"Content-Type" => "text/html", "Content-Length" => "13"}, body]
}
Rack::Test::Session.new(Rack::MockSession.new(app)).request("/")
context "when the response body responds_to?(:close)" do
class CloseableBody
def initialize
@closed = false
end
def each
return if @closed
yield "Hello, World!"
end
def close
@closed = true
end
end
it "closes response's body" do
body = CloseableBody.new
body.should_receive(:close)
app = lambda do |env|
[200, {"Content-Type" => "text/html", "Content-Length" => "13"}, body]
end
session = Rack::Test::Session.new(Rack::MockSession.new(app))
session.request("/")
end
it "closes response's body after iteration" do
app = lambda do |env|
[200, {"Content-Type" => "text/html", "Content-Length" => "13"}, CloseableBody.new]
end
session = Rack::Test::Session.new(Rack::MockSession.new(app))
session.request("/")
session.last_response.body.should == "Hello, World!"
end
end
context "when input is given" do

View file

@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = %q{rack-test}
s.version = "0.5.1"
s.version = "0.5.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Bryan Helmkamp"]
s.date = %q{2009-10-26}
s.date = %q{2009-11-12}
s.description = %q{Rack::Test is a small, simple testing API for Rack apps. It can be used on its
own or as a reusable starting point for Web frameworks and testing libraries
to build on. Most of its initial functionality is an extraction of Merb 1.0's