diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-10 05:54:46 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-10 05:54:46 +0000 |
commit | b1ce7e4d4ada3eedc361d90b637ca06274a0ac3d (patch) | |
tree | affedc3593d216a6b5c4d1c27f84a0b3c7b19e46 /railties/lib | |
parent | c81fff2468bbf597457bf57cd599d2d4be77c715 (diff) | |
download | rails-b1ce7e4d4ada3eedc361d90b637ca06274a0ac3d.tar.gz rails-b1ce7e4d4ada3eedc361d90b637ca06274a0ac3d.tar.bz2 rails-b1ce7e4d4ada3eedc361d90b637ca06274a0ac3d.zip |
Ruby 1.9 compat: File.exists\? -> File.exist\? en masse. References #1689 [Pratik Naik]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8365 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/commands/plugin.rb | 4 | ||||
-rw-r--r-- | railties/lib/commands/runner.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails_generator/commands.rb | 8 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/applications/app/app_generator.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails_generator/secret_key_generator.rb | 2 |
5 files changed, 9 insertions, 9 deletions
diff --git a/railties/lib/commands/plugin.rb b/railties/lib/commands/plugin.rb index ecef450ff4..a26f747dfb 100644 --- a/railties/lib/commands/plugin.rb +++ b/railties/lib/commands/plugin.rb @@ -214,12 +214,12 @@ class Plugin def run_install_hook install_hook_file = "#{rails_env.root}/vendor/plugins/#{name}/install.rb" - load install_hook_file if File.exists? install_hook_file + load install_hook_file if File.exist? install_hook_file end def run_uninstall_hook uninstall_hook_file = "#{rails_env.root}/vendor/plugins/#{name}/uninstall.rb" - load uninstall_hook_file if File.exists? uninstall_hook_file + load uninstall_hook_file if File.exist? uninstall_hook_file end def install_using_export(options = {}) diff --git a/railties/lib/commands/runner.rb b/railties/lib/commands/runner.rb index 62db8b75e1..926bc26344 100644 --- a/railties/lib/commands/runner.rb +++ b/railties/lib/commands/runner.rb @@ -41,7 +41,7 @@ require RAILS_ROOT + '/config/environment' if code_or_file.nil? $stderr.puts "Run '#{$0} -h' for help." exit 1 -elsif File.exists?(code_or_file) +elsif File.exist?(code_or_file) eval(File.read(code_or_file)) else eval(code_or_file) diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb index 98531d9771..6f90a44b8a 100644 --- a/railties/lib/rails_generator/commands.rb +++ b/railties/lib/rails_generator/commands.rb @@ -207,7 +207,7 @@ HELP # Determine full paths for source and destination files. source = source_path(relative_source) destination = destination_path(relative_destination) - destination_exists = File.exists?(destination) + destination_exists = File.exist?(destination) # If source and destination are identical then we're done. if destination_exists and identical?(source, destination, &block) @@ -306,7 +306,7 @@ HELP # Always directories which exist. def directory(relative_path) path = destination_path(relative_path) - if File.exists?(path) + if File.exist?(path) logger.exists relative_path else logger.create relative_path @@ -415,7 +415,7 @@ end_message # Remove a file if it exists and is a file. def file(relative_source, relative_destination, file_options = {}) destination = destination_path(relative_destination) - if File.exists?(destination) + if File.exist?(destination) logger.rm relative_destination unless options[:pretend] if options[:svn] @@ -450,7 +450,7 @@ end_message until parts.empty? partial = File.join(parts) path = destination_path(partial) - if File.exists?(path) + if File.exist?(path) if Dir[File.join(path, '*')].empty? logger.rmdir partial unless options[:pretend] 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 02d9b0fb88..915b15317f 100644 --- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb +++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb @@ -128,7 +128,7 @@ class AppGenerator < Rails::Generator::Base end def mysql_socket_location - MYSQL_SOCKET_LOCATIONS.find { |f| File.exists?(f) } unless RUBY_PLATFORM =~ /(:?mswin|mingw)/ + MYSQL_SOCKET_LOCATIONS.find { |f| File.exist?(f) } unless RUBY_PLATFORM =~ /(:?mswin|mingw)/ end diff --git a/railties/lib/rails_generator/secret_key_generator.rb b/railties/lib/rails_generator/secret_key_generator.rb index f488f96f32..497df72ce9 100644 --- a/railties/lib/rails_generator/secret_key_generator.rb +++ b/railties/lib/rails_generator/secret_key_generator.rb @@ -141,7 +141,7 @@ module Rails end def self.supports_urandom? - File.exists?('/dev/urandom') + File.exist?('/dev/urandom') end def self.supports_openssl? |