gem updates

This commit is contained in:
tdreyno 2010-01-20 15:22:40 -08:00
parent c91c0eb891
commit 5e94e17529
1711 changed files with 4512 additions and 3619 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ coverage
rdoc
pkg
.sass-cache
.sassc

View file

@ -11,7 +11,7 @@ gem "sinatra-content-for"
gem "rack-test"
gem "yui-compressor"
gem "haml"
gem "compass", "0.10.0.pre2"
gem "compass", "0.10.0.pre4"
gem "compass-colors"
gem "fancy-buttons"
gem "json_pure"

View file

@ -7,6 +7,7 @@ class Sinatra::Request
end
module Middleman
module Rack; end
class Base < Sinatra::Base
set :app_file, __FILE__
set :root, ENV["MM_DIR"] || Dir.pwd
@ -22,7 +23,7 @@ module Middleman
set :build_dir, "build"
set :http_prefix, nil
use Rack::ConditionalGet if environment == :development
use ::Rack::ConditionalGet if environment == :development
helpers Sinatra::ContentFor
set :features, []
@ -74,17 +75,14 @@ module Middleman
layout = options[:layout] if !options[:layout].nil?
get(url) do
if block_given?
yield
else
return yield if block_given?
process_request(layout)
end
end
end
def self.with_layout(layout, &block)
@@layout = layout
class_eval(&block)
class_eval(&block) if block_given?
ensure
@@layout = nil
end
@ -137,7 +135,6 @@ class Middleman::Base
disable :minify_css
disable :minify_javascript
disable :relative_assets
disable :maruku
disable :smush_pngs
disable :automatic_image_sizes
disable :relative_assets
@ -161,7 +158,7 @@ class Middleman::Base
use Middleman::Rack::MinifyCSS
use Middleman::Rack::Downstream
def self.new(*args, &bk)
def self.new(*args, &block)
# loop over enabled feature
features.flatten.each do |feature_name|
next unless send(:"#{feature_name}?")

View file

@ -4,7 +4,7 @@ class Middleman::Base
alias_method :pre_automatic_image_tag, :image_tag
helpers do
def image_tag(path, params={})
if !options.respond_to?(:automatic_image_sizes?) || !options.automatic_image_sizes?
if !options.enabled?(:automatic_image_sizes)
return pre_automatic_image_tag(path, params)
end

View file

@ -1,7 +1,7 @@
class Middleman::Base
after_feature_init do
::Compass.configuration do |config|
if self.respond_to?(:cache_buster?) && self.cache_buster?
if self.enabled?(:cache_buster)
config.asset_cache_buster do |path, real_path|
real_path = real_path.path if real_path.is_a? File
real_path = real_path.gsub(File.join(self.root, self.build_dir), self.public)
@ -25,7 +25,7 @@ class << Middleman::Base
def asset_url(path, prefix="", request=nil)
http_path = pre_cache_buster_asset_url(path, prefix, request)
return http_path unless self.respond_to?(:cache_buster?) && self.cache_buster?
return http_path unless self.enabled?(:cache_buster)
if http_path.include?("://") || !%w(.css .png .jpg .js .gif).include?(File.extname(http_path))
http_path

View file

@ -1,2 +0,0 @@
# Errors to growl
# Build complete to growl

View file

@ -1,39 +0,0 @@
begin
require 'maruku'
rescue LoadError
puts "Maruku not available. Install it with: gem install maruku"
end
module Middleman
module Maruku
def self.included(base)
base.supported_formats << "maruku"
base.set :maruku, {}
end
def render_path(path, layout)
if template_exists?(path, :maruku)
render :maruku, path.to_sym
else
super
end
end
private
def render_maruku(template, data, options, locals, &block)
maruku_src = render_erb(template, data, options, locals, &block)
instance = ::Maruku.new(maruku_src, options)
if block_given?
# render layout
instance.to_html_document
else
# render template
instance.to_html
end
end
end
class Base
include Middleman::Maruku
end
end

View file

@ -2,7 +2,7 @@ class Middleman::Base
after_feature_init do
::Compass.configuration do |config|
config.relative_assets = Proc.new do
Middleman::Base.respond_to?(:relative_assets?) && Middleman::Base.relative_assets?
Middleman::Base.enabled?(:relative_assets)
end
end
@ -13,7 +13,7 @@ end
class << Middleman::Base
alias_method :pre_relative_asset_url, :asset_url
def asset_url(path, prefix="", request=nil)
if !self.respond_to?(:relative_assets?) || !self.relative_assets?
if !self.enabled?(:relative_assets)
return pre_relative_asset_url(path, prefix, request)
end

View file

@ -1,17 +1,9 @@
module Middleman
module Rack
class Downstream
class Middleman::Rack::Downstream
def initialize(app, options={})
@app = app
end
def call(env)
if env["DOWNSTREAM"]
env["DOWNSTREAM"]
else
@app.call(env)
end
end
end
env["DOWNSTREAM"] || @app.call(env)
end
end

View file

@ -4,24 +4,25 @@ rescue LoadError
puts "YUI-Compressor not available. Install it with: gem install yui-compressor"
end
module Middleman
module Rack
class MinifyCSS
class Middleman::Rack::MinifyCSS
def initialize(app, options={})
@app = app
end
def call(env)
if env["DOWNSTREAM"] && env["PATH_INFO"].match(/\.css$/) && Middleman::Base.enabled?(:minify_css)
if Middleman::Base.enabled?(:minify_css) &&
env["DOWNSTREAM"] && env["PATH_INFO"].match(/\.css$/)
compressor = ::YUI::CssCompressor.new
source = env["DOWNSTREAM"][2].is_a?(::Rack::File) ? File.read(env["DOWNSTREAM"][2].path) : env["DOWNSTREAM"][2]
source = env["DOWNSTREAM"][2].is_a?(::Rack::File) ?
File.read(env["DOWNSTREAM"][2].path) :
env["DOWNSTREAM"][2]
env["DOWNSTREAM"][2] = compressor.compress(source)
env["DOWNSTREAM"][1]["Content-Length"] = ::Rack::Utils.bytesize(env["DOWNSTREAM"][2]).to_s
end
@app.call(env)
end
end
end
end

View file

@ -4,26 +4,25 @@ rescue LoadError
puts "YUI-Compressor not available. Install it with: gem install yui-compressor"
end
module Middleman
module Rack
class MinifyJavascript
class Middleman::Rack::MinifyJavascript
def initialize(app, options={})
@app = app
end
def call(env)
if env["DOWNSTREAM"] && env["PATH_INFO"].match(/\.js$/) && Middleman::Base.enabled?(:minify_javascript)
if Middleman::Base.enabled?(:minify_javascript) &&
env["DOWNSTREAM"] && env["PATH_INFO"].match(/\.js$/)
compressor = ::YUI::JavaScriptCompressor.new(:munge => true)
source = env["DOWNSTREAM"][2].is_a?(::Rack::File) ? File.read(env["DOWNSTREAM"][2].path) : env["DOWNSTREAM"][2]
source = env["DOWNSTREAM"][2].is_a?(::Rack::File) ?
File.read(env["DOWNSTREAM"][2].path) :
env["DOWNSTREAM"][2]
env["DOWNSTREAM"][2] = compressor.compress(source)
env["DOWNSTREAM"][1]["Content-Length"] = ::Rack::Utils.bytesize(env["DOWNSTREAM"][2]).to_s
end
@app.call(env)
end
end
end
end
# Middleman::Base.supported_formats << "js"

View file

@ -1,14 +1,11 @@
begin
require 'sprockets'
require 'middleman/rack/sprockets+ruby19' # Sprockets ruby 1.9 duckpunch
rescue LoadError
puts "Sprockets not available. Install it with: gem install sprockets"
end
module Middleman
module Rack
class Sprockets
class Middleman::Rack::Sprockets
def initialize(app, options={})
@app = app
end
@ -16,13 +13,14 @@ module Middleman
def call(env)
path = env["PATH_INFO"]
source_pub = File.join(Middleman::Base.views, path)
source_view = File.join(Middleman::Base.views, path)
source = "public" if File.exists?(source_pub)
source = "views" if File.exists?(source_view)
if env["DOWNSTREAM"] && path.match(/\.js$/)
source = "public" if File.exists?(File.join(Middleman::Base.views, path))
source = "views" if File.exists?(File.join(Middleman::Base.views, path))
if env["DOWNSTREAM"] && path.match(/\.js$/) && source
source_file = env["DOWNSTREAM"][2].is_a?(::Rack::File) ? env["DOWNSTREAM"][2].path : env["DOWNSTREAM"][2]
if source
source_file = env["DOWNSTREAM"][2].is_a?(::Rack::File) ?
env["DOWNSTREAM"][2].path :
env["DOWNSTREAM"][2]
secretary = ::Sprockets::Secretary.new( :root => Middleman::Base.root,
:source_files => [ source_file ],
@ -32,11 +30,10 @@ module Middleman
env["DOWNSTREAM"][2] = secretary.concatenation.to_s
env["DOWNSTREAM"][1]["Content-Length"] = ::Rack::Utils.bytesize(env["DOWNSTREAM"][2]).to_s
end
end
@app.call(env)
end
end
end
end
Middleman::Base.supported_formats << "js"

View file

@ -1,6 +1,4 @@
module Middleman
module Rack
class Static
class Middleman::Rack::Static
def initialize(app, options={})
@app = app
end
@ -10,15 +8,11 @@ module Middleman
view_file_path = File.join(Middleman::Base.views, env["PATH_INFO"])
if File.exists?(public_file_path) && !File.directory?(public_file_path)
file_server = ::Rack::File.new(Middleman::Base.public)
env["DOWNSTREAM"] = file_server.call(env)
env["DOWNSTREAM"] = ::Rack::File.new(Middleman::Base.public).call(env)
elsif File.exists?(view_file_path) && !File.directory?(view_file_path)
file_server = ::Rack::File.new(Middleman::Base.views)
env["DOWNSTREAM"] = file_server.call(env)
env["DOWNSTREAM"] = ::Rack::File.new(Middleman::Base.views).call(env)
end
@app.call(env)
end
end
end
end

View file

@ -9,8 +9,7 @@ rescue LoadError
puts "YUI-Compressor not available. Install it with: gem install yui-compressor"
end
module Middleman
module Sass
module Middleman::Sass
def self.included(base)
base.supported_formats << "sass"
end
@ -21,12 +20,15 @@ module Middleman
static_version = options.public + request.path_info
send_file(static_version) if File.exists? static_version
location_of_sass_file = options.environment == "build" ? File.join(Dir.pwd, options.build_dir) : options.public
location_of_sass_file = options.environment == "build" ?
File.join(Dir.pwd, options.build_dir) :
options.public
css_filename = File.join(location_of_sass_file, request.path_info)
result = sass(path.to_sym, ::Compass.sass_engine_options.merge({ :css_filename => css_filename }))
if options.enabled?(:minify_css?)
YUI::CssCompressor.new.compress(result)
::YUI::CssCompressor.new.compress(result)
else
result
end
@ -76,7 +78,6 @@ font-family: monospace;
content: "#{e_string.gsub('"', '\"').gsub("\n", '\\A ')}"; }
END
end
end
end
class Middleman::Base
@ -84,6 +85,7 @@ class Middleman::Base
after_feature_init do
::Compass.configuration do |config|
config.cache_path = File.join(self.root, ".sassc") # For sassc files
config.project_path = self.root
config.sass_dir = File.join(File.basename(self.views), self.css_dir)
config.output_style = self.enabled?(:minify_css) ? :compressed : :nested

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/compass-0.10.0.pre2/bin/compass"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/compass-0.10.0.pre4/bin/compass"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/haml-2.2.16/bin/css2sass"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/haml-2.2.17/bin/css2sass"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/json-1.2.0/bin/edit_json.rb"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/json-1.2.0/bin/edit_json.rb"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/haml-2.2.16/bin/haml"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/haml-2.2.17/bin/haml"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/haml-2.2.16/bin/html2haml"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/haml-2.2.17/bin/html2haml"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/diff-lcs-1.1.2/bin/htmldiff"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/diff-lcs-1.1.2/bin/htmldiff"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/launchy-0.3.5/bin/launchy"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/launchy-0.3.5/bin/launchy"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/diff-lcs-1.1.2/bin/ldiff"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/diff-lcs-1.1.2/bin/ldiff"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/json-1.2.0/bin/prettify_json.rb"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/json-1.2.0/bin/prettify_json.rb"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/rack-1.0.1/bin/rackup"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/rack-1.1.0/bin/rackup"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/rake-0.8.7/bin/rake"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/rake-0.8.7/bin/rake"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/haml-2.2.16/bin/sass"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/haml-2.2.17/bin/sass"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/shotgun-0.4/bin/shotgun"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/shotgun-0.5/bin/shotgun"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/smusher-0.4.2/bin/smusher"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/smusher-0.4.2/bin/smusher"))

View file

@ -1,3 +1,3 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/gems/sprockets-1.0.2/bin/sprocketize"))
require File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/environment"))
load File.expand_path(File.join(File.dirname(__FILE__), "../gems/ruby/1.8/gems/sprockets-1.0.2/bin/sprocketize"))

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,185 +1,4 @@
# DO NOT MODIFY THIS FILE
module Bundler
file = File.expand_path(__FILE__)
dir = File.dirname(file)
ENV["PATH"] = "#{dir}/../bin:#{ENV["PATH"]}"
ENV["RUBYOPT"] = "-r#{file} #{ENV["RUBYOPT"]}"
$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/json_pure-1.2.0/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/json_pure-1.2.0/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/extlib-0.9.14/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/extlib-0.9.14/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/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/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.3/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-test-0.5.3/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/haml-2.2.16/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/haml-2.2.16/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/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/launchy-0.3.5/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/launchy-0.3.5/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/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/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/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/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/compass-0.10.0.pre2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/compass-0.10.0.pre2/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/compass-slickmap-0.2.3/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/compass-slickmap-0.2.3/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/compass-colors-0.3.1/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/compass-colors-0.3.1/lib")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/fancy-buttons-0.3.7/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/fancy-buttons-0.3.7/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/sinatra-content-for-0.2/bin")
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sinatra-content-for-0.2/lib")
@gemfile = "#{dir}/../../../../Gemfile"
require "rubygems"
@bundled_specs = {}
@bundled_specs["configuration"] = eval(File.read("#{dir}/specifications/configuration-1.1.0.gemspec"))
@bundled_specs["configuration"].loaded_from = "#{dir}/specifications/configuration-1.1.0.gemspec"
@bundled_specs["json_pure"] = eval(File.read("#{dir}/specifications/json_pure-1.2.0.gemspec"))
@bundled_specs["json_pure"].loaded_from = "#{dir}/specifications/json_pure-1.2.0.gemspec"
@bundled_specs["extlib"] = eval(File.read("#{dir}/specifications/extlib-0.9.14.gemspec"))
@bundled_specs["extlib"].loaded_from = "#{dir}/specifications/extlib-0.9.14.gemspec"
@bundled_specs["json"] = eval(File.read("#{dir}/specifications/json-1.2.0.gemspec"))
@bundled_specs["json"].loaded_from = "#{dir}/specifications/json-1.2.0.gemspec"
@bundled_specs["yui-compressor"] = eval(File.read("#{dir}/specifications/yui-compressor-0.9.1.gemspec"))
@bundled_specs["yui-compressor"].loaded_from = "#{dir}/specifications/yui-compressor-0.9.1.gemspec"
@bundled_specs["rack"] = eval(File.read("#{dir}/specifications/rack-1.0.1.gemspec"))
@bundled_specs["rack"].loaded_from = "#{dir}/specifications/rack-1.0.1.gemspec"
@bundled_specs["rack-test"] = eval(File.read("#{dir}/specifications/rack-test-0.5.3.gemspec"))
@bundled_specs["rack-test"].loaded_from = "#{dir}/specifications/rack-test-0.5.3.gemspec"
@bundled_specs["sinatra"] = eval(File.read("#{dir}/specifications/sinatra-0.9.4.gemspec"))
@bundled_specs["sinatra"].loaded_from = "#{dir}/specifications/sinatra-0.9.4.gemspec"
@bundled_specs["haml"] = eval(File.read("#{dir}/specifications/haml-2.2.16.gemspec"))
@bundled_specs["haml"].loaded_from = "#{dir}/specifications/haml-2.2.16.gemspec"
@bundled_specs["sprockets"] = eval(File.read("#{dir}/specifications/sprockets-1.0.2.gemspec"))
@bundled_specs["sprockets"].loaded_from = "#{dir}/specifications/sprockets-1.0.2.gemspec"
@bundled_specs["rake"] = eval(File.read("#{dir}/specifications/rake-0.8.7.gemspec"))
@bundled_specs["rake"].loaded_from = "#{dir}/specifications/rake-0.8.7.gemspec"
@bundled_specs["launchy"] = eval(File.read("#{dir}/specifications/launchy-0.3.5.gemspec"))
@bundled_specs["launchy"].loaded_from = "#{dir}/specifications/launchy-0.3.5.gemspec"
@bundled_specs["shotgun"] = eval(File.read("#{dir}/specifications/shotgun-0.4.gemspec"))
@bundled_specs["shotgun"].loaded_from = "#{dir}/specifications/shotgun-0.4.gemspec"
@bundled_specs["diff-lcs"] = eval(File.read("#{dir}/specifications/diff-lcs-1.1.2.gemspec"))
@bundled_specs["diff-lcs"].loaded_from = "#{dir}/specifications/diff-lcs-1.1.2.gemspec"
@bundled_specs["highline"] = eval(File.read("#{dir}/specifications/highline-1.5.1.gemspec"))
@bundled_specs["highline"].loaded_from = "#{dir}/specifications/highline-1.5.1.gemspec"
@bundled_specs["templater"] = eval(File.read("#{dir}/specifications/templater-1.0.0.gemspec"))
@bundled_specs["templater"].loaded_from = "#{dir}/specifications/templater-1.0.0.gemspec"
@bundled_specs["httpclient"] = eval(File.read("#{dir}/specifications/httpclient-2.1.5.2.gemspec"))
@bundled_specs["httpclient"].loaded_from = "#{dir}/specifications/httpclient-2.1.5.2.gemspec"
@bundled_specs["compass"] = eval(File.read("#{dir}/specifications/compass-0.10.0.pre2.gemspec"))
@bundled_specs["compass"].loaded_from = "#{dir}/specifications/compass-0.10.0.pre2.gemspec"
@bundled_specs["compass-slickmap"] = eval(File.read("#{dir}/specifications/compass-slickmap-0.2.3.gemspec"))
@bundled_specs["compass-slickmap"].loaded_from = "#{dir}/specifications/compass-slickmap-0.2.3.gemspec"
@bundled_specs["compass-colors"] = eval(File.read("#{dir}/specifications/compass-colors-0.3.1.gemspec"))
@bundled_specs["compass-colors"].loaded_from = "#{dir}/specifications/compass-colors-0.3.1.gemspec"
@bundled_specs["fancy-buttons"] = eval(File.read("#{dir}/specifications/fancy-buttons-0.3.7.gemspec"))
@bundled_specs["fancy-buttons"].loaded_from = "#{dir}/specifications/fancy-buttons-0.3.7.gemspec"
@bundled_specs["smusher"] = eval(File.read("#{dir}/specifications/smusher-0.4.2.gemspec"))
@bundled_specs["smusher"].loaded_from = "#{dir}/specifications/smusher-0.4.2.gemspec"
@bundled_specs["sinatra-content-for"] = eval(File.read("#{dir}/specifications/sinatra-content-for-0.2.gemspec"))
@bundled_specs["sinatra-content-for"].loaded_from = "#{dir}/specifications/sinatra-content-for-0.2.gemspec"
def self.add_specs_to_loaded_specs
Gem.loaded_specs.merge! @bundled_specs
end
def self.add_specs_to_index
@bundled_specs.each do |name, spec|
Gem.source_index.add_spec spec
end
end
add_specs_to_loaded_specs
add_specs_to_index
def self.require_env(env = nil)
context = Class.new do
def initialize(env) @env = env && env.to_s ; end
def method_missing(*) ; yield if block_given? ; end
def only(*env)
old, @only = @only, _combine_only(env.flatten)
yield
@only = old
end
def except(*env)
old, @except = @except, _combine_except(env.flatten)
yield
@except = old
end
def gem(name, *args)
opt = args.last.is_a?(Hash) ? args.pop : {}
only = _combine_only(opt[:only] || opt["only"])
except = _combine_except(opt[:except] || opt["except"])
files = opt[:require_as] || opt["require_as"] || name
files = [files] unless files.respond_to?(:each)
return unless !only || only.any? {|e| e == @env }
return if except && except.any? {|e| e == @env }
if files = opt[:require_as] || opt["require_as"]
files = Array(files)
files.each { |f| require f }
else
begin
require name
rescue LoadError
# Do nothing
end
end
yield if block_given?
true
end
private
def _combine_only(only)
return @only unless only
only = [only].flatten.compact.uniq.map { |o| o.to_s }
only &= @only if @only
only
end
def _combine_except(except)
return @except unless except
except = [except].flatten.compact.uniq.map { |o| o.to_s }
except |= @except if @except
except
end
end
context.new(env && env.to_s).instance_eval(File.read(@gemfile), @gemfile, 1)
end
end
module Gem
@loaded_stacks = Hash.new { |h,k| h[k] = [] }
def source_index.refresh!
super
Bundler.add_specs_to_index
end
end
require 'rbconfig'
engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
version = Config::CONFIG['ruby_version']
require File.expand_path("../#{engine}/#{version}/environment", __FILE__)

View file

@ -1 +0,0 @@
2465baba525421ac9cac1774d940f9e27971710d

View file

@ -1,67 +0,0 @@
module Compass
class Compiler
include Actions
attr_accessor :working_path, :from, :to, :options
def initialize(working_path, from, to, options)
self.working_path = working_path
self.from, self.to = from, to
self.logger = options.delete(:logger)
self.options = options
self.options[:cache_location] ||= File.join(from, ".sass-cache")
end
def sass_files(options = {})
exclude_partials = options.fetch(:exclude_partials, true)
@sass_files || Dir.glob(separate("#{from}/**/#{'[^_]' if exclude_partials}*.sass"))
end
def stylesheet_name(sass_file)
sass_file[("#{from}/".length)..-6]
end
def css_files
@css_files ||= sass_files.map{|sass_file| corresponding_css_file(sass_file)}
end
def corresponding_css_file(sass_file)
"#{to}/#{stylesheet_name(sass_file)}.css"
end
def target_directories
css_files.map{|css_file| File.dirname(css_file)}.uniq.sort.sort_by{|d| d.length }
end
def out_of_date?
Compass.configure_sass_plugin! unless Compass.sass_plugin_configured?
sass_files.zip(css_files).each do |sass_filename, css_filename|
return sass_filename if Sass::Plugin.exact_stylesheet_needs_update?(css_filename, sass_filename)
end
false
end
def run
Compass.configure_sass_plugin! unless Compass.sass_plugin_configured?
target_directories.each do |dir|
directory dir
end
sass_files.zip(css_files).each do |sass_filename, css_filename|
begin
compile sass_filename, css_filename, options
rescue Sass::SyntaxError => e
full_exception = Compass.configuration.environment == :development
logger.record :error, basename(sass_filename), "(Line #{e.sass_line}: #{e.message})"
contents = if Sass::SyntaxError.respond_to?(:exception_to_css)
Sass::SyntaxError.exception_to_css(e, :full_exception => full_exception)
else
Sass::Plugin.options[:full_exception] ||= Compass.configuration.environment == :development
Sass::Plugin.send(:exception_string, e)
end
write_file css_filename, contents, options.merge(:force => true)
end
end
end
end
end

View file

@ -1,6 +0,0 @@
=has-layout
// This makes ie6 get layout
display: inline-block
// and this puts it back to block
&
display: block

View file

@ -1,76 +0,0 @@
# This file came from the Blueprint Project
begin
require 'rubygems'
gem 'rmagick'
require 'rvg/rvg'
rescue Exception => e
end
module Compass
# Uses ImageMagick and RMagick to generate grid.png file
class GridBuilder
include Actions
begin
include Magick
rescue Exception => e
end
attr_reader :column_width, :gutter_width, :filename, :able_to_generate, :options
# ==== Options
# * <tt>options</tt>
# * <tt>:column_width</tt> -- Width (in pixels) of current grid column
# * <tt>:gutter_width</tt> -- Width (in pixels) of current grid gutter
# * <tt>:height</tt> -- Height (in pixels) of a row
# * <tt>:filename</tt> -- Output path of grid.png file
def initialize(options={})
@able_to_generate = Magick::Long_version rescue false
return unless @able_to_generate
@column_width = options[:column_width]
@gutter_width = options[:gutter_width]
@height = options[:height] || 20
@filename = options[:filename]
@options = options
end
def working_path
options[:working_path]
end
# generates (overwriting if necessary) grid.png image to be tiled in background
def generate!
return false unless self.able_to_generate
total_width = self.column_width + self.gutter_width
RVG::dpi = 100
rvg = RVG.new((total_width.to_f/RVG::dpi).in, (@height.to_f/RVG::dpi).in).viewbox(0, 0, total_width, @height) do |canvas|
canvas.background_fill = 'white'
canvas.g do |column|
column.rect(self.column_width - 1, @height).styles(:fill => "#e8effb")
end
canvas.g do |baseline|
baseline.line(0, (@height - 1), total_width, (@height- 1)).styles(:fill => "#e9e9e9")
end
end
if File.exists?(filename)
if options[:force]
overwrite = true
else
msg = "#{filename} already exists. Overwrite with --force."
raise Compass::FilesystemConflict.new(msg)
end
end
directory File.dirname(filename)
logger.record((overwrite ? :overwrite : :create), basename(filename))
unless options[:dry_run]
rvg.draw.write(filename)
else
true
end
end
end
end

View file

@ -1,23 +0,0 @@
require 'sass/plugin'
# XXX: We can remove this monkeypatch once Sass 2.2 is released.
module Sass::Plugin
class << self
unless method_defined?(:exact_stylesheet_needs_update?)
def stylesheet_needs_update?(name, template_path, css_path)
css_file = css_filename(name, css_path)
template_file = template_filename(name, template_path)
exact_stylesheet_needs_update?(css_file, template_file)
end
def exact_stylesheet_needs_update?(css_file, template_file)
if !File.exists?(css_file)
return true
else
css_mtime = File.mtime(css_file)
File.mtime(template_file) > css_mtime ||
dependencies(template_file).any?(&dependency_updated?(css_mtime))
end
end
end
end
end

View file

@ -1,193 +0,0 @@
class FSSM::Cache
module Common
include Enumerable
def initialize
@children = Hash.new
end
def each(prefix='./', &block)
@children.each do |segment, node|
cprefix = Pathname.for(prefix.dup).join(segment)
block.call(cprefix, node)
node.each(cprefix, &block)
end
end
protected
def with_lock
@mutex.lock
yield
@mutex.unlock
end
def descendant(path)
recurse_on_key(path, false)
end
def descendant!(path)
recurse_on_key(path, true)
end
def child(segment)
has_child?(segment) ? @children["#{segment}"] : nil
end
def child!(segment)
(@children["#{segment}"] ||= Node.new)
end
def has_child?(segment)
@children.include?("#{segment}")
end
def remove_child(segment)
@children.delete("#{segment}")
end
def remove_children
@children.clear
end
def recurse_on_key(key, create)
key = sanitize_key(key)
node = self
until key.empty?
segment = key.shift
node = create ? node.child!(segment) : node.child(segment)
return nil unless node
end
node
end
def key_for_path(path)
Pathname.for(path).names
end
def relative_path(path)
sanitize_path(path, false)
end
def absolute_path(path)
sanitize_path(path, true)
end
def sanitize_path(path, absolute)
if path.is_a?(Array)
first = absolute ? '/' : path.shift
path = path.inject(Pathname.new("#{first}")) do |pathname, segment|
pathname.join("#{segment}")
end
path
else
path = Pathname.for(path)
absolute ? path.expand_path : path
end
end
end
class Node
include Common
attr_accessor :mtime
attr_accessor :ftype
def <=>(other)
self.mtime <=> other.mtime
end
def from_path(path)
path = absolute_path(path)
@mtime = path.mtime
@ftype = path.ftype
end
protected
def sanitize_key(key)
key_for_path(relative_path(key))
end
end
include Common
def initialize
@mutex = Mutex.new
super
end
def clear
@mutex.lock
@children.clear
@mutex.unlock
end
def set(path)
unset(path)
node = descendant!(path)
node.from_path(path)
node.mtime
end
def unset(path='/')
key = sanitize_key(path)
if key.empty?
self.clear
return nil
end
segment = key.pop
node = descendant(key)
return unless node
@mutex.lock
node.remove_child(segment)
@mutex.unlock
nil
end
def files
ftype('file')
end
def directories
ftype('directory')
end
protected
def each(&block)
prefix='/'
super(prefix, &block)
end
def ftype(ft)
inject({}) do |hash, entry|
path, node = entry
hash["#{path}"] = node.mtime if node.ftype == ft
hash
end
end
def descendant(path)
node = recurse_on_key(path, false)
node
end
def descendant!(path)
@mutex.lock
node = recurse_on_key(path, true)
@mutex.unlock
node
end
def sanitize_key(key)
key_for_path(absolute_path(key))
end
end

View file

@ -1,37 +0,0 @@
class Pathname
class << self
def for(path)
path.is_a?(Pathname) ? path : new(path)
end
end
# before overwriting chop_basename:
# %total - 29.50%
# %self - 20.50%
# after overwriting chop_basename:
# %total - 24.36%
# %self - 15.47%
CHOP_PAT = /\A#{SEPARATOR_PAT}?\z/
def chop_basename(path)
base = File.basename(path)
# the original version of this method recalculates this regexp
# each run, despite the pattern never changing.
if CHOP_PAT =~ base
return nil
else
return path[0, path.rindex(base)], base
end
end
def segments
prefix, names = split_names(@path)
names.unshift(prefix) unless prefix.empty?
names.shift if names[0] == '.'
names
end
def names
prefix, names = split_names(@path)
names
end
end

View file

@ -1,22 +0,0 @@
module FSSM::Support
class << self
def backend
(mac? && carbon_core?) ? 'FSEvents' : 'Polling'
end
def mac?
@@mac ||= RUBY_PLATFORM =~ /darwin/i
end
def carbon_core?
@@carbon_core ||= begin
require 'osx/foundation'
OSX.require_framework '/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework'
true
rescue LoadError
false
end
end
end
end

View file

@ -1 +0,0 @@
2.2.16

View file

@ -1,181 +0,0 @@
SHELL = /bin/sh
#### Start of system configuration section. ####
srcdir = .
topdir = /Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1
hdrdir = /Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1
arch_hdrdir = /Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/$(arch)
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
prefix = $(DESTDIR)/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243
exec_prefix = $(prefix)
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
sitehdrdir = $(rubyhdrdir)/site_ruby
rubyhdrdir = $(includedir)/$(RUBY_INSTALL_NAME)-$(ruby_version)
vendordir = $(libdir)/$(RUBY_INSTALL_NAME)/vendor_ruby
sitedir = $(libdir)/$(RUBY_INSTALL_NAME)/site_ruby
mandir = $(datarootdir)/man
localedir = $(datarootdir)/locale
libdir = $(exec_prefix)/lib
psdir = $(docdir)
pdfdir = $(docdir)
dvidir = $(docdir)
htmldir = $(docdir)
infodir = $(datarootdir)/info
docdir = $(datarootdir)/doc/$(PACKAGE)
oldincludedir = $(DESTDIR)/usr/include
includedir = $(prefix)/include
localstatedir = $(prefix)/var
sharedstatedir = $(prefix)/com
sysconfdir = $(prefix)/etc
datadir = $(datarootdir)
datarootdir = $(prefix)/share
libexecdir = $(exec_prefix)/libexec
sbindir = $(exec_prefix)/sbin
bindir = $(exec_prefix)/bin
rubylibdir = $(libdir)/$(ruby_install_name)/$(ruby_version)
archdir = $(rubylibdir)/$(arch)
sitelibdir = $(sitedir)/$(ruby_version)
sitearchdir = $(sitelibdir)/$(sitearch)
vendorlibdir = $(vendordir)/$(ruby_version)
vendorarchdir = $(vendorlibdir)/$(sitearch)
CC = gcc
CXX = g++
LIBRUBY = $(LIBRUBY_SO)
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
OUTFLAG = -o
COUTFLAG = -o
RUBY_EXTCONF_H =
cflags = $(optflags) $(debugflags) $(warnflags)
optflags = -O2
debugflags = -g
warnflags = -Wall -Wno-parentheses
CFLAGS = -fno-common -O3 -march=core2 -m64 -mmmx -msse4.1 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 $(cflags) -fno-common -pipe -fno-common -Wall
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
DEFS =
CPPFLAGS = -DHAVE_RUBY_ST_H -DHAVE_RUBY_ENCODING_H -I/Users/tdreyno/homebrew/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
CXXFLAGS = $(CFLAGS) -O3 -march=core2 -m64 -mmmx -msse4.1 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 $(cxxflags)
ldflags = -L. -L/Users/tdreyno/homebrew/lib -L/usr/local/lib
dldflags =
archflag =
DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
LDSHAREDXX = $(LDSHARED)
AR = ar
EXEEXT =
RUBY_INSTALL_NAME = ruby
RUBY_SO_NAME = ruby
arch = i386-darwin10.0.0
sitearch = i386-darwin10.0.0
ruby_version = 1.9.1
ruby = /Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/bin/ruby
RUBY = $(ruby)
RM = rm -f
RM_RF = $(RUBY) -run -e rm -- -rf
RMDIRS = $(RUBY) -run -e rmdir -- -p
MAKEDIRS = mkdir -p
INSTALL = /usr/bin/install -c
INSTALL_PROG = $(INSTALL) -m 0755
INSTALL_DATA = $(INSTALL) -m 644
COPY = cp
#### End of system configuration section. ####
preload =
libpath = . $(libdir)
LIBPATH = -L. -L$(libdir)
DEFFILE =
CLEANFILES = mkmf.log
DISTCLEANFILES =
DISTCLEANDIRS =
extout =
extout_prefix =
target_prefix =
LOCAL_LIBS =
LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
SRCS = generator.c unicode.c
OBJS = generator.o unicode.o
TARGET = generator
DLLIB = $(TARGET).bundle
EXTSTATIC =
STATIC_LIB =
BINDIR = $(bindir)
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
RUBYLIBDIR = /Users/tdreyno/Dropbox/Sites/middleman/lib/middleman/vendor/gems/gems/json-1.2.0/ext/json/ext$(target_prefix)
RUBYARCHDIR = /Users/tdreyno/Dropbox/Sites/middleman/lib/middleman/vendor/gems/gems/json-1.2.0/ext/json/ext$(target_prefix)
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
TARGET_SO = $(DLLIB)
CLEANLIBS = $(TARGET).bundle
CLEANOBJS = *.o *.bak
all: $(DLLIB)
static: $(STATIC_LIB)
clean-rb-default::
clean-rb::
clean-so::
clean: clean-so clean-rb-default clean-rb
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
distclean-rb-default::
distclean-rb::
distclean-so::
distclean: clean distclean-so distclean-rb-default distclean-rb
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
@-$(RMDIRS) $(DISTCLEANDIRS)
realclean: distclean
install: install-so install-rb
install-so: $(RUBYARCHDIR)
install-so: $(RUBYARCHDIR)/$(DLLIB)
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
install-rb: pre-install-rb install-rb-default
install-rb-default: pre-install-rb-default
pre-install-rb: Makefile
pre-install-rb-default: Makefile
$(RUBYARCHDIR):
$(MAKEDIRS) $@
site-install: site-install-so site-install-rb
site-install-so: install-so
site-install-rb: install-rb
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
.cc.o:
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
.cxx.o:
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
.cpp.o:
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
.C.o:
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
.c.o:
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
$(DLLIB): $(OBJS) Makefile
@-$(RM) $(@)
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
$(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h

View file

@ -1,32 +0,0 @@
have_header: checking for ruby/st.h... -------------------- yes
"gcc -o conftest -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/i386-darwin10.0.0 -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/ruby/backward -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1 -I. -I/Users/tdreyno/homebrew/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/Users/tdreyno/homebrew/include -O3 -march=core2 -m64 -mmmx -msse4.1 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 -O2 -g -Wall -Wno-parentheses -fno-common -pipe -fno-common -Wall conftest.c -L. -L/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/lib -L. -L/Users/tdreyno/homebrew/lib -L/usr/local/lib -lruby-static -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
"gcc -E -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/i386-darwin10.0.0 -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/ruby/backward -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1 -I. -I/Users/tdreyno/homebrew/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/Users/tdreyno/homebrew/include -O3 -march=core2 -m64 -mmmx -msse4.1 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 -O2 -g -Wall -Wno-parentheses -fno-common -pipe -fno-common -Wall conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby/st.h>
/* end */
--------------------
have_header: checking for ruby/encoding.h... -------------------- yes
"gcc -E -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/i386-darwin10.0.0 -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/ruby/backward -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1 -I. -I/Users/tdreyno/homebrew/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/Users/tdreyno/homebrew/include -O3 -march=core2 -m64 -mmmx -msse4.1 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 -O2 -g -Wall -Wno-parentheses -fno-common -pipe -fno-common -Wall conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby/encoding.h>
/* end */
--------------------

View file

@ -1,181 +0,0 @@
SHELL = /bin/sh
#### Start of system configuration section. ####
srcdir = .
topdir = /Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1
hdrdir = /Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1
arch_hdrdir = /Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/$(arch)
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
prefix = $(DESTDIR)/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243
exec_prefix = $(prefix)
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
sitehdrdir = $(rubyhdrdir)/site_ruby
rubyhdrdir = $(includedir)/$(RUBY_INSTALL_NAME)-$(ruby_version)
vendordir = $(libdir)/$(RUBY_INSTALL_NAME)/vendor_ruby
sitedir = $(libdir)/$(RUBY_INSTALL_NAME)/site_ruby
mandir = $(datarootdir)/man
localedir = $(datarootdir)/locale
libdir = $(exec_prefix)/lib
psdir = $(docdir)
pdfdir = $(docdir)
dvidir = $(docdir)
htmldir = $(docdir)
infodir = $(datarootdir)/info
docdir = $(datarootdir)/doc/$(PACKAGE)
oldincludedir = $(DESTDIR)/usr/include
includedir = $(prefix)/include
localstatedir = $(prefix)/var
sharedstatedir = $(prefix)/com
sysconfdir = $(prefix)/etc
datadir = $(datarootdir)
datarootdir = $(prefix)/share
libexecdir = $(exec_prefix)/libexec
sbindir = $(exec_prefix)/sbin
bindir = $(exec_prefix)/bin
rubylibdir = $(libdir)/$(ruby_install_name)/$(ruby_version)
archdir = $(rubylibdir)/$(arch)
sitelibdir = $(sitedir)/$(ruby_version)
sitearchdir = $(sitelibdir)/$(sitearch)
vendorlibdir = $(vendordir)/$(ruby_version)
vendorarchdir = $(vendorlibdir)/$(sitearch)
CC = gcc
CXX = g++
LIBRUBY = $(LIBRUBY_SO)
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
OUTFLAG = -o
COUTFLAG = -o
RUBY_EXTCONF_H =
cflags = $(optflags) $(debugflags) $(warnflags)
optflags = -O2
debugflags = -g
warnflags = -Wall -Wno-parentheses
CFLAGS = -fno-common -O3 -march=core2 -m64 -mmmx -msse4.1 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 $(cflags) -fno-common -pipe -fno-common -Wall
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
DEFS =
CPPFLAGS = -DHAVE_RUBY_ST_H -I/Users/tdreyno/homebrew/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
CXXFLAGS = $(CFLAGS) -O3 -march=core2 -m64 -mmmx -msse4.1 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 $(cxxflags)
ldflags = -L. -L/Users/tdreyno/homebrew/lib -L/usr/local/lib
dldflags =
archflag =
DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
LDSHAREDXX = $(LDSHARED)
AR = ar
EXEEXT =
RUBY_INSTALL_NAME = ruby
RUBY_SO_NAME = ruby
arch = i386-darwin10.0.0
sitearch = i386-darwin10.0.0
ruby_version = 1.9.1
ruby = /Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/bin/ruby
RUBY = $(ruby)
RM = rm -f
RM_RF = $(RUBY) -run -e rm -- -rf
RMDIRS = $(RUBY) -run -e rmdir -- -p
MAKEDIRS = mkdir -p
INSTALL = /usr/bin/install -c
INSTALL_PROG = $(INSTALL) -m 0755
INSTALL_DATA = $(INSTALL) -m 644
COPY = cp
#### End of system configuration section. ####
preload =
libpath = . $(libdir)
LIBPATH = -L. -L$(libdir)
DEFFILE =
CLEANFILES = mkmf.log
DISTCLEANFILES =
DISTCLEANDIRS =
extout =
extout_prefix =
target_prefix =
LOCAL_LIBS =
LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
SRCS = parser.c unicode.c
OBJS = parser.o unicode.o
TARGET = parser
DLLIB = $(TARGET).bundle
EXTSTATIC =
STATIC_LIB =
BINDIR = $(bindir)
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
RUBYLIBDIR = /Users/tdreyno/Dropbox/Sites/middleman/lib/middleman/vendor/gems/gems/json-1.2.0/ext/json/ext$(target_prefix)
RUBYARCHDIR = /Users/tdreyno/Dropbox/Sites/middleman/lib/middleman/vendor/gems/gems/json-1.2.0/ext/json/ext$(target_prefix)
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
TARGET_SO = $(DLLIB)
CLEANLIBS = $(TARGET).bundle
CLEANOBJS = *.o *.bak
all: $(DLLIB)
static: $(STATIC_LIB)
clean-rb-default::
clean-rb::
clean-so::
clean: clean-so clean-rb-default clean-rb
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
distclean-rb-default::
distclean-rb::
distclean-so::
distclean: clean distclean-so distclean-rb-default distclean-rb
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
@-$(RMDIRS) $(DISTCLEANDIRS)
realclean: distclean
install: install-so install-rb
install-so: $(RUBYARCHDIR)
install-so: $(RUBYARCHDIR)/$(DLLIB)
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
install-rb: pre-install-rb install-rb-default
install-rb-default: pre-install-rb-default
pre-install-rb: Makefile
pre-install-rb-default: Makefile
$(RUBYARCHDIR):
$(MAKEDIRS) $@
site-install: site-install-so site-install-rb
site-install-so: install-so
site-install-rb: install-rb
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
.cc.o:
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
.cxx.o:
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
.cpp.o:
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
.C.o:
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
.c.o:
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
$(DLLIB): $(OBJS) Makefile
@-$(RM) $(@)
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
$(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h

View file

@ -1,33 +0,0 @@
have_header: checking for ruby/st.h... -------------------- yes
"gcc -o conftest -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/i386-darwin10.0.0 -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/ruby/backward -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1 -I. -I/Users/tdreyno/homebrew/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/Users/tdreyno/homebrew/include -O3 -march=core2 -m64 -mmmx -msse4.1 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 -O2 -g -Wall -Wno-parentheses -fno-common -pipe -fno-common -Wall conftest.c -L. -L/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/lib -L. -L/Users/tdreyno/homebrew/lib -L/usr/local/lib -lruby-static -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
"gcc -E -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/i386-darwin10.0.0 -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/ruby/backward -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1 -I. -I/Users/tdreyno/homebrew/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/Users/tdreyno/homebrew/include -O3 -march=core2 -m64 -mmmx -msse4.1 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 -O2 -g -Wall -Wno-parentheses -fno-common -pipe -fno-common -Wall conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby/st.h>
/* end */
--------------------
have_header: checking for re.h... -------------------- no
"gcc -E -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/i386-darwin10.0.0 -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1/ruby/backward -I/Users/tdreyno/homebrew/Cellar/ruby/1.9.1-p243/include/ruby-1.9.1 -I. -I/Users/tdreyno/homebrew/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/Users/tdreyno/homebrew/include -O3 -march=core2 -m64 -mmmx -msse4.1 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 -O2 -g -Wall -Wno-parentheses -fno-common -pipe -fno-common -Wall conftest.c -o conftest.i"
conftest.c:3:16: error: re.h: No such file or directory
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <re.h>
/* end */
--------------------

View file

@ -1,428 +0,0 @@
== Rack::Auth::Basic
* should challenge correctly when no credentials are specified
* should rechallenge if incorrect credentials are specified
* should return application output if correct credentials are specified
* should return 400 Bad Request if different auth scheme used
* realm as optional constructor arg
== Rack::Auth::Digest::MD5
* should challenge when no credentials are specified
* should return application output if correct credentials given
* should return application output if correct credentials given (hashed passwords)
* should rechallenge if incorrect username given
* should rechallenge if incorrect password given
* should rechallenge with stale parameter if nonce is stale
* should return 400 Bad Request if incorrect qop given
* should return 400 Bad Request if incorrect uri given
* should return 400 Bad Request if different auth scheme used
* should not require credentials for unprotected path
* should challenge when no credentials are specified for protected path
* should return application output if correct credentials given for protected path
* should return application output if correct credentials given for POST
* should return application output if correct credentials given for PUT (using method override of POST)
* realm as optional constructor arg
== Rack::Auth::OpenID
* realm uri should be valid
* should be able to check if a uri is within the realm (empty)
* return_to should be valid
* extensions should have required constants defined
* extensions should have Request and Response defined and inherit from OpenID::Extension
== Rack::Builder
* chains apps by default
* has implicit #to_app
* supports blocks on use
* has explicit #to_app
* apps are initialized once
== Rack::Adapter::Camping
* works with GET
* works with POST
== Rack::Cascade
* should dispatch onward on 404 by default
* should dispatch onward on whatever is passed
* should fail if empty
* should append new app
== Rack::Handler::CGI
* startup (empty)
* should respond
* should be a lighttpd
* should have rack headers
* should have CGI headers on GET
* should have CGI headers on POST
* should support HTTP auth
* should set status
* shutdown
== Rack::Chunked
* chunks responses with no Content-Length
* chunks empty bodies properly
* does not modify response when Content-Length header present
* does not modify response when client is HTTP/1.0
* does not modify response when Transfer-Encoding header already present
* does not modify response when status code is 100
* does not modify response when status code is 204
* does not modify response when status code is 304
== Rack::CommonLogger
* should log to rack.errors by default
* should log to anything with <<
== Rack::ConditionalGet
* should set a 304 status and truncate body when If-Modified-Since hits
* should set a 304 status and truncate body when If-None-Match hits
* should not affect non-GET/HEAD requests
== Rack::ContentLength
* sets Content-Length on String bodies if none is set
* sets Content-Length on Array bodies if none is set
* does not set Content-Length on variable length bodies
* does not change Content-Length if it is already set
* does not set Content-Length on 304 responses
* does not set Content-Length when Transfer-Encoding is chunked
== Rack::ContentType
* sets Content-Type to default text/html if none is set
* sets Content-Type to chosen default if none is set
* does not change Content-Type if it is already set
* case insensitive detection of Content-Type
== Rack::Deflater
* should be able to deflate bodies that respond to each
* should be able to deflate String bodies
* should be able to gzip bodies that respond to each
* should be able to fallback to no deflation
* should be able to skip when there is no response entity body
* should handle the lack of an acceptable encoding
* should handle gzip response with Last-Modified header
* should do nothing when no-transform Cache-Control directive present
== Rack::Directory
* serves directory indices
* passes to app if file found
* serves uri with URL encoded filenames
* does not allow directory traversal
* 404s if it can't find the file
== Rack::Handler::FastCGI
* startup (empty)
* should respond
* should be a lighttpd
* should have rack headers
* should have CGI headers on GET
* should have CGI headers on POST
* should support HTTP auth
* should set status
* shutdown
== Rack::File
* serves files
* sets Last-Modified header
* serves files with URL encoded filenames
* does not allow directory traversal
* does not allow directory traversal with encoded periods
* 404s if it can't find the file
* detects SystemCallErrors
* returns bodies that respond to #to_path
== Rack::Handler
* has registered default handlers
* handler that doesn't exist should raise a NameError
* should get unregistered, but already required, handler by name
* should register custom handler
* should not need registration for properly coded handlers even if not already required
== Rack::Head
* response (empty)
* passes GET, POST, PUT, DELETE, OPTIONS, TRACE requests
* removes body from HEAD requests
== Rack::Lint
* passes valid request
* notices fatal errors
* notices environment errors
* notices input errors
* notices error errors
* notices status errors
* notices header errors
* notices content-type errors
* notices content-length errors
* notices body errors
* notices input handling errors
* notices error handling errors
* notices HEAD errors
* passes valid read calls
== Rack::Lint::InputWrapper
* delegates :size to underlying IO object
* delegates :rewind to underlying IO object
== Rack::Lobster::LambdaLobster
* should be a single lambda
* should look like a lobster
* should be flippable
== Rack::Lobster
* should look like a lobster
* should be flippable
* should provide crashing for testing purposes
== Rack::Lock
* should call synchronize on lock
* should set multithread flag to false
* should reset original multithread flag when exiting lock
== Rack::MethodOverride
* should not affect GET requests
* _method parameter should modify REQUEST_METHOD for POST requests
* X-HTTP-Method-Override header should modify REQUEST_METHOD for POST requests
* should not modify REQUEST_METHOD if the method is unknown
* should not modify REQUEST_METHOD when _method is nil
* should store the original REQUEST_METHOD prior to overriding
== Rack::MockRequest
* should return a MockResponse
* should be able to only return the environment
* should provide sensible defaults
* should allow GET/POST/PUT/DELETE
* should set content length
* should allow posting
* should use all parts of an URL
* should behave valid according to the Rack spec
== Rack::MockResponse
* should provide access to the HTTP status
* should provide access to the HTTP headers
* should provide access to the HTTP body
* should provide access to the Rack errors
* should optionally make Rack errors fatal
== Rack::Handler::Mongrel
* should respond
* should be a Mongrel
* should have rack headers
* should have CGI headers on GET
* should have CGI headers on POST
* should support HTTP auth
* should set status
* should provide a .run
* should provide a .run that maps a hash
* should provide a .run that maps a urlmap
* should provide a .run that maps a urlmap restricting by host
* should stream #each part of the response
== Rack::Recursive
* should allow for subrequests
* should raise error on requests not below the app
* should support forwarding
== Rack::Request
* wraps the rack variables
* can figure out the correct host
* can parse the query string
* can parse POST data
* can parse POST data with explicit content type
* does not parse POST data when media type is not form-data
* rewinds input after parsing POST data
* cleans up Safari's ajax POST body
* can get value by key from params with #[]
* can set value to key on params with #[]=
* values_at answers values by keys in order given
* referrer should be extracted correct
* can cache, but invalidates the cache
* can figure out if called via XHR
* can parse cookies
* parses cookies according to RFC 2109
* provides setters
* provides the original env
* can restore the URL
* can restore the full path
* can handle multiple media type parameters
* can parse multipart form data
* can parse big multipart form data
* can detect invalid multipart form data
* shouldn't try to interpret binary as utf8
* should work around buggy 1.8.* Tempfile equality
* does conform to the Rack spec
* should parse Accept-Encoding correctly
* should provide ip information
* should allow subclass request to be instantiated after parent request
* should allow parent request to be instantiated after subclass request
== Rack::Response
* has sensible default values
* can be written to
* can set and read headers
* can set cookies
* formats the Cookie expiration date accordingly to RFC 2109
* can set secure cookies
* can set http only cookies
* can delete cookies
* can do redirects
* has a useful constructor
* has a constructor that can take a block
* doesn't return invalid responses
* knows if it's empty
* should provide access to the HTTP status
* should provide access to the HTTP headers
* does not add or change Content-Length when #finish()ing
* updates Content-Length when body appended to using #write
== Rack::RewindableInput
=== given an IO object that is already rewindable
* should be able to handle to read()
* should be able to handle to read(nil)
* should be able to handle to read(length)
* should be able to handle to read(length, buffer)
* should be able to handle to read(nil, buffer)
* should rewind to the beginning when #rewind is called
* should be able to handle gets
* should be able to handle each
* should not buffer into a Tempfile if no data has been read yet
* should buffer into a Tempfile when data has been consumed for the first time
* should close the underlying tempfile upon calling #close
* should be possibel to call #close when no data has been buffered yet (empty)
* should be possible to call #close multiple times (empty)
=== given an IO object that is not rewindable
* should be able to handle to read()
* should be able to handle to read(nil)
* should be able to handle to read(length)
* should be able to handle to read(length, buffer)
* should be able to handle to read(nil, buffer)
* should rewind to the beginning when #rewind is called
* should be able to handle gets
* should be able to handle each
* should not buffer into a Tempfile if no data has been read yet
* should buffer into a Tempfile when data has been consumed for the first time
* should close the underlying tempfile upon calling #close
* should be possibel to call #close when no data has been buffered yet (empty)
* should be possible to call #close multiple times (empty)
=== given an IO object whose rewind method raises Errno::ESPIPE
* should be able to handle to read()
* should be able to handle to read(nil)
* should be able to handle to read(length)
* should be able to handle to read(length, buffer)
* should be able to handle to read(nil, buffer)
* should rewind to the beginning when #rewind is called
* should be able to handle gets
* should be able to handle each
* should not buffer into a Tempfile if no data has been read yet
* should buffer into a Tempfile when data has been consumed for the first time
* should close the underlying tempfile upon calling #close
* should be possibel to call #close when no data has been buffered yet (empty)
* should be possible to call #close multiple times (empty)
== Rack::Session::Cookie
* creates a new cookie
* loads from a cookie
* survives broken cookies
* barks on too big cookies
* creates a new cookie with integrity hash
* loads from a cookie wih integrity hash
* ignores tampered with session cookies
== Rack::Session::Memcache
* MemCache can connect to existing server (empty)
* faults on no connection
* creates a new cookie
* determines session from a cookie
* survives nonexistant cookies
* maintains freshness
* deletes cookies with :drop option
* provides new session id with :renew option
* omits cookie with :defer option
* multithread: should cleanly merge sessions (empty)
== Rack::Session::Pool
* creates a new cookie
* determines session from a cookie
* survives nonexistant cookies
* deletes cookies with :drop option
* provides new session id with :renew option
* omits cookie with :defer option
* multithread: should merge sessions (empty)
== Rack::ShowExceptions
* catches exceptions
== Rack::ShowStatus
* should provide a default status message
* should let the app provide additional information
* should not replace existing messages
* should pass on original headers
* should replace existing messages if there is detail
== Rack::Static
* serves files
* 404s if url root is known but it can't find the file
* calls down the chain if url root is not known
== Rack::Handler::Thin
* should respond
* should be a Thin
* should have rack headers
* should have CGI headers on GET
* should have CGI headers on POST
* should support HTTP auth
* should set status
== Rack::URLMap
* dispatches paths correctly
* dispatches hosts correctly
* should be nestable
* should route root apps correctly
== Rack::Utils
* should escape correctly
* should escape correctly for multibyte characters
* should unescape correctly
* should parse query strings correctly
* should parse nested query strings correctly
* should build query strings correctly
* should figure out which encodings are acceptable
* should return the bytesize of String
== Rack::Utils::HeaderHash
* should retain header case
* should check existence of keys case insensitively
* should merge case-insensitively
* should overwrite case insensitively and assume the new key's case
* should be converted to real Hash
* should convert Array values to Strings when converting to Hash
* should be able to delete the given key case-sensitively
* should be able to delete the given key case-insensitively
* should return the deleted value when #delete is called on an existing key
* should return nil when #delete is called on a non-existant key
== Rack::Utils::Context
* should set context correctly
* should alter app on recontexting
* should run different apps
== Rack::Utils::Multipart
* should return nil if content type is not multipart
* should parse multipart upload with text file
* should parse multipart upload with nested parameters
* should parse multipart upload with binary file
* should parse multipart upload with empty file
* should parse multipart upload with filename with semicolons
* should not include file params if no file was selected
* should parse IE multipart upload and clean up filename
* rewinds input after parsing upload
== Rack::Handler::WEBrick
* should respond
* should be a WEBrick
* should have rack headers
* should have CGI headers on GET
* should have CGI headers on POST
* should support HTTP auth
* should set status
* should correctly set cookies
* should provide a .run
335 specifications, 13 empty (1196 requirements), 0 failures

View file

@ -1,164 +0,0 @@
# Rakefile for Rack. -*-ruby-*-
require 'rake/rdoctask'
require 'rake/testtask'
desc "Run all the tests"
task :default => [:test]
desc "Make an archive as .tar.gz"
task :dist => [:chmod, :changelog, :rdoc, "SPEC", "rack.gemspec"] do
FileUtils.touch("RDOX")
sh "git archive --format=tar --prefix=#{release}/ HEAD^{tree} >#{release}.tar"
sh "pax -waf #{release}.tar -s ':^:#{release}/:' RDOX SPEC ChangeLog doc rack.gemspec"
sh "gzip -f -9 #{release}.tar"
end
desc "Make an official release"
task :officialrelease do
puts "Official build for #{release}..."
sh "rm -rf stage"
sh "git clone --shared . stage"
sh "cd stage && rake officialrelease_really"
sh "mv stage/#{release}.tar.gz stage/#{release}.gem ."
end
task :officialrelease_really => [:fulltest, "RDOX", "SPEC", :dist, :gem] do
sh "sha1sum #{release}.tar.gz #{release}.gem"
end
def version
abort "You need to pass VERSION=... to build packages." unless ENV["VERSION"]
ENV["VERSION"]
end
def release
"rack-#{version}"
end
def manifest
`git ls-files`.split("\n")
end
desc "Make binaries executable"
task :chmod do
Dir["bin/*"].each { |binary| File.chmod(0775, binary) }
Dir["test/cgi/test*"].each { |binary| File.chmod(0775, binary) }
end
desc "Generate a ChangeLog"
task :changelog do
File.open("ChangeLog", "w") { |out|
`git log -z`.split("\0").map { |chunk|
author = chunk[/Author: (.*)/, 1].strip
date = chunk[/Date: (.*)/, 1].strip
desc, detail = $'.strip.split("\n", 2)
detail ||= ""
detail = detail.gsub(/.*darcs-hash:.*/, '')
detail.rstrip!
out.puts "#{date} #{author}"
out.puts " * #{desc.strip}"
out.puts detail unless detail.empty?
out.puts
}
}
end
desc "Generate RDox"
task "RDOX" do
sh "specrb -Ilib:test -a --rdox >RDOX"
end
desc "Generate Rack Specification"
task "SPEC" do
File.open("SPEC", "wb") { |file|
IO.foreach("lib/rack/lint.rb") { |line|
if line =~ /## (.*)/
file.puts $1
end
}
}
end
desc "Run all the fast tests"
task :test do
sh "specrb -Ilib:test -w #{ENV['TEST'] || '-a'} #{ENV['TESTOPTS'] || '-t "^(?!Rack::Handler|Rack::Adapter|Rack::Session::Memcache|Rack::Auth::OpenID)"'}"
end
desc "Run all the tests"
task :fulltest => [:chmod] do
sh "specrb -Ilib:test -w #{ENV['TEST'] || '-a'} #{ENV['TESTOPTS']}"
end
begin
require 'rubygems'
rescue LoadError
# Too bad.
else
task "rack.gemspec" do
spec = Gem::Specification.new do |s|
s.name = "rack"
s.version = version
s.platform = Gem::Platform::RUBY
s.summary = "a modular Ruby webserver interface"
s.description = <<-EOF
Rack provides minimal, modular and adaptable interface for developing
web applications in Ruby. By wrapping HTTP requests and responses in
the simplest way possible, it unifies and distills the API for web
servers, web frameworks, and software in between (the so-called
middleware) into a single method call.
Also see http://rack.rubyforge.org.
EOF
s.files = manifest + %w(SPEC RDOX rack.gemspec)
s.bindir = 'bin'
s.executables << 'rackup'
s.require_path = 'lib'
s.has_rdoc = true
s.extra_rdoc_files = ['README', 'SPEC', 'RDOX', 'KNOWN-ISSUES']
s.test_files = Dir['test/{test,spec}_*.rb']
s.author = 'Christian Neukirchen'
s.email = 'chneukirchen@gmail.com'
s.homepage = 'http://rack.rubyforge.org'
s.rubyforge_project = 'rack'
s.add_development_dependency 'test-spec'
s.add_development_dependency 'camping'
s.add_development_dependency 'fcgi'
s.add_development_dependency 'memcache-client'
s.add_development_dependency 'mongrel'
s.add_development_dependency 'ruby-openid', '~> 2.0.0'
s.add_development_dependency 'thin'
end
File.open("rack.gemspec", "w") { |f| f << spec.to_ruby }
end
task :gem => ["rack.gemspec", "SPEC"] do
FileUtils.touch("RDOX")
sh "gem build rack.gemspec"
end
end
desc "Generate RDoc documentation"
task :rdoc do
sh(*%w{rdoc --line-numbers --main README
--title 'Rack\ Documentation' --charset utf-8 -U -o doc} +
%w{README KNOWN-ISSUES SPEC RDOX} +
Dir["lib/**/*.rb"])
end
task :pushsite => [:rdoc] do
sh "cd site && git gc"
sh "rsync -avz doc/ chneukirchen@rack.rubyforge.org:/var/www/gforge-projects/rack/doc/"
sh "rsync -avz site/ chneukirchen@rack.rubyforge.org:/var/www/gforge-projects/rack/"
sh "cd site && git push"
end

View file

@ -1,176 +0,0 @@
#!/usr/bin/env ruby
# -*- ruby -*-
$LOAD_PATH.unshift File.expand_path("#{__FILE__}/../../lib")
autoload :Rack, 'rack'
require 'optparse'
automatic = false
server = nil
env = "development"
daemonize = false
pid = nil
options = {:Port => 9292, :Host => "0.0.0.0", :AccessLog => []}
# Don't evaluate CGI ISINDEX parameters.
# http://hoohoo.ncsa.uiuc.edu/cgi/cl.html
ARGV.clear if ENV.include?("REQUEST_METHOD")
opts = OptionParser.new("", 24, ' ') { |opts|
opts.banner = "Usage: rackup [ruby options] [rack options] [rackup config]"
opts.separator ""
opts.separator "Ruby options:"
lineno = 1
opts.on("-e", "--eval LINE", "evaluate a LINE of code") { |line|
eval line, TOPLEVEL_BINDING, "-e", lineno
lineno += 1
}
opts.on("-d", "--debug", "set debugging flags (set $DEBUG to true)") {
$DEBUG = true
}
opts.on("-w", "--warn", "turn warnings on for your script") {
$-w = true
}
opts.on("-I", "--include PATH",
"specify $LOAD_PATH (may be used more than once)") { |path|
$LOAD_PATH.unshift(*path.split(":"))
}
opts.on("-r", "--require LIBRARY",
"require the library, before executing your script") { |library|
require library
}
opts.separator ""
opts.separator "Rack options:"
opts.on("-s", "--server SERVER", "serve using SERVER (webrick/mongrel)") { |s|
server = s
}
opts.on("-o", "--host HOST", "listen on HOST (default: 0.0.0.0)") { |host|
options[:Host] = host
}
opts.on("-p", "--port PORT", "use PORT (default: 9292)") { |port|
options[:Port] = port
}
opts.on("-E", "--env ENVIRONMENT", "use ENVIRONMENT for defaults (default: development)") { |e|
env = e
}
opts.on("-D", "--daemonize", "run daemonized in the background") { |d|
daemonize = d ? true : false
}
opts.on("-P", "--pid FILE", "file to store PID (default: rack.pid)") { |f|
pid = File.expand_path(f)
}
opts.separator ""
opts.separator "Common options:"
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
opts.on_tail("--version", "Show version") do
puts "Rack #{Rack.version}"
exit
end
opts.parse! ARGV
}
require 'pp' if $DEBUG
config = ARGV[0] || "config.ru"
if !File.exist? config
abort "configuration #{config} not found"
end
if config =~ /\.ru$/
cfgfile = File.read(config)
if cfgfile[/^#\\(.*)/]
opts.parse! $1.split(/\s+/)
end
inner_app = eval "Rack::Builder.new {( " + cfgfile + "\n )}.to_app",
nil, config
else
require config
inner_app = Object.const_get(File.basename(config, '.rb').capitalize)
end
unless server = Rack::Handler.get(server)
# Guess.
if ENV.include?("PHP_FCGI_CHILDREN")
server = Rack::Handler::FastCGI
# We already speak FastCGI
options.delete :File
options.delete :Port
elsif ENV.include?("REQUEST_METHOD")
server = Rack::Handler::CGI
else
begin
server = Rack::Handler::Mongrel
rescue LoadError => e
server = Rack::Handler::WEBrick
end
end
end
p server if $DEBUG
case env
when "development"
app = Rack::Builder.new {
use Rack::CommonLogger, $stderr unless server.name =~ /CGI/
use Rack::ShowExceptions
use Rack::Lint
run inner_app
}.to_app
when "deployment"
app = Rack::Builder.new {
use Rack::CommonLogger, $stderr unless server.name =~ /CGI/
run inner_app
}.to_app
when "none"
app = inner_app
end
if $DEBUG
pp app
pp inner_app
end
if daemonize
if RUBY_VERSION < "1.9"
exit if fork
Process.setsid
exit if fork
Dir.chdir "/"
File.umask 0000
STDIN.reopen "/dev/null"
STDOUT.reopen "/dev/null", "a"
STDERR.reopen "/dev/null", "a"
else
Process.daemon
end
if pid
File.open(pid, 'w'){ |f| f.write("#{Process.pid}") }
at_exit { File.delete(pid) if File.exist?(pid) }
end
end
server.run app, options

View file

@ -1,480 +0,0 @@
# AUTHOR: blink <blinketje@gmail.com>; blink#ruby-lang@irc.freenode.net
gem 'ruby-openid', '~> 2' if defined? Gem
require 'rack/request'
require 'rack/utils'
require 'rack/auth/abstract/handler'
require 'uri'
require 'openid' #gem
require 'openid/extension' #gem
require 'openid/store/memory' #gem
module Rack
class Request
def openid_request
@env['rack.auth.openid.request']
end
def openid_response
@env['rack.auth.openid.response']
end
end
module Auth
# Rack::Auth::OpenID provides a simple method for setting up an OpenID
# Consumer. It requires the ruby-openid library from janrain to operate,
# as well as a rack method of session management.
#
# The ruby-openid home page is at http://openidenabled.com/ruby-openid/.
#
# The OpenID specifications can be found at
# http://openid.net/specs/openid-authentication-1_1.html
# and
# http://openid.net/specs/openid-authentication-2_0.html. Documentation
# for published OpenID extensions and related topics can be found at
# http://openid.net/developers/specs/.
#
# It is recommended to read through the OpenID spec, as well as
# ruby-openid's documentation, to understand what exactly goes on. However
# a setup as simple as the presented examples is enough to provide
# Consumer functionality.
#
# This library strongly intends to utilize the OpenID 2.0 features of the
# ruby-openid library, which provides OpenID 1.0 compatiblity.
#
# NOTE: Due to the amount of data that this library stores in the
# session, Rack::Session::Cookie may fault.
class OpenID
class NoSession < RuntimeError; end
class BadExtension < RuntimeError; end
# Required for ruby-openid
ValidStatus = [:success, :setup_needed, :cancel, :failure]
# = Arguments
#
# The first argument is the realm, identifying the site they are trusting
# with their identity. This is required, also treated as the trust_root
# in OpenID 1.x exchanges.
#
# The optional second argument is a hash of options.
#
# == Options
#
# <tt>:return_to</tt> defines the url to return to after the client
# authenticates with the openid service provider. This url should point
# to where Rack::Auth::OpenID is mounted. If <tt>:return_to</tt> is not
# provided, return_to will be the current url which allows flexibility
# with caveats.
#
# <tt>:session_key</tt> defines the key to the session hash in the env.
# It defaults to 'rack.session'.
#
# <tt>:openid_param</tt> defines at what key in the request parameters to
# find the identifier to resolve. As per the 2.0 spec, the default is
# 'openid_identifier'.
#
# <tt>:store</tt> defined what OpenID Store to use for persistant
# information. By default a Store::Memory will be used.
#
# <tt>:immediate</tt> as true will make initial requests to be of an
# immediate type. This is false by default. See OpenID specification
# documentation.
#
# <tt>:extensions</tt> should be a hash of openid extension
# implementations. The key should be the extension main module, the value
# should be an array of arguments for extension::Request.new.
# The hash is iterated over and passed to #add_extension for processing.
# Please see #add_extension for further documentation.
#
# == Examples
#
# simple_oid = OpenID.new('http://mysite.com/')
#
# return_oid = OpenID.new('http://mysite.com/', {
# :return_to => 'http://mysite.com/openid'
# })
#
# complex_oid = OpenID.new('http://mysite.com/',
# :immediate => true,
# :extensions => {
# ::OpenID::SReg => [['email'],['nickname']]
# }
# )
#
# = Advanced
#
# Most of the functionality of this library is encapsulated such that
# expansion and overriding functions isn't difficult nor tricky.
# Alternately, to avoid opening up singleton objects or subclassing, a
# wrapper rack middleware can be composed to act upon Auth::OpenID's
# responses. See #check and #finish for locations of pertinent data.
#
# == Responses
#
# To change the responses that Auth::OpenID returns, override the methods
# #redirect, #bad_request, #unauthorized, #access_denied, and
# #foreign_server_failure.
#
# Additionally #confirm_post_params is used when the URI would exceed
# length limits on a GET request when doing the initial verification
# request.
#
# == Processing
#
# To change methods of processing completed transactions, override the
# methods #success, #setup_needed, #cancel, and #failure. Please ensure
# the returned object is a rack compatible response.
#
# The first argument is an OpenID::Response, the second is a
# Rack::Request of the current request, the last is the hash used in
# ruby-openid handling, which can be found manually at
# env['rack.session'][:openid].
#
# This is useful if you wanted to expand the processing done, such as
# setting up user accounts.
#
# oid_app = Rack::Auth::OpenID.new realm, :return_to => return_to
# def oid_app.success oid, request, session
# user = Models::User[oid.identity_url]
# user ||= Models::User.create_from_openid oid
# request['rack.session'][:user] = user.id
# redirect MyApp.site_home
# end
#
# site_map['/openid'] = oid_app
# map = Rack::URLMap.new site_map
# ...
def initialize(realm, options={})
realm = URI(realm)
raise ArgumentError, "Invalid realm: #{realm}" \
unless realm.absolute? \
and realm.fragment.nil? \
and realm.scheme =~ /^https?$/ \
and realm.host =~ /^(\*\.)?#{URI::REGEXP::PATTERN::URIC_NO_SLASH}+/
realm.path = '/' if realm.path.empty?
@realm = realm.to_s
if ruri = options[:return_to]
ruri = URI(ruri)
raise ArgumentError, "Invalid return_to: #{ruri}" \
unless ruri.absolute? \
and ruri.scheme =~ /^https?$/ \
and ruri.fragment.nil?
raise ArgumentError, "return_to #{ruri} not within realm #{realm}" \
unless self.within_realm?(ruri)
@return_to = ruri.to_s
end
@session_key = options[:session_key] || 'rack.session'
@openid_param = options[:openid_param] || 'openid_identifier'
@store = options[:store] || ::OpenID::Store::Memory.new
@immediate = !!options[:immediate]
@extensions = {}
if extensions = options.delete(:extensions)
extensions.each do |ext, args|
add_extension ext, *args
end
end
# Undocumented, semi-experimental
@anonymous = !!options[:anonymous]
end
attr_reader :realm, :return_to, :session_key, :openid_param, :store,
:immediate, :extensions
# Sets up and uses session data at <tt>:openid</tt> within the session.
# Errors in this setup will raise a NoSession exception.
#
# If the parameter 'openid.mode' is set, which implies a followup from
# the openid server, processing is passed to #finish and the result is
# returned. However, if there is no appropriate openid information in the
# session, a 400 error is returned.
#
# If the parameter specified by <tt>options[:openid_param]</tt> is
# present, processing is passed to #check and the result is returned.
#
# If neither of these conditions are met, #unauthorized is called.
def call(env)
env['rack.auth.openid'] = self
env_session = env[@session_key]
unless env_session and env_session.is_a?(Hash)
raise NoSession, 'No compatible session'
end
# let us work in our own namespace...
session = (env_session[:openid] ||= {})
unless session and session.is_a?(Hash)
raise NoSession, 'Incompatible openid session'
end
request = Rack::Request.new(env)
consumer = ::OpenID::Consumer.new(session, @store)
if mode = request.GET['openid.mode']
if session.key?(:openid_param)
finish(consumer, session, request)
else
bad_request
end
elsif request.GET[@openid_param]
check(consumer, session, request)
else
unauthorized
end
end
# As the first part of OpenID consumer action, #check retrieves the data
# required for completion.
#
# If all parameters fit within the max length of a URI, a 303 redirect
# will be returned. Otherwise #confirm_post_params will be called.
#
# Any messages from OpenID's request are logged to env['rack.errors']
#
# <tt>env['rack.auth.openid.request']</tt> is the openid checkid request
# instance.
#
# <tt>session[:openid_param]</tt> is set to the openid identifier
# provided by the user.
#
# <tt>session[:return_to]</tt> is set to the return_to uri given to the
# identity provider.
def check(consumer, session, req)
oid = consumer.begin(req.GET[@openid_param], @anonymous)
req.env['rack.auth.openid.request'] = oid
req.env['rack.errors'].puts(oid.message)
p oid if $DEBUG
## Extension support
extensions.each do |ext,args|
oid.add_extension(ext::Request.new(*args))
end
session[:openid_param] = req.GET[openid_param]
return_to_uri = return_to ? return_to : req.url
session[:return_to] = return_to_uri
immediate = session.key?(:setup_needed) ? false : immediate
if oid.send_redirect?(realm, return_to_uri, immediate)
uri = oid.redirect_url(realm, return_to_uri, immediate)
redirect(uri)
else
confirm_post_params(oid, realm, return_to_uri, immediate)
end
rescue ::OpenID::DiscoveryFailure => e
# thrown from inside OpenID::Consumer#begin by yadis stuff
req.env['rack.errors'].puts([e.message, *e.backtrace]*"\n")
return foreign_server_failure
end
# This is the final portion of authentication.
# If successful, a redirect to the realm is be returned.
# Data gathered from extensions are stored in session[:openid] with the
# extension's namespace uri as the key.
#
# Any messages from OpenID's response are logged to env['rack.errors']
#
# <tt>env['rack.auth.openid.response']</tt> will contain the openid
# response.
def finish(consumer, session, req)
oid = consumer.complete(req.GET, req.url)
req.env['rack.auth.openid.response'] = oid
req.env['rack.errors'].puts(oid.message)
p oid if $DEBUG
raise unless ValidStatus.include?(oid.status)
__send__(oid.status, oid, req, session)
end
# The first argument should be the main extension module.
# The extension module should contain the constants:
# * class Request, should have OpenID::Extension as an ancestor
# * class Response, should have OpenID::Extension as an ancestor
# * string NS_URI, which defining the namespace of the extension
#
# All trailing arguments will be passed to extension::Request.new in
# #check.
# The openid response will be passed to
# extension::Response#from_success_response, #get_extension_args will be
# called on the result to attain the gathered data.
#
# This method returns the key at which the response data will be found in
# the session, which is the namespace uri by default.
def add_extension(ext, *args)
raise BadExtension unless valid_extension?(ext)
extensions[ext] = args
return ext::NS_URI
end
# Checks the validitity, in the context of usage, of a submitted
# extension.
def valid_extension?(ext)
if not %w[NS_URI Request Response].all?{|c| ext.const_defined?(c) }
raise ArgumentError, 'Extension is missing constants.'
elsif not ext::Response.respond_to?(:from_success_response)
raise ArgumentError, 'Response is missing required method.'
end
return true
rescue
return false
end
# Checks the provided uri to ensure it'd be considered within the realm.
# is currently not compatible with wildcard realms.
def within_realm? uri
uri = URI.parse(uri.to_s)
realm = URI.parse(self.realm)
return false unless uri.absolute?
return false unless uri.path[0, realm.path.size] == realm.path
return false unless uri.host == realm.host or realm.host[/^\*\./]
# for wildcard support, is awkward with URI limitations
realm_match = Regexp.escape(realm.host).
sub(/^\*\./,"^#{URI::REGEXP::PATTERN::URIC_NO_SLASH}+.")+'$'
return false unless uri.host.match(realm_match)
return true
end
alias_method :include?, :within_realm?
protected
### These methods define some of the boilerplate responses.
# Returns an html form page for posting to an Identity Provider if the
# GET request would exceed the upper URI length limit.
def confirm_post_params(oid, realm, return_to, immediate)
Rack::Response.new.finish do |r|
r.write '<html><head><title>Confirm...</title></head><body>'
r.write oid.form_markup(realm, return_to, immediate)
r.write '</body></html>'
end
end
# Returns a 303 redirect with the destination of that provided by the
# argument.
def redirect(uri)
[ 303, {'Content-Length'=>'0', 'Content-Type'=>'text/plain',
'Location' => uri},
[] ]
end
# Returns an empty 400 response.
def bad_request
[ 400, {'Content-Type'=>'text/plain', 'Content-Length'=>'0'},
[''] ]
end
# Returns a basic unauthorized 401 response.
def unauthorized
[ 401, {'Content-Type' => 'text/plain', 'Content-Length' => '13'},
['Unauthorized.'] ]
end
# Returns a basic access denied 403 response.
def access_denied
[ 403, {'Content-Type' => 'text/plain', 'Content-Length' => '14'},
['Access denied.'] ]
end
# Returns a 503 response to be used if communication with the remote
# OpenID server fails.
def foreign_server_failure
[ 503, {'Content-Type'=>'text/plain', 'Content-Length' => '23'},
['Foreign server failure.'] ]
end
private
### These methods are called after a transaction is completed, depending
# on its outcome. These should all return a rack compatible response.
# You'd want to override these to provide additional functionality.
# Called to complete processing on a successful transaction.
# Within the openid session, :openid_identity and :openid_identifier are
# set to the user friendly and the standard representation of the
# validated identity. All other data in the openid session is cleared.
def success(oid, request, session)
session.clear
session[:openid_identity] = oid.display_identifier
session[:openid_identifier] = oid.identity_url
extensions.keys.each do |ext|
label = ext.name[/[^:]+$/].downcase
response = ext::Response.from_success_response(oid)
session[label] = response.data
end
redirect(realm)
end
# Called if the Identity Provider indicates further setup by the user is
# required.
# The identifier is retrived from the openid session at :openid_param.
# And :setup_needed is set to true to prevent looping.
def setup_needed(oid, request, session)
identifier = session[:openid_param]
session[:setup_needed] = true
redirect req.script_name + '?' + openid_param + '=' + identifier
end
# Called if the user indicates they wish to cancel identification.
# Data within openid session is cleared.
def cancel(oid, request, session)
session.clear
access_denied
end
# Called if the Identity Provider indicates the user is unable to confirm
# their identity. Data within the openid session is left alone, in case
# of swarm auth attacks.
def failure(oid, request, session)
unauthorized
end
end
# A class developed out of the request to use OpenID as an authentication
# middleware. The request will be sent to the OpenID instance unless the
# block evaluates to true. For example in rackup, you can use it as such:
#
# use Rack::Session::Pool
# use Rack::Auth::OpenIDAuth, realm, openid_options do |env|
# env['rack.session'][:authkey] == a_string
# end
# run RackApp
#
# Or simply:
#
# app = Rack::Auth::OpenIDAuth.new app, realm, openid_options, &auth
class OpenIDAuth < Rack::Auth::AbstractHandler
attr_reader :oid
def initialize(app, realm, options={}, &auth)
@oid = OpenID.new(realm, options)
super(app, &auth)
end
def call(env)
to = auth.call(env) ? @app : @oid
to.call env
end
end
end
end

View file

@ -1,61 +0,0 @@
module Rack
# Rack::CommonLogger forwards every request to an +app+ given, and
# logs a line in the Apache common log format to the +logger+, or
# rack.errors by default.
class CommonLogger
def initialize(app, logger=nil)
@app = app
@logger = logger
end
def call(env)
dup._call(env)
end
def _call(env)
@env = env
@logger ||= self
@time = Time.now
@status, @header, @body = @app.call(env)
[@status, @header, self]
end
def close
@body.close if @body.respond_to? :close
end
# By default, log to rack.errors.
def <<(str)
@env["rack.errors"].write(str)
@env["rack.errors"].flush
end
def each
length = 0
@body.each { |part|
length += part.size
yield part
}
@now = Time.now
# Common Log Format: http://httpd.apache.org/docs/1.3/logs.html#common
# lilith.local - - [07/Aug/2006 23:58:02] "GET / HTTP/1.1" 500 -
# %{%s - %s [%s] "%s %s%s %s" %d %s\n} %
@logger << %{%s - %s [%s] "%s %s%s %s" %d %s %0.4f\n} %
[
@env['HTTP_X_FORWARDED_FOR'] || @env["REMOTE_ADDR"] || "-",
@env["REMOTE_USER"] || "-",
@now.strftime("%d/%b/%Y %H:%M:%S"),
@env["REQUEST_METHOD"],
@env["PATH_INFO"],
@env["QUERY_STRING"].empty? ? "" : "?"+@env["QUERY_STRING"],
@env["HTTP_VERSION"],
@status.to_s[0..3],
(length.zero? ? "-" : length.to_s),
@now - @time
]
end
end
end

View file

@ -1,109 +0,0 @@
# AUTHOR: blink <blinketje@gmail.com>; blink#ruby-lang@irc.freenode.net
require 'rack/session/abstract/id'
require 'memcache'
module Rack
module Session
# Rack::Session::Memcache provides simple cookie based session management.
# Session data is stored in memcached. The corresponding session key is
# maintained in the cookie.
# You may treat Session::Memcache as you would Session::Pool with the
# following caveats.
#
# * Setting :expire_after to 0 would note to the Memcache server to hang
# onto the session data until it would drop it according to it's own
# specifications. However, the cookie sent to the client would expire
# immediately.
#
# Note that memcache does drop data before it may be listed to expire. For
# a full description of behaviour, please see memcache's documentation.
class Memcache < Abstract::ID
attr_reader :mutex, :pool
DEFAULT_OPTIONS = Abstract::ID::DEFAULT_OPTIONS.merge \
:namespace => 'rack:session',
:memcache_server => 'localhost:11211'
def initialize(app, options={})
super
@mutex = Mutex.new
@pool = MemCache.
new @default_options[:memcache_server], @default_options
raise 'No memcache servers' unless @pool.servers.any?{|s|s.alive?}
end
def generate_sid
loop do
sid = super
break sid unless @pool.get(sid, true)
end
end
def get_session(env, sid)
session = @pool.get(sid) if sid
@mutex.lock if env['rack.multithread']
unless sid and session
env['rack.errors'].puts("Session '#{sid.inspect}' not found, initializing...") if $VERBOSE and not sid.nil?
session = {}
sid = generate_sid
ret = @pool.add sid, session
raise "Session collision on '#{sid.inspect}'" unless /^STORED/ =~ ret
end
session.instance_variable_set('@old', {}.merge(session))
return [sid, session]
rescue MemCache::MemCacheError, Errno::ECONNREFUSED # MemCache server cannot be contacted
warn "#{self} is unable to find server."
warn $!.inspect
return [ nil, {} ]
ensure
@mutex.unlock if env['rack.multithread']
end
def set_session(env, session_id, new_session, options)
expiry = options[:expire_after]
expiry = expiry.nil? ? 0 : expiry + 1
@mutex.lock if env['rack.multithread']
session = @pool.get(session_id) || {}
if options[:renew] or options[:drop]
@pool.delete session_id
return false if options[:drop]
session_id = generate_sid
@pool.add session_id, 0 # so we don't worry about cache miss on #set
end
old_session = new_session.instance_variable_get('@old') || {}
session = merge_sessions session_id, old_session, new_session, session
@pool.set session_id, session, expiry
return session_id
rescue MemCache::MemCacheError, Errno::ECONNREFUSED # MemCache server cannot be contacted
warn "#{self} is unable to find server."
warn $!.inspect
return false
ensure
@mutex.unlock if env['rack.multithread']
end
private
def merge_sessions sid, old, new, cur=nil
cur ||= {}
unless Hash === old and Hash === new
warn 'Bad old or new sessions provided.'
return cur
end
delete = old.keys - new.keys
warn "//@#{sid}: delete #{delete*','}" if $VERBOSE and not delete.empty?
delete.each{|k| cur.delete k }
update = new.keys.select{|k| new[k] != old[k] }
warn "//@#{sid}: update #{update*','}" if $VERBOSE and not update.empty?
update.each{|k| cur[k] = new[k] }
cur
end
end
end
end

View file

@ -1,54 +0,0 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{rack}
s.version = "1.0.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Christian Neukirchen"]
s.date = %q{2009-10-18}
s.default_executable = %q{rackup}
s.description = %q{Rack provides minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call. Also see http://rack.rubyforge.org.}
s.email = %q{chneukirchen@gmail.com}
s.executables = ["rackup"]
s.extra_rdoc_files = ["README", "SPEC", "RDOX", "KNOWN-ISSUES"]
s.files = ["COPYING", "KNOWN-ISSUES", "README", "Rakefile", "bin/rackup", "contrib/rack_logo.svg", "example/lobster.ru", "example/protectedlobster.rb", "example/protectedlobster.ru", "lib/rack.rb", "lib/rack/adapter/camping.rb", "lib/rack/auth/abstract/handler.rb", "lib/rack/auth/abstract/request.rb", "lib/rack/auth/basic.rb", "lib/rack/auth/digest/md5.rb", "lib/rack/auth/digest/nonce.rb", "lib/rack/auth/digest/params.rb", "lib/rack/auth/digest/request.rb", "lib/rack/auth/openid.rb", "lib/rack/builder.rb", "lib/rack/cascade.rb", "lib/rack/chunked.rb", "lib/rack/commonlogger.rb", "lib/rack/conditionalget.rb", "lib/rack/content_length.rb", "lib/rack/content_type.rb", "lib/rack/deflater.rb", "lib/rack/directory.rb", "lib/rack/file.rb", "lib/rack/handler.rb", "lib/rack/handler/cgi.rb", "lib/rack/handler/evented_mongrel.rb", "lib/rack/handler/fastcgi.rb", "lib/rack/handler/lsws.rb", "lib/rack/handler/mongrel.rb", "lib/rack/handler/scgi.rb", "lib/rack/handler/swiftiplied_mongrel.rb", "lib/rack/handler/thin.rb", "lib/rack/handler/webrick.rb", "lib/rack/head.rb", "lib/rack/lint.rb", "lib/rack/lobster.rb", "lib/rack/lock.rb", "lib/rack/methodoverride.rb", "lib/rack/mime.rb", "lib/rack/mock.rb", "lib/rack/recursive.rb", "lib/rack/reloader.rb", "lib/rack/request.rb", "lib/rack/response.rb", "lib/rack/rewindable_input.rb", "lib/rack/session/abstract/id.rb", "lib/rack/session/cookie.rb", "lib/rack/session/memcache.rb", "lib/rack/session/pool.rb", "lib/rack/showexceptions.rb", "lib/rack/showstatus.rb", "lib/rack/static.rb", "lib/rack/urlmap.rb", "lib/rack/utils.rb", "test/cgi/lighttpd.conf", "test/cgi/test", "test/cgi/test.fcgi", "test/cgi/test.ru", "test/multipart/binary", "test/multipart/empty", "test/multipart/ie", "test/multipart/nested", "test/multipart/none", "test/multipart/semicolon", "test/multipart/text", "test/spec_rack_auth_basic.rb", "test/spec_rack_auth_digest.rb", "test/spec_rack_auth_openid.rb", "test/spec_rack_builder.rb", "test/spec_rack_camping.rb", "test/spec_rack_cascade.rb", "test/spec_rack_cgi.rb", "test/spec_rack_chunked.rb", "test/spec_rack_commonlogger.rb", "test/spec_rack_conditionalget.rb", "test/spec_rack_content_length.rb", "test/spec_rack_content_type.rb", "test/spec_rack_deflater.rb", "test/spec_rack_directory.rb", "test/spec_rack_fastcgi.rb", "test/spec_rack_file.rb", "test/spec_rack_handler.rb", "test/spec_rack_head.rb", "test/spec_rack_lint.rb", "test/spec_rack_lobster.rb", "test/spec_rack_lock.rb", "test/spec_rack_methodoverride.rb", "test/spec_rack_mock.rb", "test/spec_rack_mongrel.rb", "test/spec_rack_recursive.rb", "test/spec_rack_request.rb", "test/spec_rack_response.rb", "test/spec_rack_rewindable_input.rb", "test/spec_rack_session_cookie.rb", "test/spec_rack_session_memcache.rb", "test/spec_rack_session_pool.rb", "test/spec_rack_showexceptions.rb", "test/spec_rack_showstatus.rb", "test/spec_rack_static.rb", "test/spec_rack_thin.rb", "test/spec_rack_urlmap.rb", "test/spec_rack_utils.rb", "test/spec_rack_webrick.rb", "test/testrequest.rb", "test/unregistered_handler/rack/handler/unregistered.rb", "test/unregistered_handler/rack/handler/unregistered_long_one.rb", "SPEC", "RDOX", "rack.gemspec"]
s.has_rdoc = true
s.homepage = %q{http://rack.rubyforge.org}
s.require_paths = ["lib"]
s.rubyforge_project = %q{rack}
s.rubygems_version = %q{1.3.1}
s.summary = %q{a modular Ruby webserver interface}
s.test_files = ["test/spec_rack_auth_basic.rb", "test/spec_rack_auth_digest.rb", "test/spec_rack_auth_openid.rb", "test/spec_rack_builder.rb", "test/spec_rack_camping.rb", "test/spec_rack_cascade.rb", "test/spec_rack_cgi.rb", "test/spec_rack_chunked.rb", "test/spec_rack_commonlogger.rb", "test/spec_rack_conditionalget.rb", "test/spec_rack_content_length.rb", "test/spec_rack_content_type.rb", "test/spec_rack_deflater.rb", "test/spec_rack_directory.rb", "test/spec_rack_fastcgi.rb", "test/spec_rack_file.rb", "test/spec_rack_handler.rb", "test/spec_rack_head.rb", "test/spec_rack_lint.rb", "test/spec_rack_lobster.rb", "test/spec_rack_lock.rb", "test/spec_rack_methodoverride.rb", "test/spec_rack_mock.rb", "test/spec_rack_mongrel.rb", "test/spec_rack_recursive.rb", "test/spec_rack_request.rb", "test/spec_rack_response.rb", "test/spec_rack_rewindable_input.rb", "test/spec_rack_session_cookie.rb", "test/spec_rack_session_memcache.rb", "test/spec_rack_session_pool.rb", "test/spec_rack_showexceptions.rb", "test/spec_rack_showstatus.rb", "test/spec_rack_static.rb", "test/spec_rack_thin.rb", "test/spec_rack_urlmap.rb", "test/spec_rack_utils.rb", "test/spec_rack_webrick.rb"]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<test-spec>, [">= 0"])
s.add_development_dependency(%q<camping>, [">= 0"])
s.add_development_dependency(%q<fcgi>, [">= 0"])
s.add_development_dependency(%q<memcache-client>, [">= 0"])
s.add_development_dependency(%q<mongrel>, [">= 0"])
s.add_development_dependency(%q<ruby-openid>, ["~> 2.0.0"])
s.add_development_dependency(%q<thin>, [">= 0"])
else
s.add_dependency(%q<test-spec>, [">= 0"])
s.add_dependency(%q<camping>, [">= 0"])
s.add_dependency(%q<fcgi>, [">= 0"])
s.add_dependency(%q<memcache-client>, [">= 0"])
s.add_dependency(%q<mongrel>, [">= 0"])
s.add_dependency(%q<ruby-openid>, ["~> 2.0.0"])
s.add_dependency(%q<thin>, [">= 0"])
end
else
s.add_dependency(%q<test-spec>, [">= 0"])
s.add_dependency(%q<camping>, [">= 0"])
s.add_dependency(%q<fcgi>, [">= 0"])
s.add_dependency(%q<memcache-client>, [">= 0"])
s.add_dependency(%q<mongrel>, [">= 0"])
s.add_dependency(%q<ruby-openid>, ["~> 2.0.0"])
s.add_dependency(%q<thin>, [">= 0"])
end
end

View file

@ -1,20 +0,0 @@
server.modules = ("mod_fastcgi", "mod_cgi")
server.document-root = "."
server.errorlog = "lighttpd.errors"
server.port = 9203
server.event-handler = "select"
cgi.assign = ("/test" => "",
# ".ru" => ""
)
fastcgi.server = ("test.fcgi" => ("localhost" =>
("min-procs" => 1,
"socket" => "/tmp/rack-test-fcgi",
"bin-path" => "test.fcgi")),
"test.ru" => ("localhost" =>
("min-procs" => 1,
"socket" => "/tmp/rack-test-ru-fcgi",
"bin-path" => "test.ru")),
)

View file

@ -1,9 +0,0 @@
#!/usr/bin/env ruby
# -*- ruby -*-
$: << File.join(File.dirname(__FILE__), "..", "..", "lib")
require 'rack'
require '../testrequest'
Rack::Handler::CGI.run(Rack::Lint.new(TestRequest.new))

View file

@ -1,8 +0,0 @@
#!/usr/bin/env ruby
# -*- ruby -*-
$:.unshift '../../lib'
require 'rack'
require '../testrequest'
Rack::Handler::FastCGI.run(Rack::Lint.new(TestRequest.new))

View file

@ -1,7 +0,0 @@
#!/usr/bin/env ../../bin/rackup
#\ -E deployment -I ../../lib
# -*- ruby -*-
require '../testrequest'
run TestRequest.new

View file

@ -1,10 +0,0 @@
--AaB03x
Content-Disposition: form-data; name="submit-name"
Larry
--AaB03x
Content-Disposition: form-data; name="files"; filename="file1.txt"
Content-Type: text/plain
--AaB03x--

View file

@ -1,6 +0,0 @@
--AaB03x
Content-Disposition: form-data; name="files"; filename="C:\Documents and Settings\Administrator\Desktop\file1.txt"
Content-Type: text/plain
contents
--AaB03x--

View file

@ -1,10 +0,0 @@
--AaB03x
Content-Disposition: form-data; name="foo[submit-name]"
Larry
--AaB03x
Content-Disposition: form-data; name="foo[files]"; filename="file1.txt"
Content-Type: text/plain
contents
--AaB03x--

View file

@ -1,9 +0,0 @@
--AaB03x
Content-Disposition: form-data; name="submit-name"
Larry
--AaB03x
Content-Disposition: form-data; name="files"; filename=""
--AaB03x--

View file

@ -1,6 +0,0 @@
--AaB03x
Content-Disposition: form-data; name="files"; filename="fi;le1.txt"
Content-Type: text/plain
contents
--AaB03x--

View file

@ -1,10 +0,0 @@
--AaB03x
Content-Disposition: form-data; name="submit-name"
Larry
--AaB03x
Content-Disposition: form-data; name="files"; filename="file1.txt"
Content-Type: text/plain
contents
--AaB03x--

View file

@ -1,84 +0,0 @@
require 'test/spec'
begin
# requires the ruby-openid gem
require 'rack/auth/openid'
context "Rack::Auth::OpenID" do
OID = Rack::Auth::OpenID
host = 'host'
subd = 'sub.host'
wild = '*.host'
path = 'path'
long = 'path/long'
scheme = 'http://'
realm = scheme+host+'/'+path
specify 'realm uri should be valid' do
lambda{OID.new('/'+path)}.should.raise ArgumentError
lambda{OID.new('/'+long)}.should.raise ArgumentError
lambda{OID.new(scheme+host)}.should.not.raise
lambda{OID.new(scheme+host+'/')}.should.not.raise
lambda{OID.new(scheme+host+'/'+path)}.should.not.raise
lambda{OID.new(scheme+subd)}.should.not.raise
lambda{OID.new(scheme+subd+'/')}.should.not.raise
lambda{OID.new(scheme+subd+'/'+path)}.should.not.raise
end
specify 'should be able to check if a uri is within the realm' do
end
specify 'return_to should be valid' do
uri = '/'+path
lambda{OID.new(realm, :return_to=>uri)}.should.raise ArgumentError
uri = '/'+long
lambda{OID.new(realm, :return_to=>uri)}.should.raise ArgumentError
uri = scheme+host
lambda{OID.new(realm, :return_to=>uri)}.should.raise ArgumentError
uri = scheme+host+'/'+path
lambda{OID.new(realm, :return_to=>uri)}.should.not.raise
uri = scheme+subd+'/'+path
lambda{OID.new(realm, :return_to=>uri)}.should.raise ArgumentError
uri = scheme+host+'/'+long
lambda{OID.new(realm, :return_to=>uri)}.should.not.raise
uri = scheme+subd+'/'+long
lambda{OID.new(realm, :return_to=>uri)}.should.raise ArgumentError
end
specify 'extensions should have required constants defined' do
badext = Rack::Auth::OpenID::BadExtension
ext = Object.new
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
ext = Module.new
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
ext::Request = nil
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
ext::Response = nil
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
ext::NS_URI = nil
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
end
specify 'extensions should have Request and Response defined and inherit from OpenID::Extension' do
$-w, w = nil, $-w # yuck
badext = Rack::Auth::OpenID::BadExtension
ext = Module.new
ext::Request = nil
ext::Response = nil
ext::NS_URI = nil
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
ext::Request = Class.new()
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
ext::Response = Class.new()
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
ext::Request = Class.new(::OpenID::Extension)
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
ext::Response = Class.new(::OpenID::Extension)
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
$-w = w
end
end
rescue LoadError
$stderr.puts "Skipping Rack::Auth::OpenID tests (ruby-openid 2 is required). `gem install ruby-openid` and try again."
end

View file

@ -1,32 +0,0 @@
require 'test/spec'
require 'stringio'
require 'rack/commonlogger'
require 'rack/lobster'
require 'rack/mock'
context "Rack::CommonLogger" do
app = lambda { |env|
[200,
{"Content-Type" => "text/html"},
["foo"]]}
specify "should log to rack.errors by default" do
log = StringIO.new
res = Rack::MockRequest.new(Rack::CommonLogger.new(app)).get("/")
res.errors.should.not.be.empty
res.errors.should =~ /GET /
res.errors.should =~ / 200 / # status
res.errors.should =~ / 3 / # length
end
specify "should log to anything with <<" do
log = ""
res = Rack::MockRequest.new(Rack::CommonLogger.new(app, log)).get("/")
log.should =~ /GET /
log.should =~ / 200 / # status
log.should =~ / 3 / # length
end
end

View file

@ -1,57 +0,0 @@
require 'yaml'
require 'net/http'
class TestRequest
def call(env)
status = env["QUERY_STRING"] =~ /secret/ ? 403 : 200
env["test.postdata"] = env["rack.input"].read
body = env.to_yaml
size = body.respond_to?(:bytesize) ? body.bytesize : body.size
[status, {"Content-Type" => "text/yaml", "Content-Length" => size.to_s}, [body]]
end
module Helpers
attr_reader :status, :response
def GET(path, header={})
Net::HTTP.start(@host, @port) { |http|
user = header.delete(:user)
passwd = header.delete(:passwd)
get = Net::HTTP::Get.new(path, header)
get.basic_auth user, passwd if user && passwd
http.request(get) { |response|
@status = response.code.to_i
@response = YAML.load(response.body)
}
}
end
def POST(path, formdata={}, header={})
Net::HTTP.start(@host, @port) { |http|
user = header.delete(:user)
passwd = header.delete(:passwd)
post = Net::HTTP::Post.new(path, header)
post.form_data = formdata
post.basic_auth user, passwd if user && passwd
http.request(post) { |response|
@status = response.code.to_i
@response = YAML.load(response.body)
}
}
end
end
end
class StreamingRequest
def self.call(env)
[200, {"Content-Type" => "text/plain"}, new]
end
def each
yield "hello there!\n"
sleep 5
yield "that is all.\n"
end
end

View file

@ -1,7 +0,0 @@
module Rack
module Handler
# this class doesn't do anything, we're just seeing if we get it.
class Unregistered
end
end
end

View file

@ -1,7 +0,0 @@
module Rack
module Handler
# this class doesn't do anything, we're just seeing if we get it.
class UnregisteredLongOne
end
end
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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