Permalink
Browse files

Get Railties passing again

  • Loading branch information...
1 parent db1bf36 commit 4fa871654dc6e591c08cbc53e7eac2e008056fee @wycats wycats committed May 16, 2009
@@ -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 @@ def to_s
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 @@ def git_info
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.
@@ -311,7 +311,7 @@ def load_gems
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
@@ -24,7 +24,7 @@ def plugins
# 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 @@ def add_plugin_load_paths
end
def engine_metal_paths
- engines.collect(&:metal_path)
+ engines.collect {|engine| engine.metal_path }
end
protected
@@ -79,18 +79,18 @@ def configure_engines
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 @@ def registered_plugins_names_plugin?(plugin)
# 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)
@@ -25,7 +25,7 @@ def each(&block)
end
def plugin_names
- plugins.map(&:name)
+ plugins.map {|plugin| plugin.name }
end
end
@@ -227,7 +227,7 @@ def initializer(filename, data = nil, &block)
#
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
@@ -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
@@ -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
@@ -14,6 +14,8 @@ class Info; end
end
end
+require "active_support/core_ext/kernel/reporting"
+
class InfoTest < ActiveSupport::TestCase
def setup
Rails.send :remove_const, :Info

0 comments on commit 4fa8716

Please sign in to comment.