summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.rubocop_todo.yml14
-rw-r--r--Rakefile2
-rw-r--r--lib/pry/color_printer.rb2
-rw-r--r--lib/pry/command.rb2
-rw-r--r--lib/pry/editor.rb2
-rw-r--r--lib/pry/pager.rb2
-rw-r--r--lib/pry/slop.rb2
-rw-r--r--spec/integration/hanami_spec.rb2
8 files changed, 7 insertions, 21 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 82fde807..ea129e8d 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -314,20 +314,6 @@ Style/PerlBackrefs:
- 'lib/pry/method.rb'
- 'lib/pry/rubygem.rb'
-# Offense count: 8
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: use_perl_names, use_english_names
-Style/SpecialGlobalVars:
- Exclude:
- - 'Rakefile'
- - 'lib/pry/color_printer.rb'
- - 'lib/pry/command.rb'
- - 'lib/pry/editor.rb'
- - 'lib/pry/pager.rb'
- - 'lib/pry/slop.rb'
- - 'spec/integration/hanami_spec.rb'
-
# Offense count: 1
# Cop supports --auto-correct.
Style/StderrPuts:
diff --git a/Rakefile b/Rakefile
index a7b575c4..6dcef816 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,7 +1,7 @@
require 'rake/clean'
require 'rubygems/package_task'
-$:.unshift 'lib'
+$LOAD_PATH.unshift 'lib'
require 'pry/version'
CLOBBER.include('**/*~', '**/*#*', '**/*.log')
diff --git a/lib/pry/color_printer.rb b/lib/pry/color_printer.rb
index c3410fc3..d59d9b48 100644
--- a/lib/pry/color_printer.rb
+++ b/lib/pry/color_printer.rb
@@ -12,7 +12,7 @@ class Pry
CodeRay::Encoders::Terminal::TOKEN_COLORS[:comment][:self] = "\e[1;34m"
- def self.pp(obj, out = $>, width = 79, newline = "\n")
+ def self.pp(obj, out = $DEFAULT_OUTPUT, width = 79, newline = "\n")
q = ColorPrinter.new(out, width, newline)
q.guard_inspect_key { q.pp obj }
q.flush
diff --git a/lib/pry/command.rb b/lib/pry/command.rb
index 12142bd2..a60a1235 100644
--- a/lib/pry/command.rb
+++ b/lib/pry/command.rb
@@ -402,7 +402,7 @@ class Pry
# Workaround for weird JRuby bug where rindex in this case can return nil
# even when there's a match.
arg_string.scan(/\| *(?:do|\{)/)
- block_index = $~ && $~.offset(0)[0]
+ block_index = $LAST_MATCH_INFO && $LAST_MATCH_INFO.offset(0)[0]
return unless block_index
diff --git a/lib/pry/editor.rb b/lib/pry/editor.rb
index ba09b679..b3607fcf 100644
--- a/lib/pry/editor.rb
+++ b/lib/pry/editor.rb
@@ -51,7 +51,7 @@ class Pry
# Note we dont want to use Pry.config.system here as that
# may be invoked non-interactively (i.e via Open4), whereas we want to
# ensure the editor is always interactive
- system(*Shellwords.split(editor_invocation)) || raise(CommandError, "`#{editor_invocation}` gave exit status: #{$?.exitstatus}")
+ system(*Shellwords.split(editor_invocation)) || raise(CommandError, "`#{editor_invocation}` gave exit status: #{$CHILD_STATUS.exitstatus}")
end
# We need JRuby specific code here cos just shelling out using
diff --git a/lib/pry/pager.rb b/lib/pry/pager.rb
index 7fb49fcf..bba487f3 100644
--- a/lib/pry/pager.rb
+++ b/lib/pry/pager.rb
@@ -151,7 +151,7 @@ class Pry
else
`which #{pager_executable}`
end
- $?.success?
+ $CHILD_STATUS.success?
rescue StandardError
false
end
diff --git a/lib/pry/slop.rb b/lib/pry/slop.rb
index 13d6b383..73d0db1f 100644
--- a/lib/pry/slop.rb
+++ b/lib/pry/slop.rb
@@ -418,7 +418,7 @@ class Pry
end
banner = config[:banner]
- banner = "Usage: #{File.basename($0, '.*')}#{' [command]' if @commands.any?} [options]" if banner.nil?
+ banner = "Usage: #{File.basename($PROGRAM_NAME, '.*')}#{' [command]' if @commands.any?} [options]" if banner.nil?
if banner
"#{banner}\n#{@separators[0] ? "#{@separators[0]}\n" : ''}#{optstr}"
else
diff --git a/spec/integration/hanami_spec.rb b/spec/integration/hanami_spec.rb
index a3dd2575..c3380c61 100644
--- a/spec/integration/hanami_spec.rb
+++ b/spec/integration/hanami_spec.rb
@@ -32,6 +32,6 @@ RSpec.describe "Hanami integration" do
exit 42
RUBY
`#@ruby -I#@pry_dir -e'#{code}'`
- expect($?.exitstatus).to eq(42)
+ expect($CHILD_STATUS.exitstatus).to eq(42)
end
end