提交 2e7ee652 编写于 作者: S Santiago Pastorino

Merge pull request #12727 from arunagw/aa-warnings-removed-ruby-trunk

Warnings removed for ruby trunk
......@@ -96,7 +96,7 @@ def backtrace_cleaner
def source_fragment(path, line)
return unless Rails.respond_to?(:root) && Rails.root
full_path = Rails.root.join(path)
if File.exists?(full_path)
if File.exist?(full_path)
File.open(full_path, "r") do |file|
start = [line - 3, 0].max
lines = file.each_line.drop(start).take(6)
......
......@@ -381,7 +381,7 @@ def test_render_knows_about_types_registered_when_extensions_are_checked_earlier
def test_render_ignores_templates_with_malformed_template_handlers
ActiveSupport::Deprecation.silence do
%w(malformed malformed.erb malformed.html.erb malformed.en.html.erb).each do |name|
assert File.exists?(File.expand_path("#{FIXTURE_LOAD_PATH}/test/malformed/#{name}~")), "Malformed file (#{name}~) which should be ignored does not exists"
assert File.exist?(File.expand_path("#{FIXTURE_LOAD_PATH}/test/malformed/#{name}~")), "Malformed file (#{name}~) which should be ignored does not exists"
assert_raises(ActionView::MissingTemplate) { @view.render(:file => "test/malformed/#{name}") }
end
end
......
......@@ -629,7 +629,7 @@ def method_missing(method, *arguments, &block)
def copy(destination, sources, options = {})
copied = []
FileUtils.mkdir_p(destination) unless File.exists?(destination)
FileUtils.mkdir_p(destination) unless File.exist?(destination)
destination_migrations = ActiveRecord::Migrator.migrations(destination)
last = destination_migrations.last
......
......@@ -271,7 +271,7 @@ db_namespace = namespace :db do
desc 'Clear a db/schema_cache.dump file.'
task :clear => [:environment, :load_config] do
filename = File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, "schema_cache.dump")
FileUtils.rm(filename) if File.exists?(filename)
FileUtils.rm(filename) if File.exist?(filename)
end
end
......
......@@ -146,7 +146,7 @@ def structure_load(*arguments)
end
def check_schema_file(filename)
unless File.exists?(filename)
unless File.exist?(filename)
message = %{#{filename} doesn't exist yet. Run `rake db:migrate` to create it, then try again.}
message << %{ If you do not intend to use a database, you should instead alter #{Rails.root}/config/application.rb to limit the frameworks that will be loaded.} if defined?(::Rails)
Kernel.abort message
......
......@@ -140,7 +140,7 @@ def load_schema
load SCHEMA_ROOT + "/schema.rb"
if File.exists?(adapter_specific_schema_file)
if File.exist?(adapter_specific_schema_file)
load adapter_specific_schema_file
end
ensure
......
......@@ -710,8 +710,8 @@ def test_copying_migrations_without_timestamps
@existing_migrations = Dir[@migrations_path + "/*.rb"]
copied = ActiveRecord::Migration.copy(@migrations_path, {:bukkits => MIGRATIONS_ROOT + "/to_copy"})
assert File.exists?(@migrations_path + "/4_people_have_hobbies.bukkits.rb")
assert File.exists?(@migrations_path + "/5_people_have_descriptions.bukkits.rb")
assert File.exist?(@migrations_path + "/4_people_have_hobbies.bukkits.rb")
assert File.exist?(@migrations_path + "/5_people_have_descriptions.bukkits.rb")
assert_equal [@migrations_path + "/4_people_have_hobbies.bukkits.rb", @migrations_path + "/5_people_have_descriptions.bukkits.rb"], copied.map(&:filename)
expected = "# This migration comes from bukkits (originally 1)"
......@@ -734,10 +734,10 @@ def test_copying_migrations_without_timestamps_from_2_sources
sources[:bukkits] = MIGRATIONS_ROOT + "/to_copy"
sources[:omg] = MIGRATIONS_ROOT + "/to_copy2"
ActiveRecord::Migration.copy(@migrations_path, sources)
assert File.exists?(@migrations_path + "/4_people_have_hobbies.bukkits.rb")
assert File.exists?(@migrations_path + "/5_people_have_descriptions.bukkits.rb")
assert File.exists?(@migrations_path + "/6_create_articles.omg.rb")
assert File.exists?(@migrations_path + "/7_create_comments.omg.rb")
assert File.exist?(@migrations_path + "/4_people_have_hobbies.bukkits.rb")
assert File.exist?(@migrations_path + "/5_people_have_descriptions.bukkits.rb")
assert File.exist?(@migrations_path + "/6_create_articles.omg.rb")
assert File.exist?(@migrations_path + "/7_create_comments.omg.rb")
files_count = Dir[@migrations_path + "/*.rb"].length
ActiveRecord::Migration.copy(@migrations_path, sources)
......@@ -752,8 +752,8 @@ def test_copying_migrations_with_timestamps
Time.travel_to(Time.utc(2010, 7, 26, 10, 10, 10)) do
copied = ActiveRecord::Migration.copy(@migrations_path, {:bukkits => MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
assert File.exists?(@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb")
assert File.exists?(@migrations_path + "/20100726101011_people_have_descriptions.bukkits.rb")
assert File.exist?(@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb")
assert File.exist?(@migrations_path + "/20100726101011_people_have_descriptions.bukkits.rb")
expected = [@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb",
@migrations_path + "/20100726101011_people_have_descriptions.bukkits.rb"]
assert_equal expected, copied.map(&:filename)
......@@ -777,10 +777,10 @@ def test_copying_migrations_with_timestamps_from_2_sources
Time.travel_to(Time.utc(2010, 7, 26, 10, 10, 10)) do
copied = ActiveRecord::Migration.copy(@migrations_path, sources)
assert File.exists?(@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb")
assert File.exists?(@migrations_path + "/20100726101011_people_have_descriptions.bukkits.rb")
assert File.exists?(@migrations_path + "/20100726101012_create_articles.omg.rb")
assert File.exists?(@migrations_path + "/20100726101013_create_comments.omg.rb")
assert File.exist?(@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb")
assert File.exist?(@migrations_path + "/20100726101011_people_have_descriptions.bukkits.rb")
assert File.exist?(@migrations_path + "/20100726101012_create_articles.omg.rb")
assert File.exist?(@migrations_path + "/20100726101013_create_comments.omg.rb")
assert_equal 4, copied.length
files_count = Dir[@migrations_path + "/*.rb"].length
......@@ -797,8 +797,8 @@ def test_copying_migrations_with_timestamps_to_destination_with_timestamps_in_fu
Time.travel_to(Time.utc(2010, 2, 20, 10, 10, 10)) do
ActiveRecord::Migration.copy(@migrations_path, {:bukkits => MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
assert File.exists?(@migrations_path + "/20100301010102_people_have_hobbies.bukkits.rb")
assert File.exists?(@migrations_path + "/20100301010103_people_have_descriptions.bukkits.rb")
assert File.exist?(@migrations_path + "/20100301010102_people_have_hobbies.bukkits.rb")
assert File.exist?(@migrations_path + "/20100301010103_people_have_descriptions.bukkits.rb")
files_count = Dir[@migrations_path + "/*.rb"].length
copied = ActiveRecord::Migration.copy(@migrations_path, {:bukkits => MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
......@@ -815,7 +815,7 @@ def test_copying_migrations_preserving_magic_comments
@existing_migrations = Dir[@migrations_path + "/*.rb"]
copied = ActiveRecord::Migration.copy(@migrations_path, {:bukkits => MIGRATIONS_ROOT + "/magic"})
assert File.exists?(@migrations_path + "/4_currencies_have_symbols.bukkits.rb")
assert File.exist?(@migrations_path + "/4_currencies_have_symbols.bukkits.rb")
assert_equal [@migrations_path + "/4_currencies_have_symbols.bukkits.rb"], copied.map(&:filename)
expected = "# coding: ISO-8859-15\n# This migration comes from bukkits (originally 1)"
......@@ -872,8 +872,8 @@ def test_copying_migrations_to_non_existing_directory
Time.travel_to(Time.utc(2010, 7, 26, 10, 10, 10)) do
copied = ActiveRecord::Migration.copy(@migrations_path, {:bukkits => MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
assert File.exists?(@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb")
assert File.exists?(@migrations_path + "/20100726101011_people_have_descriptions.bukkits.rb")
assert File.exist?(@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb")
assert File.exist?(@migrations_path + "/20100726101011_people_have_descriptions.bukkits.rb")
assert_equal 2, copied.length
end
ensure
......@@ -887,8 +887,8 @@ def test_copying_migrations_to_empty_directory
Time.travel_to(Time.utc(2010, 7, 26, 10, 10, 10)) do
copied = ActiveRecord::Migration.copy(@migrations_path, {:bukkits => MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
assert File.exists?(@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb")
assert File.exists?(@migrations_path + "/20100726101011_people_have_descriptions.bukkits.rb")
assert File.exist?(@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb")
assert File.exist?(@migrations_path + "/20100726101011_people_have_descriptions.bukkits.rb")
assert_equal 2, copied.length
end
ensure
......
......@@ -159,8 +159,8 @@ def test_structure_dump
filename = "awesome-file.sql"
ActiveRecord::Tasks::DatabaseTasks.structure_dump @configuration, filename, '/rails/root'
assert File.exists?(dbfile)
assert File.exists?(filename)
assert File.exist?(dbfile)
assert File.exist?(filename)
ensure
FileUtils.rm_f(filename)
FileUtils.rm_f(dbfile)
......@@ -182,7 +182,7 @@ def test_structure_load
open(filename, 'w') { |f| f.puts("select datetime('now', 'localtime');") }
ActiveRecord::Tasks::DatabaseTasks.structure_load @configuration, filename, '/rails/root'
assert File.exists?(dbfile)
assert File.exist?(dbfile)
ensure
FileUtils.rm_f(filename)
FileUtils.rm_f(dbfile)
......
......@@ -23,7 +23,7 @@ def self.atomic_write(file_name, temp_dir = Dir.tmpdir)
yield temp_file
temp_file.close
if File.exists?(file_name)
if File.exist?(file_name)
# Get original file permissions
old_stat = stat(file_name)
else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册