Skip to content

Commit

Permalink
Warnings removed for ruby trunk
Browse files Browse the repository at this point in the history
Same as 4d4ff53
  • Loading branch information
arunagw committed Nov 1, 2013
1 parent 1adcebd commit 8161268
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion actionview/test/template/render_test.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/migration.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/railties/databases.rake
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/tasks/database_tasks.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/helper.rb
Expand Up @@ -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
Expand Down
38 changes: 19 additions & 19 deletions activerecord/test/cases/migration_test.rb
Expand Up @@ -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)"
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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"})
Expand All @@ -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)"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions activerecord/test/cases/tasks/sqlite_rake_test.rb
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion activesupport/lib/active_support/core_ext/file/atomic.rb
Expand Up @@ -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
Expand Down

0 comments on commit 8161268

Please sign in to comment.