diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/Rakefile | 7 | ||||
-rw-r--r-- | railties/builtin/rails_info/rails/info.rb | 10 | ||||
-rw-r--r-- | railties/configs/routes.rb | 2 | ||||
-rw-r--r-- | railties/lib/commands/performance/profiler.rb | 2 | ||||
-rw-r--r-- | railties/lib/console_app.rb | 5 | ||||
-rw-r--r-- | railties/lib/initializer.rb | 5 | ||||
-rw-r--r-- | railties/lib/rails/plugin/loader.rb | 12 | ||||
-rw-r--r-- | railties/lib/rails/plugin/locator.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/applications/app/template_runner.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/components/model/templates/model.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails_generator/scripts.rb | 2 | ||||
-rw-r--r-- | railties/lib/tasks/gems.rake | 8 | ||||
-rw-r--r-- | railties/test/rails_info_test.rb | 2 |
13 files changed, 33 insertions, 28 deletions
diff --git a/railties/Rakefile b/railties/Rakefile index 133a603ed6..69c1ca762a 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -249,7 +249,7 @@ def copy_with_rewritten_ruby_path(src_file, dest_file) end desc 'Generate guides (for authors), use ONLY=foo to process just "foo.textile"' -task :guides do +task :generate_guides do ENV["WARN_BROKEN_LINKS"] = "1" # authors can't disable this ruby "guides/rails_guides.rb" end @@ -298,6 +298,7 @@ PKG_FILES = FileList[ 'doc/**/*', 'dispatches/**/*', 'environments/**/*', + 'guides/**/*', 'helpers/**/*', 'generators/**/*', 'html/**/*', @@ -324,7 +325,7 @@ spec = Gem::Specification.new do |s| s.rdoc_options << '--exclude' << '.' s.has_rdoc = false - s.files = PKG_FILES.to_a.delete_if {|f| f.include?('.svn')} + s.files = PKG_FILES.to_a.delete_if {|f| f =~ %r{\.svn|guides/output}} s.require_path = 'lib' s.bindir = "bin" # Use these for applications. s.executables = ["rails"] @@ -350,7 +351,7 @@ task :pgem => [:gem] do end desc "Publish the guides" -task :pguides => :guides do +task :pguides => :generate_guides do require 'rake/contrib/sshpublisher' mkdir_p 'pkg' `tar -czf pkg/guides.gz guides/output` diff --git a/railties/builtin/rails_info/rails/info.rb b/railties/builtin/rails_info/rails/info.rb index 0dd1c090c1..fdacc469f5 100644 --- a/railties/builtin/rails_info/rails/info.rb +++ b/railties/builtin/rails_info/rails/info.rb @@ -1,9 +1,13 @@ +require "active_support/core_ext/object/misc" +require "cgi" +require "active_support/core_ext/cgi" + module Rails module Info mattr_accessor :properties class << (@@properties = []) def names - map &:first + map {|val| val.first } end def value_for(property_name) @@ -53,7 +57,7 @@ module Rails alias inspect to_s def to_html - returning table = '<table>' do + (table = '<table>').tap do properties.each do |(name, value)| table << %(<tr><td class="name">#{CGI.escapeHTML(name.to_s)}</td>) formatted_value = if value.kind_of?(Array) @@ -108,7 +112,7 @@ module Rails end property 'Middleware' do - ActionController::Dispatcher.middleware.active.map(&:inspect) + ActionController::Dispatcher.middleware.active.map {|middle| middle.inspect } end # The Rails Git revision, if it's checked out into vendor/rails. diff --git a/railties/configs/routes.rb b/railties/configs/routes.rb index 4f3d9d22dd..ea14ce1bfc 100644 --- a/railties/configs/routes.rb +++ b/railties/configs/routes.rb @@ -37,7 +37,7 @@ ActionController::Routing::Routes.draw do |map| # Install the default routes as the lowest priority. # Note: These default routes make all actions in every controller accessible via GET requests. You should - # consider removing the them or commenting them out if you're using named routes and resources. + # consider removing or commenting them out if you're using named routes and resources. map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' end diff --git a/railties/lib/commands/performance/profiler.rb b/railties/lib/commands/performance/profiler.rb index fd111bae87..7df840f197 100644 --- a/railties/lib/commands/performance/profiler.rb +++ b/railties/lib/commands/performance/profiler.rb @@ -29,7 +29,7 @@ begin printer_class = RubyProf::FlatPrinter end printer = printer_class.new(results) - printer.print($stderr, 0) + printer.print($stderr) rescue LoadError require "prof" $stderr.puts 'Using the old ruby-prof extension.' diff --git a/railties/lib/console_app.rb b/railties/lib/console_app.rb index c944d49205..42bf50e01e 100644 --- a/railties/lib/console_app.rb +++ b/railties/lib/console_app.rb @@ -26,8 +26,7 @@ end #reloads the environment def reload! puts "Reloading..." - dispatcher = ActionController::Dispatcher.new - dispatcher.cleanup_application - dispatcher.reload_application + ActionController::Dispatcher.new + ActionController::Dispatcher.router.reload true end diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 40000f0dfd..4c6de48a65 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -311,7 +311,7 @@ module Rails end def check_for_unbuilt_gems - unbuilt_gems = @configuration.gems.select(&:frozen?).reject(&:built?) + unbuilt_gems = @configuration.gems.select {|gem| gem.frozen? && !gem.built? } if unbuilt_gems.size > 0 # don't print if the gems:build rake tasks are being run unless $gems_build_rake_task @@ -462,7 +462,7 @@ Run `rake gems:install` to install the missing gems. if RAILS_CACHE.respond_to?(:middleware) # Insert middleware to setup and teardown local cache for each request - configuration.middleware.insert_after(:"ActionDispatch::Failsafe", RAILS_CACHE.middleware) + configuration.middleware.insert_after(:"Rack::Lock", RAILS_CACHE.middleware) end end end @@ -632,7 +632,6 @@ 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.run_prepare_callbacks end def disable_dependency_loading diff --git a/railties/lib/rails/plugin/loader.rb b/railties/lib/rails/plugin/loader.rb index 66e01d70da..bc22dfc591 100644 --- a/railties/lib/rails/plugin/loader.rb +++ b/railties/lib/rails/plugin/loader.rb @@ -24,7 +24,7 @@ module Rails # Returns the plugins that are in engine-form (have an app/ directory) def engines - @engines ||= plugins.select(&:engine?) + @engines ||= plugins.select {|plugin| plugin.engine? } end # Returns all the plugins that could be found by the current locators. @@ -66,7 +66,7 @@ module Rails end def engine_metal_paths - engines.collect(&:metal_path) + engines.collect {|engine| engine.metal_path } end protected @@ -79,18 +79,18 @@ module Rails end def add_engine_routing_configurations - engines.select(&:routed?).collect(&:routing_file).each do |routing_file| + engines.select {|engine| engine.routed? }.map {|engine| engine.routing_file }.each do |routing_file| ActionController::Routing::Routes.add_configuration_file(routing_file) end end def add_engine_controller_paths - ActionController::Routing.controller_paths += engines.collect(&:controller_path) + ActionController::Routing.controller_paths += engines.collect {|engine| engine.controller_path } end def add_engine_view_paths # reverse it such that the last engine can overwrite view paths from the first, like with routes - paths = ActionView::PathSet.new(engines.collect(&:view_path).reverse) + paths = ActionView::PathSet.new(engines.collect {|engine| engine.view_path }.reverse) ActionController::Base.view_paths.concat(paths) ActionMailer::Base.view_paths.concat(paths) if configuration.frameworks.include?(:action_mailer) end @@ -170,7 +170,7 @@ module Rails # so we load all in alphabetical order. If it is an empty array, we load no plugins, if it is # non empty, we load the named plugins in the order specified. def registered_plugin_names - configuration.plugins ? configuration.plugins.map(&:to_s) : nil + configuration.plugins ? configuration.plugins.map {|plugin| plugin.to_s } : nil end def loaded?(plugin_name) diff --git a/railties/lib/rails/plugin/locator.rb b/railties/lib/rails/plugin/locator.rb index a6fc388a8e..1057c004e0 100644 --- a/railties/lib/rails/plugin/locator.rb +++ b/railties/lib/rails/plugin/locator.rb @@ -25,7 +25,7 @@ module Rails end def plugin_names - plugins.map(&:name) + plugins.map {|plugin| plugin.name } end end diff --git a/railties/lib/rails_generator/generators/applications/app/template_runner.rb b/railties/lib/rails_generator/generators/applications/app/template_runner.rb index 3b49b1fa92..0e24d11950 100644 --- a/railties/lib/rails_generator/generators/applications/app/template_runner.rb +++ b/railties/lib/rails_generator/generators/applications/app/template_runner.rb @@ -227,7 +227,7 @@ module Rails # def generate(what, *args) log 'generating', what - argument = args.map(&:to_s).flatten.join(" ") + argument = args.map {|arg| arg.to_s }.flatten.join(" ") in_root { run_ruby_script("script/generate #{what} #{argument}", false) } end diff --git a/railties/lib/rails_generator/generators/components/model/templates/model.rb b/railties/lib/rails_generator/generators/components/model/templates/model.rb index 6fcf393bdf..0656b06dfe 100644 --- a/railties/lib/rails_generator/generators/components/model/templates/model.rb +++ b/railties/lib/rails_generator/generators/components/model/templates/model.rb @@ -1,5 +1,5 @@ class <%= class_name %> < ActiveRecord::Base -<% attributes.select(&:reference?).each do |attribute| -%> +<% attributes.select {|attr| attr.reference? }.each do |attribute| -%> belongs_to :<%= attribute.name %> <% end -%> end diff --git a/railties/lib/rails_generator/scripts.rb b/railties/lib/rails_generator/scripts.rb index 9b1a99838a..3763b75dba 100644 --- a/railties/lib/rails_generator/scripts.rb +++ b/railties/lib/rails_generator/scripts.rb @@ -57,7 +57,7 @@ module Rails usage << <<end_blurb -More are available at http://wiki.rubyonrails.org/rails/pages/AvailableGenerators +You can also install additional generators for your own use: 1. Download, for example, login_generator.zip 2. Unzip to directory #{Dir.user_home}/.rails/generators/login to use the generator with all your Rails apps diff --git a/railties/lib/tasks/gems.rake b/railties/lib/tasks/gems.rake index 7cf7061f38..e496e1a04f 100644 --- a/railties/lib/tasks/gems.rake +++ b/railties/lib/tasks/gems.rake @@ -20,7 +20,7 @@ namespace :gems do desc "Build any native extensions for unpacked gems" task :build do $gems_build_rake_task = true - frozen_gems.each &:build + frozen_gems.each {|gem| gem.build } end namespace :build do @@ -33,12 +33,12 @@ namespace :gems do desc "Installs all required gems." task :install => :base do - current_gems.each &:install + current_gems.each {|gem| gem.install } end desc "Unpacks all required gems into vendor/gems." task :unpack => :install do - current_gems.each &:unpack + current_gems.each {|gem| gem.unpack } end namespace :unpack do @@ -50,7 +50,7 @@ namespace :gems do desc "Regenerate gem specifications in correct format." task :refresh_specs => :base do - current_gems.each &:refresh + current_gems.each {|gem| gem.refresh } end end diff --git a/railties/test/rails_info_test.rb b/railties/test/rails_info_test.rb index 971cba89d0..fdcc7a1ef6 100644 --- a/railties/test/rails_info_test.rb +++ b/railties/test/rails_info_test.rb @@ -14,6 +14,8 @@ unless defined?(Rails) && defined?(Rails::Info) end end +require "active_support/core_ext/kernel/reporting" + class InfoTest < ActiveSupport::TestCase def setup Rails.send :remove_const, :Info |