diff options
-rw-r--r-- | .circleci/config.yml | 2 | ||||
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | README.md | 18 | ||||
-rw-r--r-- | lib/pry/commands/edit/file_and_line_locator.rb | 2 | ||||
-rw-r--r-- | lib/pry/exceptions.rb | 6 | ||||
-rw-r--r-- | lib/pry/pry_class.rb | 7 | ||||
-rw-r--r-- | pry.gemspec | 4 |
8 files changed, 19 insertions, 24 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 3ba24dc5..7a7a0876 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -131,7 +131,7 @@ jobs: - <<: *unit "ruby-2.7": docker: - - image: circleci/ruby:2.7.0-preview1 + - image: circleci/ruby:2.7.0 working_directory: ~/pry steps: - <<: *repo_restore_cache diff --git a/CHANGELOG.md b/CHANGELOG.md index 56e73401..8372abc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,6 +94,8 @@ are set, Pry no longer uses traditional files like `~/.pryrc` & `~/.pry_history`. Instead, the env variable paths are loaded first ([#2056](https://github.com/pry/pry/pull/2056)) +* Fixed the `$SAFE will become a normal global variable in Ruby 3.0` warning on + Ruby 2.7 ([#2107](https://github.com/pry/pry/pull/2107)) ### [v0.12.2][v0.12.2] (November 12, 2018) @@ -3,7 +3,7 @@ source 'https://rubygems.org' gemspec -gem 'rake', '~> 10.0' +gem 'rake' gem 'yard' gem 'rspec', '~> 3.8.0' @@ -368,24 +368,6 @@ pry(main) ri Array#each a -- b -- c -- ``` -### Gist integration - -If the `gist` gem is installed then method source or documentation can be gisted -to GitHub with the `gist` command. The `gist` command is capable of gisting -[almost any REPL content](https://gist.github.com/cae143e4533416529726), -including methods, documentation, input expressions, command source, and so -on. In the example below we will gist the C source code for the `Symbol#to_proc` -method to GitHub: - -```ruby -pry(main)> gist -m Symbol#to_proc -Gist created at https://gist.github.com/5332c38afc46d902ce46 and added to clipboard. -pry(main)> -``` - -You can see the actual gist generated here: -[https://gist.github.com/5332c38afc46d902ce46](https://gist.github.com/5332c38afc46d902ce46) - ### Edit methods You can use `edit Class#method` or `edit my_method` (if the method is in scope) diff --git a/lib/pry/commands/edit/file_and_line_locator.rb b/lib/pry/commands/edit/file_and_line_locator.rb index e3b8a616..2d0f7713 100644 --- a/lib/pry/commands/edit/file_and_line_locator.rb +++ b/lib/pry/commands/edit/file_and_line_locator.rb @@ -9,7 +9,7 @@ class Pry if target.respond_to?(:source_location) target.source_location else - [target.eval("__FILE__"), target.eval("__LINE__")] + target.eval("[__FILE__, __LINE__]") end end diff --git a/lib/pry/exceptions.rb b/lib/pry/exceptions.rb index eac1c009..ee31e6c4 100644 --- a/lib/pry/exceptions.rb +++ b/lib/pry/exceptions.rb @@ -27,7 +27,11 @@ class Pry # Catches SecurityErrors if $SAFE is set module TooSafeException def self.===(exception) - $SAFE > 0 && exception.is_a?(SecurityError) + if Pry::HAS_SAFE_LEVEL + $SAFE > 0 && exception.is_a?(SecurityError) + else + exception.is_a?(SecurityError) + end end end diff --git a/lib/pry/pry_class.rb b/lib/pry/pry_class.rb index 414c6a5a..80dda807 100644 --- a/lib/pry/pry_class.rb +++ b/lib/pry/pry_class.rb @@ -6,6 +6,13 @@ require 'pathname' class Pry LOCAL_RC_FILE = "./.pryrc".freeze + # @return [Boolean] true if this Ruby supports safe levels and tainting, + # to guard against using deprecated or unsupported features + HAS_SAFE_LEVEL = ( + RUBY_ENGINE == 'ruby' && + Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7') + ) + class << self extend Pry::Forwardable attr_accessor :custom_completions diff --git a/pry.gemspec b/pry.gemspec index d90bcbf2..1df03dfc 100644 --- a/pry.gemspec +++ b/pry.gemspec @@ -27,7 +27,7 @@ Pry is a runtime developer console and IRB alternative with powerful introspection capabilities. Pry aims to be more than an IRB replacement. It is an attempt to bring REPL driven programming to the Ruby language. DESC - s.homepage = "http://pryrepl.org" + s.homepage = "http://pry.github.io" s.licenses = ['MIT'] s.executables = ["pry"] @@ -35,7 +35,7 @@ DESC s.files = `git ls-files bin lib *.md LICENSE`.split("\n") s.add_dependency 'coderay', '~> 1.1' - s.add_dependency 'method_source', '~> 0.9.0' + s.add_dependency 'method_source', '~> 1.0' s.metadata['changelog_uri'] = 'https://github.com/pry/pry/blob/master/CHANGELOG.md' s.metadata['source_code_uri'] = 'https://github.com/pry/pry' |