aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/fcgi_handler.rb4
-rw-r--r--railties/lib/initializer.rb15
-rw-r--r--railties/lib/rails/rack.rb1
-rw-r--r--railties/lib/rails/rack/logger.rb28
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb1
-rw-r--r--railties/lib/tasks/framework.rake5
6 files changed, 45 insertions, 9 deletions
diff --git a/railties/lib/fcgi_handler.rb b/railties/lib/fcgi_handler.rb
index 722aa1940c..1bb55b9275 100644
--- a/railties/lib/fcgi_handler.rb
+++ b/railties/lib/fcgi_handler.rb
@@ -18,7 +18,6 @@ class RailsFCGIHandler
attr_accessor :log_file_path
attr_accessor :gc_request_period
-
# Initialize and run the FastCGI instance, passing arguments through to new.
def self.process!(*args, &block)
new(*args, &block).process!
@@ -68,7 +67,6 @@ class RailsFCGIHandler
end
end
-
protected
def process_each_request(provider)
cgi = nil
@@ -197,7 +195,7 @@ class RailsFCGIHandler
# close resources as they won't be closed by
# the OS when using exec
logger.close rescue nil
- RAILS_DEFAULT_LOGGER.close rescue nil
+ Rails.logger.close rescue nil
exec(command_line)
end
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb
index 6576cd368b..70c6a629ec 100644
--- a/railties/lib/initializer.rb
+++ b/railties/lib/initializer.rb
@@ -33,7 +33,11 @@ module Rails
end
def logger
- RAILS_DEFAULT_LOGGER
+ if defined?(RAILS_DEFAULT_LOGGER)
+ RAILS_DEFAULT_LOGGER
+ else
+ nil
+ end
end
def root
@@ -403,7 +407,7 @@ Run `rake gems:install` to install the missing gems.
# +STDERR+, with a log level of +WARN+.
def initialize_logger
# if the environment has explicitly defined a logger, use it
- return if defined?(RAILS_DEFAULT_LOGGER)
+ return if Rails.logger
unless logger = configuration.logger
begin
@@ -431,10 +435,11 @@ Run `rake gems:install` to install the missing gems.
# RAILS_DEFAULT_LOGGER.
def initialize_framework_logging
for framework in ([ :active_record, :action_controller, :action_mailer ] & configuration.frameworks)
- framework.to_s.camelize.constantize.const_get("Base").logger ||= RAILS_DEFAULT_LOGGER
+ framework.to_s.camelize.constantize.const_get("Base").logger ||= Rails.logger
end
- RAILS_CACHE.logger ||= RAILS_DEFAULT_LOGGER
+ ActiveSupport::Dependencies.logger ||= Rails.logger
+ Rails.cache.logger ||= Rails.logger
end
# Sets +ActionController::Base#view_paths+ and +ActionMailer::Base#template_root+
@@ -531,7 +536,7 @@ Run `rake gems:install` to install the missing gems.
return unless configuration.frameworks.include?(:action_controller)
require 'dispatcher' unless defined?(::Dispatcher)
Dispatcher.define_dispatcher_callbacks(configuration.cache_classes)
- Dispatcher.new(RAILS_DEFAULT_LOGGER).send :run_callbacks, :prepare_dispatch
+ Dispatcher.new(Rails.logger).send :run_callbacks, :prepare_dispatch
end
def disable_dependency_loading
diff --git a/railties/lib/rails/rack.rb b/railties/lib/rails/rack.rb
index abcd0741bf..b4f32c2d95 100644
--- a/railties/lib/rails/rack.rb
+++ b/railties/lib/rails/rack.rb
@@ -1,5 +1,6 @@
module Rails
module Rack
+ autoload :Logger, "rails/rack/logger"
autoload :Static, "rails/rack/static"
end
end
diff --git a/railties/lib/rails/rack/logger.rb b/railties/lib/rails/rack/logger.rb
new file mode 100644
index 0000000000..89d02e45a9
--- /dev/null
+++ b/railties/lib/rails/rack/logger.rb
@@ -0,0 +1,28 @@
+module Rails
+ module Rack
+ class Logger
+ EnvironmentLog = "#{File.expand_path(Rails.root)}/log/#{Rails.env}.log"
+
+ def initialize(app, log = nil)
+ @app = app
+ @path = Pathname.new(log || EnvironmentLog).cleanpath
+ @cursor = ::File.size(@path)
+ @last_checked = Time.now
+ end
+
+ def call(env)
+ response = @app.call(env)
+ ::File.open(@path, 'r') do |f|
+ f.seek @cursor
+ if f.mtime > @last_checked
+ contents = f.read
+ @last_checked = f.mtime
+ @cursor += contents.length
+ print contents
+ end
+ end
+ response
+ end
+ end
+ end
+end
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index 98fe163455..80e8eabfd3 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -46,7 +46,6 @@ class AppGenerator < Rails::Generator::Base
# Root
m.file "fresh_rakefile", "Rakefile"
m.file "README", "README"
- m.file "config.ru", "config.ru"
# Application
m.template "helpers/application.rb", "app/controllers/application.rb", :assigns => { :app_name => @app_name, :app_secret => md5.hexdigest }
diff --git a/railties/lib/tasks/framework.rake b/railties/lib/tasks/framework.rake
index 71aea09867..66ab78c3b2 100644
--- a/railties/lib/tasks/framework.rake
+++ b/railties/lib/tasks/framework.rake
@@ -43,9 +43,12 @@ namespace :rails do
require 'open-uri'
version = ENV["RELEASE"] || "edge"
target = "rails_#{version}.zip"
+ commits = "http://github.com/api/v1/yaml/rails/rails/commits/master"
url = "http://dev.rubyonrails.org/archives/#{target}"
chdir 'vendor' do
+ latest_revision = YAML.load(open(commits))["commits"].first["id"]
+
puts "Downloading Rails from #{url}"
File.open('rails.zip', 'wb') do |dst|
open url do |src|
@@ -61,6 +64,8 @@ namespace :rails do
%w(rails.zip rails/Rakefile rails/cleanlogs.sh rails/pushgems.rb rails/release.rb).each do |goner|
rm_f goner
end
+
+ touch "rails/REVISION_#{latest_revision}"
end
puts 'Updating current scripts, javascripts, and configuration settings'