Skip to content

Commit

Permalink
Merge branch 'master' into orchestra
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Oct 16, 2009
2 parents 2d7abe2 + ef70ad5 commit 71f7e75
Show file tree
Hide file tree
Showing 42 changed files with 137 additions and 90 deletions.
2 changes: 1 addition & 1 deletion actionmailer/test/abstract_unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
ActionView::Template.register_template_handler :haml, lambda { |template| "Look its HAML!".inspect }
ActionView::Template.register_template_handler :bak, lambda { |template| "Lame backup".inspect }

ActionView::Base.config = { :assets_dir => '/nowhere' }
ActionView::Base::DEFAULT_CONFIG = { :assets_dir => '/nowhere' }

$:.unshift "#{File.dirname(__FILE__)}/fixtures/helpers"

Expand Down
2 changes: 1 addition & 1 deletion actionpack/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rails_root = Pathname.new(File.dirname(__FILE__)).join("..")

Gem.sources.each { |uri| source uri }

gem "rack", "~> 1.0.0"
gem "rack", "1.0.1", :git => "git://github.com/rack/rack.git", :branch => "rack-1.0"
gem "rack-test", "~> 0.5.0"
gem "activesupport", "3.0.pre", :vendored_at => rails_root.join("activesupport")
gem "activemodel", "3.0.pre", :vendored_at => rails_root.join("activemodel")
Expand Down
11 changes: 10 additions & 1 deletion actionpack/lib/action_view/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,16 @@ class Base
module Subclasses
end

include Helpers, Rendering, Partials, ::ERB::Util, ActiveSupport::Configurable
include Helpers, Rendering, Partials, ::ERB::Util

def config
self.config = DEFAULT_CONFIG unless @config
@config
end

def config=(config)
@config = ActiveSupport::OrderedOptions.new.merge(config)
end

extend ActiveSupport::Memoizable

Expand Down
4 changes: 2 additions & 2 deletions actionpack/test/abstract_unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ class ::ApplicationController < ActionController::Base
end

module ActionController
class << Routing
def possible_controllers
module Routing
def self.possible_controllers
@@possible_controllers ||= []
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module ContentNegotiation
# This has no layout and it works
class BasicController < ActionController::Base
self.view_paths = [ActionView::FixtureResolver.new(
"content_negotiation/basic/hello.html.erb" => "Hello world <%= request.formats %>!"
"content_negotiation/basic/hello.html.erb" => "Hello world <%= request.formats.first.to_s %>!"
)]
end

Expand Down
4 changes: 2 additions & 2 deletions actionpack/test/controller/new_base/metal_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def call(env)
class TestMiddleware < ActiveSupport::TestCase
def setup
@app = Rack::Builder.new do
use MetalMiddleware
run Endpoint.new
use MetalTest::MetalMiddleware
run MetalTest::Endpoint.new
end.to_app
end

Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/controller/rescue_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def show_errors(exception)

test 'rescue routing exceptions' do
@app = ActionDispatch::Rescue.new(ActionController::Routing::Routes) do
rescue_from ActionController::RoutingError, lambda { |env| [200, {"Content-Type" => "text/html"}, "Gotcha!"] }
rescue_from ActionController::RoutingError, lambda { |env| [200, {"Content-Type" => "text/html"}, ["Gotcha!"]] }
end

get '/b00m'
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/dispatch/test_request_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TestRequestTest < ActiveSupport::TestCase
assert_equal "0.0.0.0", env.delete("REMOTE_ADDR")
assert_equal "Rails Testing", env.delete("HTTP_USER_AGENT")

assert_equal [0, 1], env.delete("rack.version")
assert_equal [1, 0], env.delete("rack.version")
assert_equal "", env.delete("rack.input").string
assert_kind_of StringIO, env.delete("rack.errors")
assert_equal true, env.delete("rack.multithread")
Expand Down
3 changes: 2 additions & 1 deletion railties/lib/rails/commands/about.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require "#{RAILS_ROOT}/config/environment"
require "#{RAILS_ROOT}/config/application"
Rails.application.new
require 'rails/info'
puts Rails::Info
2 changes: 1 addition & 1 deletion railties/lib/rails/commands/destroy.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'generators'))
require "#{RAILS_ROOT}/config/environment"
require "#{RAILS_ROOT}/config/application"

if ARGV.size == 0
Rails::Generators.help
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/commands/generate.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'generators'))
require "#{RAILS_ROOT}/config/environment"
Rails.application.new

if ARGV.size == 0
Rails::Generators.help
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/commands/performance/benchmarker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
N = 1
end

require RAILS_ROOT + '/config/environment'
require 'benchmark'
include Benchmark
Rails.application.new

# Don't include compilation in the benchmark
ARGV.each { |expression| eval(expression) }
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/commands/performance/profiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Keep the expensive require out of the profile.
$stderr.puts 'Loading Rails...'
require RAILS_ROOT + '/config/environment'
Rails.application.new # Initialize the application

# Define a method to profile.
if ARGV[1] and ARGV[1].to_i > 1
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/commands/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
ENV["RAILS_ENV"] = options[:environment]
RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV)

require RAILS_ROOT + '/config/environment'
Rails.application.new

begin
if code_or_file.nil?
Expand Down
1 change: 0 additions & 1 deletion railties/lib/rails/commands/update.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'generators'))
require "#{RAILS_ROOT}/config/environment"

if ARGV.size == 0
Rails::Generators.help
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/generators/actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def environment(data=nil, options={}, &block)

in_root do
if options[:env].nil?
inject_into_file 'config/environment.rb', "\n #{data}", :after => sentinel, :verbose => false
inject_into_file 'config/application.rb', "\n #{data}", :after => sentinel, :verbose => false
else
Array.wrap(options[:env]).each do|env|
append_file "config/environments/#{env}.rb", "\n#{data}", :verbose => false
Expand Down
1 change: 1 addition & 0 deletions railties/lib/rails/generators/rails/app/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def create_config_files

inside "config" do
copy_file "routes.rb"
template "application.rb"
template "environment.rb"

directory "environments"
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/generators/rails/app/templates/Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require File.expand_path(File.join(File.dirname(__FILE__), 'config', 'environment'))

require 'rake'
require 'rake/testtask'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Require your environment file to bootstrap Rails
require ::File.dirname(__FILE__) + '/config/environment'
require File.expand_path('../config/application', __FILE__)

# Dispatch the request
run Rails.application.new
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Bootstrap the Rails environment, frameworks, and default configuration
require File.expand_path(File.join(File.dirname(__FILE__), 'boot'))

Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )

# Specify gems that this application depends on and have them installed with rake gems:install
# config.gem "bj"
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
# config.gem "sqlite3-ruby", :lib => "sqlite3"
# config.gem "aws-s3", :lib => "aws/s3"

# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]

# Skip frameworks you're not going to use. To use Rails without a database,
# you must remove the Active Record framework.
<% if options[:skip_activerecord] -%>
config.frameworks -= [ :active_record ]
<% else -%>
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
<% end -%>
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names.
config.time_zone = 'UTC'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
# config.i18n.default_locale = :de
# Configure generators values. Many other options are available, be sure to
# check the documentation.
# config.generators do |g|
# g.orm :active_record
# g.template_engine :erb
# g.test_framework :test_unit, :fixture => true
# end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,7 @@
# Specifies gem version of Rails to use when vendor/rails is not present
<%= '# ' if options[:freeze] %>RAILS_GEM_VERSION = '<%= Rails::VERSION::STRING %>' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )

# Specify gems that this application depends on and have them installed with rake gems:install
# config.gem "bj"
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
# config.gem "sqlite3-ruby", :lib => "sqlite3"
# config.gem "aws-s3", :lib => "aws/s3"

# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]

# Skip frameworks you're not going to use. To use Rails without a database,
# you must remove the Active Record framework.
<% if options[:skip_activerecord] -%>
config.frameworks -= [ :active_record ]
<% else -%>
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
<% end -%>
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names.
config.time_zone = 'UTC'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
# config.i18n.default_locale = :de
# Configure generators values. Many other options are available, be sure to
# check the documentation.
# config.generators do |g|
# g.orm :active_record
# g.template_engine :erb
# g.test_framework :test_unit, :fixture => true
# end
end
# Load the rails application
require File.expand_path(File.join(File.dirname(__FILE__), 'application'))
# Initialize the rails application
Rails.application.new
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= shebang %>
require File.expand_path('../../config/boot', __FILE__)
require File.expand_path('../../config/application', __FILE__)
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
require 'rails/commands/about'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= shebang %>
require File.expand_path('../../config/boot', __FILE__)
require File.expand_path('../../config/application', __FILE__)
require 'rails/commands/console'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= shebang %>
require File.expand_path('../../config/boot', __FILE__)
require File.expand_path('../../config/application', __FILE__)
require 'rails/commands/dbconsole'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= shebang %>
require File.expand_path('../../config/boot', __FILE__)
require File.expand_path('../../config/application', __FILE__)
require 'rails/commands/destroy'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= shebang %>
require File.expand_path('../../config/boot', __FILE__)
require File.expand_path('../../config/application', __FILE__)
require 'rails/commands/generate'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= shebang %>
require File.expand_path('../../../config/boot', __FILE__)
require File.expand_path('../../../config/application', __FILE__)
require 'rails/commands/performance/benchmarker'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= shebang %>
require File.expand_path('../../../config/boot', __FILE__)
require File.expand_path('../../../config/application', __FILE__)
require 'rails/commands/performance/profiler'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= shebang %>
require File.expand_path('../../config/boot', __FILE__)
require File.expand_path('../../config/application', __FILE__)
require 'rails/commands/plugin'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= shebang %>
require File.expand_path('../../config/boot', __FILE__)
require File.expand_path('../../config/application', __FILE__)
require 'rails/commands/runner'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= shebang %>
require File.expand_path('../../config/boot', __FILE__)
require File.expand_path('../../config/application', __FILE__)
require 'rails/commands/server'
1 change: 0 additions & 1 deletion railties/lib/rails/initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def self.run(initializer = nil, config = nil)
else
Rails.application = Class.new(Application)
yield Rails.application.config if block_given?
Rails.application.new
end
end
end
Expand Down
1 change: 1 addition & 0 deletions railties/test/abstract_unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
require 'test/unit'

require 'active_support'
require 'active_support/core_ext/logger'
require 'active_support/test_case'

require 'action_controller'
Expand Down
4 changes: 4 additions & 0 deletions railties/test/application/generators_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def setup
c.generators.orm :datamapper
c.generators.test_framework :rspec
end
# Initialize the application
Rails.application.new

assert_equal :rspec, Rails::Generators.options[:rails][:test_framework]
assert_equal "-w", Rails::Generators.aliases[:rails][:test_framework]
Expand All @@ -50,6 +52,8 @@ def setup
Rails::Initializer.run do |c|
c.generators.colorize_logging = false
end
# Initialize the application
Rails.application.new

assert_equal Thor::Base.shell, Thor::Shell::Basic
end
Expand Down
Loading

0 comments on commit 71f7e75

Please sign in to comment.