Skip to content

Commit

Permalink
Merge pull request #79 from casperisfine/fix-ruby-head-deprecations
Browse files Browse the repository at this point in the history
Fix ruby 2.8/3.0 deprecations about File.exists?
  • Loading branch information
SamSaffron committed Jun 11, 2020
2 parents 5e2cdbb + 3afe0ea commit aff85bb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ext/extconf.rb
Expand Up @@ -13,7 +13,7 @@ def sys(cmd)

libdir = File.basename RbConfig::CONFIG['libdir']

unless File.exists?("#{CWD}/dst/#{libdir}/libmsgpackc.a")
unless File.exist?("#{CWD}/dst/#{libdir}/libmsgpackc.a")
Logging.message "Building msgpack\n"

msgpack = File.basename('msgpack-1.1.0.tar.gz')
Expand All @@ -28,7 +28,7 @@ def sys(cmd)
end

Dir.chdir('src') do
FileUtils.rm_rf(dir) if File.exists?(dir)
FileUtils.rm_rf(dir) if File.exist?(dir)

sys("tar zxvfo #{msgpack}")
Dir.chdir(dir) do
Expand Down
4 changes: 2 additions & 2 deletions lib/rbtrace/cli.rb
Expand Up @@ -12,7 +12,7 @@ class RBTraceCLI
#
# Returns nothing.
def self.check_msgmnb
if File.exists?(msgmnb = "/proc/sys/kernel/msgmnb")
if File.exist?(msgmnb = "/proc/sys/kernel/msgmnb")
curr = File.read(msgmnb).to_i
max = 1024*1024
cmd = "sysctl kernel.msgmnb=#{max}"
Expand Down Expand Up @@ -273,7 +273,7 @@ def self.run
file = [
config,
File.expand_path("../../../tracers/#{config}.tracer", __FILE__)
].find{ |f| File.exists?(f) }
].find{ |f| File.exist?(f) }

unless file
parser.die :config, '(file does not exist)'
Expand Down
2 changes: 1 addition & 1 deletion lib/rbtrace/rbtracer.rb
Expand Up @@ -96,7 +96,7 @@ def socket_path
end

def clean_socket_path
FileUtils.rm(socket_path) if File.exists?(socket_path)
FileUtils.rm(socket_path) if File.exist?(socket_path)
end

# Watch for method calls slower than a threshold.
Expand Down

0 comments on commit aff85bb

Please sign in to comment.