diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-19 15:24:00 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-19 15:24:00 -0800 |
commit | c7c39f52dcce4ea6de2051ee7816c0cb9d583f8f (patch) | |
tree | 2ea73ce578cb72a70c86a744c76615890535161b /railties | |
parent | 5df26dd7a91bb6d248b96c4308242a51ab59aa5c (diff) | |
download | rails-c7c39f52dcce4ea6de2051ee7816c0cb9d583f8f.tar.gz rails-c7c39f52dcce4ea6de2051ee7816c0cb9d583f8f.tar.bz2 rails-c7c39f52dcce4ea6de2051ee7816c0cb9d583f8f.zip |
Revert "Final steps toward clean rails "foo"; cd foo; gem bundle; script/server working"
Broke stuff.
This reverts commit 520b8b59110dd130c89b317b6bd65d8644c7836f.
Diffstat (limited to 'railties')
8 files changed, 13 insertions, 13 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index c8e4d8943b..7c2d8eab67 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -3,6 +3,11 @@ module Rails include Initializable class << self + def inherited(klass) + Rails.application ||= klass unless klass.name =~ /Rails/ + super + end + # Stub out App initialize def initialize! new @@ -33,7 +38,6 @@ module Rails end def initialize - Rails.application ||= self run_initializers(self) end diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb index 450970e4f5..2c90851fb2 100644 --- a/railties/lib/rails/commands/server.rb +++ b/railties/lib/rails/commands/server.rb @@ -3,13 +3,11 @@ require 'action_dispatch' require 'fileutils' require 'optparse' -# Waiting for Rack::Server patch - options = { :Port => 3000, :Host => "0.0.0.0", :environment => (ENV['RAILS_ENV'] || "development").dup, - :config => $config_ru, + :config => "#{Rails.root}/config.ru", :detach => false, :debugger => false } diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index d970bd8db8..2bcea4bc8f 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -50,7 +50,7 @@ module Rails::Generators def create_root_files copy_file "Rakefile" copy_file "README" - template "config.ru" + copy_file "config.ru" template "Gemfile" end diff --git a/railties/lib/rails/generators/rails/app/templates/config.ru b/railties/lib/rails/generators/rails/app/templates/config.ru index fea9ba7fe5..509a0da5b7 100644 --- a/railties/lib/rails/generators/rails/app/templates/config.ru +++ b/railties/lib/rails/generators/rails/app/templates/config.ru @@ -2,4 +2,4 @@ require ::File.expand_path('../config/environment', __FILE__) # Dispatch the request -run <%= app_name.classify %> +run Rails.application diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index 43067b2530..8008c6ba07 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -1,6 +1,6 @@ require File.expand_path('../boot', __FILE__) -class <%= app_name.classify %> < Rails::Application +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. diff --git a/railties/lib/rails/generators/rails/app/templates/config/environment.rb b/railties/lib/rails/generators/rails/app/templates/config/environment.rb index 1c35ae44d2..0bb191f205 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environment.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/environment.rb @@ -2,4 +2,4 @@ require File.expand_path('../application', __FILE__) # Initialize the rails application -<%= app_name.classify %>.initialize! +Rails.initialize! diff --git a/railties/lib/rails/generators/rails/app/templates/script/server b/railties/lib/rails/generators/rails/app/templates/script/server index b4864eb745..a7aaee2953 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/server +++ b/railties/lib/rails/generators/rails/app/templates/script/server @@ -1,5 +1,2 @@ require File.expand_path('../../config/application', __FILE__) -# Temporary patch until Rack::Server -# Will be Rails::Server.start(File.expand_path("../../config.ru", __FILE__)) -$config_ru = File.expand_path("../../config.ru", __FILE__) require 'rails/commands/server' diff --git a/railties/lib/rails/rack/log_tailer.rb b/railties/lib/rails/rack/log_tailer.rb index f3ebebf67d..a237cee6bc 100644 --- a/railties/lib/rails/rack/log_tailer.rb +++ b/railties/lib/rails/rack/log_tailer.rb @@ -1,11 +1,12 @@ module Rails module Rack class LogTailer + EnvironmentLog = "#{File.expand_path(Rails.root)}/log/#{Rails.env}.log" + def initialize(app, log = nil) - @default_log = "#{File.expand_path(Rails.root)}/log/#{Rails.env}.log" @app = app - path = Pathname.new(log || @default_log).cleanpath + path = Pathname.new(log || EnvironmentLog).cleanpath @cursor = ::File.size(path) @last_checked = Time.now.to_f |