Skip to content

Commit

Permalink
Replace deprecated File.exists with File.exist (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuczynski committed May 26, 2023
1 parent 8769cae commit 8cda755
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,23 @@ jobs:
- 2.7
- '3.0'
- 3.1
- 3.2
- jruby
- truffleruby
os:
- macos
- ubuntu
- windows
exclude:
- ruby: 2.2 # Fails on setup: https://github.com/rvm/gem-empty/actions/runs/5094962600/jobs/9159397472
- ruby: 2.2 # Fails on setup
os: ubuntu
- ruby: 2.7 # Fails only on macos: https://github.com/rvm/gem-empty/actions/runs/5094962600/jobs/9159397472
- ruby: 2.7 # Fails only on macos
os: macos
- ruby: 3.0 # Fails only on macos: https://github.com/rvm/gem-empty/actions/runs/5094962600/jobs/9159398902
- ruby: 3.0 # Fails only on macos
os: macos
- ruby: 3.1 # Fails only on macos: https://github.com/rvm/gem-empty/actions/runs/5094962600/jobs/9159399155
- ruby: 3.1 # Fails only on macos
os: macos
- ruby: 3.2 # Fails only on macos
os: macos
- ruby: jruby
os: macos
Expand Down
8 changes: 4 additions & 4 deletions lib/gem-empty/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ def remove_rubygems_gems
end

def remove_bundler_gems
FileUtils.rm_rf( File.join( gem_install_dir, 'bundler','gems' ) )
FileUtils.rm_rf(File.join(gem_install_dir, 'bundler', 'gems'))
end

def gem_dir_specs
@gem_dir_specs ||=
GemEmpty::Specification.installed_gems.select do |spec|
File.exists?( File.join( gem_install_dir, 'gems', spec.full_name ) )
end
GemEmpty::Specification.installed_gems.select do |spec|
File.exist?(File.join(gem_install_dir, 'gems', spec.full_name))
end
end

def gem_install_dir
Expand Down
8 changes: 5 additions & 3 deletions test/gem-empty/command_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
require 'rubygems/user_interaction'
require 'rubygems/mock_gem_ui'

class Gem::Specification
def self.remove_spec spec
true # fake the removal from _all
if RUBY_VERSION < "2.3"
class Gem::Specification
def self.remove_spec spec
true # fake the removal from _all
end
end
end

Expand Down

0 comments on commit 8cda755

Please sign in to comment.