Skip to content

Commit

Permalink
Replace deprecated File.exists with File.exist #11
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuczynski committed May 26, 2023
2 parents b446e04 + 45d70e4 commit 60da4ea
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- 2.7
- '3.0'
- 3.1
- 3.2
- jruby
- truffleruby
os:
Expand Down Expand Up @@ -54,7 +55,7 @@ jobs:
- uses: actions/checkout@v3

- name: Setup ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby-pkgs@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
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 60da4ea

Please sign in to comment.