More Warnings removed for ruby trunk

Same as 4d4ff531b8
This commit is contained in:
Arun Agrawal 2013-11-01 10:39:06 +01:00
parent 026b6daa05
commit c10a78124c
19 changed files with 30 additions and 30 deletions

View File

@ -30,7 +30,7 @@ gem 'dalli', '>= 2.2.1'
# Add your own local bundler stuff
local_gemfile = File.dirname(__FILE__) + "/.Gemfile"
instance_eval File.read local_gemfile if File.exists? local_gemfile
instance_eval File.read local_gemfile if File.exist? local_gemfile
group :test do
platforms :mri_19 do

View File

@ -206,7 +206,7 @@ module ActiveRecord
@connection.expects(:schema_search_path).returns("foo")
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, filename)
assert File.exists?(filename)
assert File.exist?(filename)
ensure
FileUtils.rm(filename)
end

View File

@ -2,7 +2,7 @@
git_path = File.join(File.expand_path('../../..', __FILE__), '.git')
if File.exists?(git_path)
if File.exist?(git_path)
railties_path = File.expand_path('../../lib', __FILE__)
$:.unshift(railties_path)
end

View File

@ -55,7 +55,7 @@ EOS
end
def self.find_executable
EXECUTABLES.find { |exe| File.exists?(exe) }
EXECUTABLES.find { |exe| File.exist?(exe) }
end
end
end

View File

@ -139,7 +139,7 @@ EOT
# This allows us to run `rails server` from other directories, but still get
# the main config.ru and properly set the tmp directory.
def set_application_directory!
Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path("config.ru"))
Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exist?(File.expand_path("config.ru"))
end
def require_application_and_environment!

View File

@ -212,7 +212,7 @@ module Rails
return unless base_name && generator_name
return unless default_generator_root
path = File.join(default_generator_root, 'templates')
path if File.exists?(path)
path if File.exist?(path)
end
# Returns the base root for a common set of generators. This is used to dynamically
@ -369,12 +369,12 @@ module Rails
source_root && File.expand_path("../USAGE", source_root),
default_generator_root && File.join(default_generator_root, "USAGE")
]
paths.compact.detect { |path| File.exists? path }
paths.compact.detect { |path| File.exist? path }
end
def self.default_generator_root
path = File.expand_path(File.join(base_name, generator_name), base_root)
path if File.exists?(path)
path if File.exist?(path)
end
end

View File

@ -369,7 +369,7 @@ module Rails
end
def insert_railsrc_into_argv!(argv, railsrc)
return argv unless File.exists?(railsrc)
return argv unless File.exist?(railsrc)
extra_args = read_rc_file railsrc
argv.take(1) + extra_args + argv.drop(1)
end

View File

@ -1,4 +1,4 @@
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

View File

@ -319,7 +319,7 @@ task default: :test
@application_definition ||= begin
dummy_application_path = File.expand_path("#{dummy_path}/config/application.rb", destination_root)
unless options[:pretend] || !File.exists?(dummy_application_path)
unless options[:pretend] || !File.exist?(dummy_application_path)
contents = File.read(dummy_application_path)
contents[(contents.index(/module ([\w]+)\n(.*)class Application/m))..-1]
end

View File

@ -1,5 +1,5 @@
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)

View File

@ -22,7 +22,7 @@ module Rails
# end
def assert_file(relative, *contents)
absolute = File.expand_path(relative, destination_root).shellescape
assert File.exists?(absolute), "Expected file #{relative.inspect} to exist, but does not"
assert File.exist?(absolute), "Expected file #{relative.inspect} to exist, but does not"
read = File.read(absolute) if block_given? || !contents.empty?
yield read if block_given?
@ -44,7 +44,7 @@ module Rails
# assert_no_file "config/random.rb"
def assert_no_file(relative)
absolute = File.expand_path(relative, destination_root)
assert !File.exists?(absolute), "Expected file #{relative.inspect} to not exist, but does"
assert !File.exist?(absolute), "Expected file #{relative.inspect} to not exist, but does"
end
alias :assert_no_directory :assert_no_file

View File

@ -7,7 +7,7 @@ module Rails
path = Pathname.new(log || "#{::File.expand_path(Rails.root)}/log/#{Rails.env}.log").cleanpath
@cursor = @file = nil
if ::File.exists?(path)
if ::File.exist?(path)
@cursor = ::File.size(path)
@file = ::File.open(path, 'r')
end

View File

@ -46,7 +46,7 @@ namespace :rails do
require 'rails/generators/rails/app/app_generator'
gen = Rails::Generators::AppGenerator.new ["rails"], { with_dispatchers: true },
destination_root: Rails.root
File.exists?(Rails.root.join("config", "application.rb")) ?
File.exist?(Rails.root.join("config", "application.rb")) ?
gen.send(:app_const) : gen.send(:valid_const?)
gen
end

View File

@ -10,7 +10,7 @@ namespace :log do
if ENV['LOGS']
ENV['LOGS'].split(',')
.map { |file| "log/#{file.strip}.log" }
.select { |file| File.exists?(file) }
.select { |file| File.exist?(file) }
else
FileList["log/*.log"]
end

View File

@ -37,7 +37,7 @@ module ApplicationTests
end
def assert_no_file_exists(filename)
assert !File.exists?(filename), "#{filename} does exist"
assert !File.exist?(filename), "#{filename} does exist"
end
test "assets routes have higher priority" do

View File

@ -33,12 +33,12 @@ module ApplicationTests
Dir.chdir(app_path) do
output = `bundle exec rake db:create`
assert_equal output, ""
assert File.exists?(expected[:database])
assert File.exist?(expected[:database])
assert_equal expected[:database],
ActiveRecord::Base.connection_config[:database]
output = `bundle exec rake db:drop`
assert_equal output, ""
assert !File.exists?(expected[:database])
assert !File.exist?(expected[:database])
end
end

View File

@ -227,7 +227,7 @@ module ApplicationTests
# ensure we have a schema_migrations table to dump
`bundle exec rake db:migrate db:structure:dump DB_STRUCTURE=db/my_structure.sql`
end
assert File.exists?(File.join(app_path, 'db', 'my_structure.sql'))
assert File.exist?(File.join(app_path, 'db', 'my_structure.sql'))
end
def test_rake_dump_structure_should_be_called_twice_when_migrate_redo
@ -248,24 +248,24 @@ module ApplicationTests
rails generate model product name:string;
bundle exec rake db:migrate db:schema:cache:dump`
end
assert File.exists?(File.join(app_path, 'db', 'schema_cache.dump'))
assert File.exist?(File.join(app_path, 'db', 'schema_cache.dump'))
end
def test_rake_clear_schema_cache
Dir.chdir(app_path) do
`bundle exec rake db:schema:cache:dump db:schema:cache:clear`
end
assert !File.exists?(File.join(app_path, 'db', 'schema_cache.dump'))
assert !File.exist?(File.join(app_path, 'db', 'schema_cache.dump'))
end
def test_copy_templates
Dir.chdir(app_path) do
`bundle exec rake rails:templates:copy`
%w(controller mailer scaffold).each do |dir|
assert File.exists?(File.join(app_path, 'lib', 'templates', 'erb', dir))
assert File.exist?(File.join(app_path, 'lib', 'templates', 'erb', dir))
end
%w(controller helper scaffold_controller assets).each do |dir|
assert File.exists?(File.join(app_path, 'lib', 'templates', 'rails', dir))
assert File.exist?(File.join(app_path, 'lib', 'templates', 'rails', dir))
end
end
end

View File

@ -15,7 +15,7 @@ class GeneratorsTest < Rails::Generators::TestCase
end
def test_simple_invoke
assert File.exists?(File.join(@path, 'generators', 'model_generator.rb'))
assert File.exist?(File.join(@path, 'generators', 'model_generator.rb'))
TestUnit::Generators::ModelGenerator.expects(:start).with(["Account"], {})
Rails::Generators.invoke("test_unit:model", ["Account"])
end
@ -31,7 +31,7 @@ class GeneratorsTest < Rails::Generators::TestCase
end
def test_should_give_higher_preference_to_rails_generators
assert File.exists?(File.join(@path, 'generators', 'model_generator.rb'))
assert File.exist?(File.join(@path, 'generators', 'model_generator.rb'))
Rails::Generators::ModelGenerator.expects(:start).with(["Account"], {})
warnings = capture(:stderr){ Rails::Generators.invoke :model, ["Account"] }
assert warnings.empty?

View File

@ -90,8 +90,8 @@ module RailtiesTest
Dir.chdir(app_path) do
output = `bundle exec rake bukkits:install:migrations`
assert File.exists?("#{app_path}/db/migrate/2_create_users.bukkits.rb")
assert File.exists?("#{app_path}/db/migrate/3_add_last_name_to_users.bukkits.rb")
assert File.exist?("#{app_path}/db/migrate/2_create_users.bukkits.rb")
assert File.exist?("#{app_path}/db/migrate/3_add_last_name_to_users.bukkits.rb")
assert_match(/Copied migration 2_create_users.bukkits.rb from bukkits/, output)
assert_match(/Copied migration 3_add_last_name_to_users.bukkits.rb from bukkits/, output)
assert_match(/NOTE: Migration 3_create_sessions.rb from bukkits has been skipped/, output)
@ -136,7 +136,7 @@ module RailtiesTest
Dir.chdir(@plugin.path) do
output = `bundle exec rake app:bukkits:install:migrations`
assert File.exists?("#{app_path}/db/migrate/0_add_first_name_to_users.bukkits.rb")
assert File.exist?("#{app_path}/db/migrate/0_add_first_name_to_users.bukkits.rb")
assert_match(/Copied migration 0_add_first_name_to_users.bukkits.rb from bukkits/, output)
assert_equal 1, Dir["#{app_path}/db/migrate/*.rb"].length
end