Skip to content

Commit 3e65376

Browse files
committed
Replace File.exists? with File.exist?
Fixes Compass#2169 Closes Compass#2167 Signed-off-by: Jeff Byrnes <[email protected]>
1 parent 4de0147 commit 3e65376

File tree

21 files changed

+42
-42
lines changed

21 files changed

+42
-42
lines changed

cli/features/step_definitions/command_line_steps.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@
114114
end
115115

116116
Then /an? \w+ file ([^ ]+) is (not )?removed/ do |filename, negated|
117-
File.exists?(filename).should == !!negated
117+
File.exist?(filename).should == !!negated
118118
end
119119

120120
Then /an? \w+ file ([^ ]+) is (not )?created/ do |filename, negated|
121-
File.exists?(filename).should == !negated
121+
File.exist?(filename).should == !negated
122122
end
123123

124124
Then "the following files are reported removed:" do |table|

cli/lib/compass/actions.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def copy(from, to, options = nil, binary = false)
2222
def directory(dir, options = nil)
2323
options ||= self.options if self.respond_to?(:options)
2424
options ||= {}
25-
if File.exists?(dir) && File.directory?(dir)
25+
if File.exist?(dir) && File.directory?(dir)
2626
# do nothing
27-
elsif File.exists?(dir)
27+
elsif File.exist?(dir)
2828
msg = "#{basename(dir)} already exists and is not a directory."
2929
raise Compass::FilesystemConflict.new(msg)
3030
else
@@ -38,7 +38,7 @@ def write_file(file_name, contents, options = nil, binary = false)
3838
options ||= self.options if self.respond_to?(:options)
3939
skip_write = false
4040
contents = process_erb(contents, options[:erb]) if options[:erb]
41-
if File.exists?(file_name)
41+
if File.exist?(file_name)
4242
existing_contents = IO.read(file_name)
4343
if existing_contents == contents
4444
log_action :identical, basename(file_name), options
@@ -73,7 +73,7 @@ def remove(file_name)
7373
if File.directory?(file_name)
7474
FileUtils.rm_rf file_name
7575
log_action :remove, basename(file_name)+"/", options
76-
elsif File.exists?(file_name)
76+
elsif File.exist?(file_name)
7777
File.unlink file_name
7878
log_action :remove, basename(file_name), options
7979
end

cli/lib/compass/app_integration/stand_alone/installer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def write_configuration_files(config_file = nil)
2121
end
2222

2323
def config_files_exist?
24-
File.exists? targetize('config.rb')
24+
File.exist? targetize('config.rb')
2525
end
2626

2727
def config_contents

cli/lib/compass/commands/project_base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def project_images_subdirectory
6060
end
6161

6262
def assert_project_directory_exists!
63-
if File.exists?(project_directory) && !File.directory?(project_directory)
63+
if File.exist?(project_directory) && !File.directory?(project_directory)
6464
raise Compass::FilesystemConflict.new("#{project_directory} is not a directory.")
6565
elsif !File.directory?(project_directory)
6666
raise Compass::Error.new("#{project_directory} does not exist.")

cli/lib/compass/commands/project_stats.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def sass_columns(sass_file)
121121
end
122122

123123
def css_columns(css_file)
124-
if File.exists?(css_file)
124+
if File.exist?(css_file)
125125
cf = Compass::Stats::CssFile.new(css_file)
126126
cf.analyze!
127127
%w(selector_count prop_count file_size).map do |t|

cli/lib/compass/commands/update_project.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def new_config?(compiler)
7373
return false unless config_file
7474
config_mtime = File.mtime(config_file)
7575
compiler.file_list.each do |(_, css_filename, _)|
76-
return config_file if File.exists?(css_filename) && config_mtime > File.mtime(css_filename)
76+
return config_file if File.exist?(css_filename) && config_mtime > File.mtime(css_filename)
7777
end
7878
nil
7979
end

cli/lib/compass/compiler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def new_config?
9393
return false unless config_file
9494
config_mtime = File.mtime(config_file)
9595
css_files.each do |css_filename|
96-
return config_file if File.exists?(css_filename) && config_mtime > File.mtime(css_filename)
96+
return config_file if File.exist?(css_filename) && config_mtime > File.mtime(css_filename)
9797
end
9898
nil
9999
end

cli/lib/compass/configuration/helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def add_project_configuration(*args)
8686
# Finds the configuration file, if it exists in a known location.
8787
def detect_configuration_file(project_path = nil)
8888
possible_files = KNOWN_CONFIG_LOCATIONS.map{|f| projectize(f, project_path) }
89-
possible_files.detect{|f| File.exists?(f)}
89+
possible_files.detect{|f| File.exist?(f)}
9090
end
9191

9292
def handle_configuration_change!

cli/lib/compass/installers/manifest.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ def with_manifest(manifest_file)
141141
# evaluated in a Manifest instance context
142142
def parse(manifest_file)
143143
with_manifest(manifest_file) do
144-
if File.exists?(manifest_file)
145-
open(manifest_file) do |f|
144+
if File.exist?(manifest_file)
145+
open(manifest_file) do |f|
146146
eval(f.read, instance_binding, manifest_file)
147147
end
148148
else

cli/lib/compass/sass_extensions/sprites/image.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def file
3232
def find_file
3333
Compass.configuration.sprite_load_path.compact.each do |path|
3434
f = File.join(path, relative_file)
35-
if File.exists?(f)
35+
if File.exist?(f)
3636
return f
3737
end
3838
end

0 commit comments

Comments
 (0)