Merge branch 'master' of git@github.com:rails/rails_upgrade
This commit is contained in:
commit
e08de4f169
@ -15,7 +15,8 @@ module Rails
|
|||||||
|
|
||||||
# Run all the check methods
|
# Run all the check methods
|
||||||
def run
|
def run
|
||||||
the_methods = (self.public_methods - Object.methods) - ["run", "initialize"]
|
# Ruby 1.8 returns method names as strings whereas 1.9 uses symbols
|
||||||
|
the_methods = (self.public_methods - Object.methods) - [:run, :initialize, "run", "initialize"]
|
||||||
|
|
||||||
the_methods.each {|m| send m }
|
the_methods.each {|m| send m }
|
||||||
end
|
end
|
||||||
@ -23,7 +24,7 @@ module Rails
|
|||||||
# Check for deprecated ActiveRecord calls
|
# Check for deprecated ActiveRecord calls
|
||||||
def check_ar_methods
|
def check_ar_methods
|
||||||
files = []
|
files = []
|
||||||
["find(:all", "find(:first", ":conditions =>", ":joins =>"].each do |v|
|
["find(:all", "find(:first", "find.*:conditions =>", ":joins =>"].each do |v|
|
||||||
lines = grep_for(v, "app/")
|
lines = grep_for(v, "app/")
|
||||||
files += extract_filenames(lines) || []
|
files += extract_filenames(lines) || []
|
||||||
end
|
end
|
||||||
@ -251,9 +252,9 @@ module Rails
|
|||||||
value = ""
|
value = ""
|
||||||
# Specifically double quote for finding 'test_help'
|
# Specifically double quote for finding 'test_help'
|
||||||
command = if double_quote
|
command = if double_quote
|
||||||
"grep -r \"#{text}\" #{where}"
|
"grep -r --exclude=\*.svn\* \"#{text}\" #{where}"
|
||||||
else
|
else
|
||||||
"grep -r '#{text}' #{where}"
|
"grep -r --exclude=\*.svn\* '#{text}' #{where}"
|
||||||
end
|
end
|
||||||
|
|
||||||
Open3.popen3(command) do |stdin, stdout, stderr|
|
Open3.popen3(command) do |stdin, stdout, stderr|
|
||||||
@ -326,7 +327,7 @@ module Rails
|
|||||||
puts "More information: #{more_info_url}"
|
puts "More information: #{more_info_url}"
|
||||||
puts
|
puts
|
||||||
puts "The culprits: "
|
puts "The culprits: "
|
||||||
culprits.each do |c|
|
Array(culprits).each do |c|
|
||||||
puts "\t- #{c}"
|
puts "\t- #{c}"
|
||||||
end
|
end
|
||||||
puts
|
puts
|
||||||
@ -339,7 +340,7 @@ module Rails
|
|||||||
puts "#{BOLD}More information:#{CLEAR} #{CYAN}#{more_info_url}"
|
puts "#{BOLD}More information:#{CLEAR} #{CYAN}#{more_info_url}"
|
||||||
puts
|
puts
|
||||||
puts "#{WHITE}The culprits: "
|
puts "#{WHITE}The culprits: "
|
||||||
culprits.each do |c|
|
Array(culprits).each do |c|
|
||||||
puts "#{YELLOW}\t- #{c}"
|
puts "#{YELLOW}\t- #{c}"
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
|
@ -327,7 +327,7 @@ module Rails
|
|||||||
r.to_route_code
|
r.to_route_code
|
||||||
end.join("\n")
|
end.join("\n")
|
||||||
|
|
||||||
"#{app_name.classify}::Application.routes do\n#{@new_code}\nend\n"
|
"#{app_name.classify}::Application.routes.draw do\n#{@new_code}\nend\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$:.unshift(File.dirname(__FILE__) + "/../lib")
|
$:.unshift(File.dirname(__FILE__) + "/../../lib")
|
||||||
require 'routes_upgrader'
|
require 'routes_upgrader'
|
||||||
require 'gemfile_generator'
|
require 'gemfile_generator'
|
||||||
require 'application_checker'
|
require 'application_checker'
|
@ -40,7 +40,7 @@ class RoutesUpgraderTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
"
|
"
|
||||||
|
|
||||||
new_routes_code = "MyApplication::Application.routes do
|
new_routes_code = "MyApplication::Application.routes.draw do
|
||||||
match '/home' => 'home#index'
|
match '/home' => 'home#index'
|
||||||
match '/login' => 'sessions#new', :as => :login
|
match '/login' => 'sessions#new', :as => :login
|
||||||
resources :hats
|
resources :hats
|
||||||
@ -101,7 +101,7 @@ end
|
|||||||
end
|
end
|
||||||
"
|
"
|
||||||
|
|
||||||
new_routes_code = "MyApplication::Application.routes do
|
new_routes_code = "MyApplication::Application.routes.draw do
|
||||||
match '/' => 'home#index'
|
match '/' => 'home#index'
|
||||||
end
|
end
|
||||||
"
|
"
|
||||||
@ -122,7 +122,7 @@ end
|
|||||||
end
|
end
|
||||||
"
|
"
|
||||||
|
|
||||||
new_routes_code = "MyApplication::Application.routes do
|
new_routes_code = "MyApplication::Application.routes.draw do
|
||||||
match '/:controller(/:action(/:id))'
|
match '/:controller(/:action(/:id))'
|
||||||
end
|
end
|
||||||
"
|
"
|
||||||
|
Loading…
Reference in New Issue
Block a user