Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Dir.exists?/File.exists? with Dir.exist?/File.exist? #618

Merged
merged 1 commit into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ install:

build_script:
- set SSL_CERT_FILE=C:/ruby24-x64/ssl/cert.pem
- ruby -rfileutils -e 'FileUtils.rm_r(File.join(Gem.dir, "cache", "bundler")) if Dir.exists?(File.join(Gem.dir, "cache", "bundler"))'
- ruby -rfileutils -e 'FileUtils.rm_r(File.join(Gem.dir, "cache", "bundler")) if Dir.exist?(File.join(Gem.dir, "cache", "bundler"))'
- bundle install --jobs 3 --retry 3
- net user
- net localgroup
Expand Down
12 changes: 6 additions & 6 deletions lib/serverspec/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def self.safe_create_spec
end
EOF

if File.exists? "spec/#{@hostname}/sample_spec.rb"
if File.exist? "spec/#{@hostname}/sample_spec.rb"
old_content = File.read("spec/#{@hostname}/sample_spec.rb")
if old_content != content
$stderr.puts "!! spec/#{@hostname}/sample_spec.rb already exists and differs from template"
Expand All @@ -141,7 +141,7 @@ def self.safe_create_spec
end

def self.safe_mkdir(dir)
if File.exists? dir
if File.exist? dir
unless File.directory? dir
$stderr.puts "!! #{dir} already exists and is not a directory"
end
Expand All @@ -153,7 +153,7 @@ def self.safe_mkdir(dir)

def self.safe_create_spec_helper
content = ERB.new(spec_helper_template, nil, '-').result(binding)
if File.exists? 'spec/spec_helper.rb'
if File.exist? 'spec/spec_helper.rb'
old_content = File.read('spec/spec_helper.rb')
if old_content != content
$stderr.puts "!! spec/spec_helper.rb already exists and differs from template"
Expand Down Expand Up @@ -196,7 +196,7 @@ def self.safe_create_rakefile
end
end
EOF
if File.exists? 'Rakefile'
if File.exist? 'Rakefile'
old_content = File.read('Rakefile')
if old_content != content
$stderr.puts '!! Rakefile already exists and differs from template'
Expand All @@ -212,7 +212,7 @@ def self.safe_create_rakefile
def self.find_vagrantfile
Pathname.new(Dir.pwd).ascend do |dir|
path = File.expand_path('Vagrantfile', dir)
return path if File.exists?(path)
return path if File.exist?(path)
end
nil
end
Expand Down Expand Up @@ -334,7 +334,7 @@ def self.safe_create_dotrspec
--color
--format documentation
EOF
if File.exists? '.rspec'
if File.exist? '.rspec'
old_content = File.read('.rspec')
if old_content != content
$stderr.puts '!! .rspec already exists and differs from template'
Expand Down