Skip to content

Commit 8cda755

Browse files
authored
Replace deprecated File.exists with File.exist (#14)
1 parent 8769cae commit 8cda755

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

.github/workflows/tests.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,23 @@ jobs:
2424
- 2.7
2525
- '3.0'
2626
- 3.1
27+
- 3.2
2728
- jruby
2829
- truffleruby
2930
os:
3031
- macos
3132
- ubuntu
3233
- windows
3334
exclude:
34-
- ruby: 2.2 # Fails on setup: https://github.com/rvm/gem-empty/actions/runs/5094962600/jobs/9159397472
35+
- ruby: 2.2 # Fails on setup
3536
os: ubuntu
36-
- ruby: 2.7 # Fails only on macos: https://github.com/rvm/gem-empty/actions/runs/5094962600/jobs/9159397472
37+
- ruby: 2.7 # Fails only on macos
3738
os: macos
38-
- ruby: 3.0 # Fails only on macos: https://github.com/rvm/gem-empty/actions/runs/5094962600/jobs/9159398902
39+
- ruby: 3.0 # Fails only on macos
3940
os: macos
40-
- ruby: 3.1 # Fails only on macos: https://github.com/rvm/gem-empty/actions/runs/5094962600/jobs/9159399155
41+
- ruby: 3.1 # Fails only on macos
42+
os: macos
43+
- ruby: 3.2 # Fails only on macos
4144
os: macos
4245
- ruby: jruby
4346
os: macos

lib/gem-empty/command.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ def remove_rubygems_gems
6565
end
6666

6767
def remove_bundler_gems
68-
FileUtils.rm_rf( File.join( gem_install_dir, 'bundler','gems' ) )
68+
FileUtils.rm_rf(File.join(gem_install_dir, 'bundler', 'gems'))
6969
end
7070

7171
def gem_dir_specs
7272
@gem_dir_specs ||=
73-
GemEmpty::Specification.installed_gems.select do |spec|
74-
File.exists?( File.join( gem_install_dir, 'gems', spec.full_name ) )
75-
end
73+
GemEmpty::Specification.installed_gems.select do |spec|
74+
File.exist?(File.join(gem_install_dir, 'gems', spec.full_name))
75+
end
7676
end
7777

7878
def gem_install_dir

test/gem-empty/command_test.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
require 'rubygems/user_interaction'
55
require 'rubygems/mock_gem_ui'
66

7-
class Gem::Specification
8-
def self.remove_spec spec
9-
true # fake the removal from _all
7+
if RUBY_VERSION < "2.3"
8+
class Gem::Specification
9+
def self.remove_spec spec
10+
true # fake the removal from _all
11+
end
1012
end
1113
end
1214

0 commit comments

Comments
 (0)