New Version

Sync with Latest Instiki Trunk.
Migrate to Rails 1.2.5.
Bump version number.
This commit is contained in:
Jacques Distler 2007-10-15 12:16:54 -05:00
parent de125367b0
commit 207fb1f7f2
120 changed files with 2592 additions and 662 deletions

View file

@ -42,8 +42,7 @@ class Dispatcher
end
rescue Exception => exception # errors from CGI dispatch
failsafe_response(output, '500 Internal Server Error', exception) do
controller ||= ApplicationController rescue LoadError nil
controller ||= ActionController::Base
controller ||= (ApplicationController rescue ActionController::Base)
controller.process_with_exception(request, response, exception).out(output)
end
ensure

View file

@ -1,7 +1,11 @@
require 'logger'
require 'set'
require File.join(File.dirname(__FILE__), 'railties_path')
require File.join(File.dirname(__FILE__), 'rails/version')
require 'pathname'
$LOAD_PATH.unshift File.dirname(__FILE__)
require 'railties_path'
require 'rails/version'
RAILS_ENV = (ENV['RAILS_ENV'] || 'development').dup unless defined?(RAILS_ENV)
@ -191,7 +195,7 @@ module Rails
raise(LoadError, "Cannot find the plugin '#{name}'!") if path.nil?
load_plugin path
end
end
end
$LOAD_PATH.uniq!
end
@ -201,7 +205,9 @@ module Rails
silence_warnings do
config = configuration
constants = self.class.constants
eval(IO.read(configuration.environment_path), binding, configuration.environment_path)
(self.class.constants - constants).each do |const|
Object.const_set(const, self.class.const_get(const))
end
@ -307,10 +313,10 @@ module Rails
def initialize_temporary_directories
if configuration.frameworks.include?(:action_controller)
session_path = "#{RAILS_ROOT}/tmp/sessions/"
session_path = "#{configuration.root_path}/tmp/sessions/"
ActionController::Base.session_options[:tmpdir] = File.exist?(session_path) ? session_path : Dir::tmpdir
cache_path = "#{RAILS_ROOT}/tmp/cache/"
cache_path = "#{configuration.root_path}/tmp/cache/"
if File.exist?(cache_path)
ActionController::Base.fragment_cache_store = :file_store, cache_path
end
@ -414,6 +420,9 @@ module Rails
# config = Rails::Configuration.new
# Rails::Initializer.run(:process, config)
class Configuration
# The application's base directory.
attr_reader :root_path
# A stub for setting options on ActionController::Base
attr_accessor :action_controller
@ -497,6 +506,8 @@ module Rails
# Create a new Configuration instance, initialized with the default
# values.
def initialize
set_root_path!
self.frameworks = default_frameworks
self.load_paths = default_load_paths
self.load_once_paths = default_load_once_paths
@ -516,6 +527,23 @@ module Rails
end
end
# Set the root_path to RAILS_ROOT and canonicalize it.
def set_root_path!
raise 'RAILS_ROOT is not set' unless defined?(::RAILS_ROOT)
raise 'RAILS_ROOT is not a directory' unless File.directory?(::RAILS_ROOT)
@root_path =
# Pathname is incompatible with Windows, but Windows doesn't have
# real symlinks so File.expand_path is safe.
if RUBY_PLATFORM =~ /(:?mswin|mingw)/
File.expand_path(::RAILS_ROOT)
# Otherwise use Pathname#realpath which respects symlinks.
else
Pathname.new(::RAILS_ROOT).realpath.to_s
end
end
# Loads and returns the contents of the #database_configuration_file. The
# contents of the file are processed via ERB before being sent through
# YAML::load.
@ -575,10 +603,6 @@ module Rails
end
private
def root_path
::RAILS_ROOT
end
def framework_root_path
defined?(::RAILS_FRAMEWORK_ROOT) ? ::RAILS_FRAMEWORK_ROOT : "#{root_path}/vendor/rails"
end

View file

@ -2,7 +2,7 @@ module Rails
module VERSION #:nodoc:
MAJOR = 1
MINOR = 2
TINY = 3
TINY = 5
STRING = [MAJOR, MINOR, TINY].join('.')
end

View file

@ -173,7 +173,7 @@ class ScaffoldGenerator < Rails::Generator::NamedBase
sandbox.model_instance = model_instance
sandbox.instance_variable_set("@#{singular_name}", sandbox.model_instance)
rescue ActiveRecord::StatementInvalid => e
logger.error "Before updating scaffolding from new DB schema, try creating a table for your model (#{class_name})"
logger.error "Before updating scaffolding from new DB schema, try creating a table for your model (#{class_name}) named #{class_name.tableize}."
raise SystemExit
end
sandbox.suffix = suffix

View file

@ -36,6 +36,7 @@ class ScaffoldResourceGenerator < Rails::Generator::NamedBase
m.directory(File.join('app/controllers', controller_class_path))
m.directory(File.join('app/helpers', controller_class_path))
m.directory(File.join('app/views', controller_class_path, controller_file_name))
m.directory(File.join('app/views/layouts', controller_class_path))
m.directory(File.join('test/functional', controller_class_path))
m.directory(File.join('test/unit', class_path))

View file

@ -1 +1 @@
RAILTIES_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
RAILTIES_PATH = File.join(File.dirname(__FILE__), '..')

View file

@ -7,8 +7,8 @@ namespace :rails do
Gem.manage_gems
rails = (version = ENV['VERSION']) ?
Gem.cache.search('rails', "= #{version}").first :
Gem.cache.search('rails').sort_by { |g| g.version }.last
Gem.cache.find_name('rails', "= #{version}").first :
Gem.cache.find_name('rails').sort_by { |g| g.version }.last
version ||= rails.version
@ -59,8 +59,8 @@ namespace :rails do
touch "vendor/rails/REVISION_#{ENV['REVISION']}"
end
for framework in %w( railties actionpack activerecord actionmailer activesupport actionwebservice )
for framework in %w(railties actionpack activerecord actionmailer activesupport activeresource)
system "svn export #{rails_svn}/#{framework} vendor/rails/#{framework}" + (ENV['REVISION'] ? " -r #{ENV['REVISION']}" : "")
end
end

View file

@ -0,0 +1,17 @@
desc 'Print out all defined routes in match order, with names.'
task :routes => :environment do
routes = ActionController::Routing::Routes.routes.collect do |route|
name = ActionController::Routing::Routes.named_routes.routes.index(route).to_s
verb = route.conditions[:method].to_s.upcase
segs = route.segments.inject("") { |str,s| str << s.to_s }
segs.chop! if segs.length > 1
reqs = route.requirements.empty? ? "" : route.requirements.inspect
{:name => name, :verb => verb, :segs => segs, :reqs => reqs}
end
name_width = routes.collect {|r| r[:name]}.collect {|n| n.length}.max
verb_width = routes.collect {|r| r[:verb]}.collect {|v| v.length}.max
segs_width = routes.collect {|r| r[:segs]}.collect {|s| s.length}.max
routes.each do |r|
puts "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:segs].ljust(segs_width)} #{r[:reqs]}"
end
end