pry / pry-coolline

Live syntax-highlighting for the Pry REPL
Other
128 stars 17 forks source link

pry-coolline with pry 0.13.1 gives undefined method `file' for #<Pry::History:...> #36

Closed owst closed 3 years ago

owst commented 4 years ago

Attempting to use pry-coolline with pry 0.13.1 gives: undefined method 'file' for #<Pry::History:0x00007fc0d148a578> (NoMethodError)

Reproduction

Save the following in foo.rb:

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'pry', '= 0.13.1'
  gem 'pry-coolline' 
end

binding.pry

p 42

Running ruby foo.rb gives:

$ ruby /tmp/foo.rb
Traceback (most recent call last):
    13: from /tmp/foo.rb:3:in `<main>'
    12: from /Users/owen/.rbenv/versions/2.5.5/lib/ruby/site_ruby/2.5.0/bundler/inline.rb:70:in `gemfile'
    11: from /Users/owen/.rbenv/versions/2.5.5/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:65:in `require'
    10: from /Users/owen/.rbenv/versions/2.5.5/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:65:in `each'
     9: from /Users/owen/.rbenv/versions/2.5.5/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:76:in `block in require'
     8: from /Users/owen/.rbenv/versions/2.5.5/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:76:in `each'
     7: from /Users/owen/.rbenv/versions/2.5.5/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:81:in `block (2 levels) in require'
     6: from /Users/owen/.rbenv/versions/2.5.5/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:81:in `require'
     5: from /Users/owen/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/pry-coolline-0.2.5/lib/pry-coolline.rb:18:in `<top (required)>'
     4: from /Users/owen/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/pry-coolline-0.2.5/lib/pry-coolline/wrapper.rb:55:in `make_input'
     3: from /Users/owen/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/pry-coolline-0.2.5/lib/pry-coolline/wrapper.rb:26:in `make_coolline'
     2: from /Users/owen/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/pry-coolline-0.2.5/lib/pry-coolline/wrapper.rb:26:in `new'
     1: from /Users/owen/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/coolline-0.5.0/lib/coolline/coolline.rb:138:in `initialize'
/Users/owen/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/pry-coolline-0.2.5/lib/pry-coolline/wrapper.rb:35:in `block in make_coolline': undefined method `file' for #<Pry::History:0x00007ff490122528> (NoMethodError)
Did you mean?  filter
SamZapata commented 4 years ago

I think I have the same issue. Well, I'm trying to use the gem 'spirit_hands', the installation is ok, but when I run 'rails console' this happens... ../.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/pry-coolline-0.2.5/lib/pry-coolline/wrapper.rb:35:inblock in make_coolline': undefined method file' for #<Pry::History:0x00007f59bc6dbc40> Did you mean? filter (NoMethodError) And I still don't understand why

rusterholz commented 4 years ago

I'm seeing the same issue in an unrelated project. Do we know why this breaking change is not mentioned in the pry changelog?

gato-omega commented 4 years ago

I find @owst fix to be the correct approach since there's no way around the API change for the file history in the config (while keeping it backwards compatible).

@SamZapata I used his fork on Gemfile before any gems that might require it (such as spirit_hands):

gem 'pry-coolline', github: 'owst/pry-coolline', branch: 'support_new_pry_config_api'

Thanks @owst ! 😄