Permalink
Browse files

Merge branch 'master' of github.com:rails/rails

  • Loading branch information...
2 parents 8db0382 + c446b1b commit de2cd8e39f68d874b833b3a4860769c4edc57cbe @josh josh committed Dec 2, 2009
View
@@ -7,16 +7,9 @@ activerecord/doc
actionpack/doc
actionmailer/doc
activesupport/doc
-activemodel/pkg
-activeresource/pkg
-activerecord/pkg
-actionpack/pkg
activemodel/test/fixtures/fixture_database.sqlite3
-actionmailer/pkg
-activesupport/pkg
actionpack/test/tmp
activesupport/test/fixtures/isolation_test
-railties/pkg
railties/test/500.html
railties/test/fixtures/tmp
railties/test/initializer/root/log
@@ -31,3 +24,4 @@ railties/guides/output
bin
vendor/gems/
railties/tmp
+pkg
View
@@ -1,3 +1,6 @@
[submodule "arel"]
path = arel
url = git://github.com/rails/arel.git
+[submodule "rack"]
+ path = rack
+ url = git://github.com/rails/rack.git
View
@@ -1,9 +1,10 @@
require 'rake'
require 'rake/rdoctask'
+require 'rake/gempackagetask'
env = %(PKG_BUILD="#{ENV['PKG_BUILD']}") if ENV['PKG_BUILD']
-PROJECTS = %w(activesupport actionpack actionmailer activeresource activerecord activemodel railties)
+PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties)
Dir["#{File.dirname(__FILE__)}/*/lib/*/version.rb"].each do |version_path|
require version_path
@@ -23,11 +24,21 @@ task :default => %w(test test:isolated)
end
end
+spec = eval(File.read('rails.gemspec'))
+
+Rake::GemPackageTask.new(spec) do |pkg|
+ pkg.gem_spec = spec
+end
+
task :install => :gem do
+ system %(cd arel && gem build arel.gemspec && gem install arel-0.2.pre.gem --no-ri --no-rdoc --ignore-dependencies)
+ system %(cd rack && rake gem VERSION=1.0.2.pre && gem install rack-1.0.2.pre.gem --no-ri --no-rdoc --ignore-dependencies)
(PROJECTS - ["railties"]).each do |project|
+ puts "INSTALLING #{project}"
system("gem install #{project}/pkg/#{project}-#{ActionPack::VERSION::STRING}.gem --no-ri --no-rdoc")
end
- system("gem install railties/pkg/rails-#{ActionPack::VERSION::STRING}.gem --no-ri --no-rdoc")
+ system("gem install railties/pkg/railties-#{ActionPack::VERSION::STRING}.gem --no-ri --no-rdoc")
+ system("gem install pkg/rails-#{ActionPack::VERSION::STRING}.gem --no-ri --no-rdoc")
end
desc "Generate documentation for the Rails framework"
Submodule rack added at adf996
@@ -8,22 +8,16 @@ Gem::Specification.new do |s|
on top of either MySQL, PostgreSQL, SQLite, DB2, SQL Server, or Oracle with eRuby- or Builder-based templates.
EOF
- s.add_dependency('rake', '>= 0.8.3')
s.add_dependency('activesupport', '= 3.0.pre')
- s.add_dependency('activerecord', '= 3.0.pre')
s.add_dependency('actionpack', '= 3.0.pre')
- s.add_dependency('actionmailer', '= 3.0.pre')
+ s.add_dependency('activerecord', '= 3.0.pre')
s.add_dependency('activeresource', '= 3.0.pre')
+ s.add_dependency('actionmailer', '= 3.0.pre')
+ s.add_dependency('railties', '= 3.0.pre')
s.rdoc_options << '--exclude' << '.'
s.has_rdoc = false
- s.files = Dir['CHANGELOG', 'README', 'bin/**/*', 'builtin/**/*', 'guides/**/*', 'lib/**/{*,.[a-z]*}']
- s.require_path = 'lib'
- s.bindir = "bin"
- s.executables = ["rails"]
- s.default_executable = "rails"
-
s.author = "David Heinemeier Hansson"
s.email = "david@loudthinking.com"
s.homepage = "http://www.rubyonrails.org"
View
@@ -10,7 +10,7 @@ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib"
require 'rails/version'
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
-PKG_NAME = ENV['PKG_NAME'] || 'rails'
+PKG_NAME = ENV['PKG_NAME'] || 'railties'
PKG_VERSION = Rails::VERSION::STRING + PKG_BUILD
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
@@ -141,7 +141,7 @@ Rake::RDocTask.new { |rdoc|
# Generate GEM ----------------------------------------------------------------------------
-spec = eval(File.read('rails.gemspec'))
+spec = eval(File.read('railties.gemspec'))
Rake::GemPackageTask.new(spec) do |pkg|
pkg.gem_spec = spec
View
@@ -1,5 +1,9 @@
require "pathname"
+require 'active_support'
+require 'active_support/core_ext/kernel/reporting'
+require 'active_support/core_ext/logger'
+
require 'rails/initializable'
require 'rails/application'
require 'rails/railties_path'
@@ -10,4 +14,19 @@
require 'rails/configuration'
require 'rails/deprecation'
require 'rails/initializer'
-require 'rails/plugin'
+require 'rails/plugin'
+require 'rails/ruby_version_check'
+
+# For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the
+# multibyte safe operations. Plugin authors supporting other encodings
+# should override this behaviour and set the relevant +default_charset+
+# on ActionController::Base.
+#
+# For Ruby 1.9, UTF-8 is the default internal and external encoding.
+if RUBY_VERSION < '1.9'
+ $KCODE='u'
+else
+ Encoding.default_external = Encoding::UTF_8
+end
+
+RAILS_ENV = (ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development").dup unless defined?(RAILS_ENV)
@@ -82,8 +82,21 @@ def call(env)
@app.call(env)
end
- initializer :initialize_rails do
- Rails.run_initializers
+
+ # Loads the environment specified by Configuration#environment_path, which
+ # is typically one of development, test, or production.
+ initializer :load_environment do
+ next unless File.file?(config.environment_path)
+
+ config = self.config
+
+ Kernel.class_eval do
+ meth = instance_method(:config) if Object.respond_to?(:config)
+ define_method(:config) { config }
+ require config.environment_path
+ remove_method :config
+ define_method(:config, &meth) if meth
+ end
end
# Set the <tt>$LOAD_PATH</tt> based on the value of
@@ -97,18 +110,8 @@ def call(env)
# list. By default, all frameworks (Active Record, Active Support,
# Action Pack, Action Mailer, and Active Resource) are loaded.
initializer :require_frameworks do
- begin
- require 'active_support'
- require 'active_support/core_ext/kernel/reporting'
- require 'active_support/core_ext/logger'
-
- # TODO: This is here to make Sam Ruby's tests pass. Needs discussion.
- require 'active_support/core_ext/numeric/bytes'
- config.frameworks.each { |framework| require(framework.to_s) }
- rescue LoadError => e
- # Re-raise as RuntimeError because Mongrel would swallow LoadError.
- raise e.to_s
- end
+ require 'active_support/all' unless config.active_support.bare
+ config.frameworks.each { |framework| require(framework.to_s) }
end
# Set the paths from which Rails will automatically load source files, and
@@ -137,24 +140,6 @@ def call(env)
end
end
- # Loads the environment specified by Configuration#environment_path, which
- # is typically one of development, test, or production.
- initializer :load_environment do
- silence_warnings do
- next if @environment_loaded
- next unless File.file?(config.environment_path)
-
- @environment_loaded = true
- constants = self.class.constants
-
- eval(IO.read(config.environment_path), binding, config.environment_path)
-
- (self.class.constants - constants).each do |const|
- Object.const_set(const, self.class.const_get(const))
- end
- end
- end
-
# Preload all frameworks specified by the Configuration#frameworks.
# Used by Passenger to ensure everything's loaded before forking and
# to avoid autoload race conditions in JRuby.
@@ -312,9 +297,6 @@ def call(env)
base_class.send("#{setting}=", value)
end
end
- config.active_support.each do |setting, value|
- ActiveSupport.send("#{setting}=", value)
- end
end
# Sets +ActionController::Base#view_paths+ and +ActionMailer::Base#template_root+
@@ -41,9 +41,9 @@ def self.start(app)
new(app).start
end
- def initialize(app)
+ def initialize(app_const)
super() # Call Rack::Server#initialize without passing any options to use.
- @app = app
+ @app_const = app_const
end
def start
@@ -69,18 +69,18 @@ def middleware
end
def log_path
- "#{File.expand_path(@app.root)}/log/#{options[:environment]}.log"
+ "#{File.expand_path(@app_const.root)}/log/#{options[:environment]}.log"
end
def default_options
{
:Port => 3000,
:Host => "0.0.0.0",
:environment => (ENV['RAILS_ENV'] || "development").dup,
- :rack_file => "#{@app.root}/config.ru",
+ :rack_file => "#{@app_const.root}/config.ru",
:daemonize => false,
:debugger => false,
- :pid => "#{@app.root}/tmp/pids/server.pid",
+ :pid => "#{@app_const.root}/tmp/pids/server.pid",
:AccessLog => []
}
end
@@ -106,26 +106,4 @@ def run_initializers(*args)
end
end
end
-
- include Initializable
-
- # Check for valid Ruby version (1.8.2 or 1.8.4 or higher). This is done in an
- # external file, so we can use it from the `rails` program as well without duplication.
- initializer :check_ruby_version, :global => true do
- require 'rails/ruby_version_check'
- end
-
- # For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the
- # multibyte safe operations. Plugin authors supporting other encodings
- # should override this behaviour and set the relevant +default_charset+
- # on ActionController::Base.
- #
- # For Ruby 1.9, UTF-8 is the default internal and external encoding.
- initializer :initialize_encoding, :global => true do
- if RUBY_VERSION < '1.9'
- $KCODE='u'
- else
- Encoding.default_external = Encoding::UTF_8
- end
- end
end
@@ -1,7 +1,5 @@
require "rails" # In case people require this file directly
-RAILS_ENV = (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development').dup unless defined?(RAILS_ENV)
-
module Rails
class Initializer
class Error < StandardError ; end
@@ -0,0 +1,28 @@
+Gem::Specification.new do |s|
+ s.platform = Gem::Platform::RUBY
+ s.name = 'railties'
+ s.version = '3.0.pre'
+ s.summary = "Controls boot-up, rake tasks and generators for the Rails framework."
+ s.description = <<-EOF
+ Rails is a framework for building web-application using CGI, FCGI, mod_ruby, or WEBrick
+ on top of either MySQL, PostgreSQL, SQLite, DB2, SQL Server, or Oracle with eRuby- or Builder-based templates.
+ EOF
+
+ s.add_dependency('rake', '>= 0.8.3')
+ s.add_dependency('activesupport', '= 3.0.pre')
+ s.add_dependency('actionpack', '= 3.0.pre')
+
+ s.rdoc_options << '--exclude' << '.'
+ s.has_rdoc = false
+
+ s.files = Dir['CHANGELOG', 'README', 'bin/**/*', 'builtin/**/*', 'guides/**/*', 'lib/**/{*,.[a-z]*}']
+ s.require_path = 'lib'
+ s.bindir = "bin"
+ s.executables = ["rails"]
+ s.default_executable = "rails"
+
+ s.author = "David Heinemeier Hansson"
+ s.email = "david@loudthinking.com"
+ s.homepage = "http://www.rubyonrails.org"
+ s.rubyforge_project = "rails"
+end
@@ -44,5 +44,14 @@ def setup
assert_equal Pathname.new("#{app_path}/app"), Rails.application.root
end
end
+
+ test "config.active_support.bare does not require all of ActiveSupport" do
+ add_to_config "config.frameworks = []; config.active_support.bare = true"
+
+ Dir.chdir("#{app_path}/app") do
+ require "#{app_path}/config/environment"
+ assert_raises(NoMethodError, /day/) { 1.day }
+ end
+ end
end
end
Oops, something went wrong. Retry.

0 comments on commit de2cd8e

Please sign in to comment.