Code Monkey home page Code Monkey logo

pry-inline's Introduction

Pry Inline

Gem Version Build Status Coverage Status

Pry Inline is a plugin for pry, which enables the inline variables view like RubyMine.

screenshot

Installation

Add this line to your application's Gemfile:

gem 'pry-inline'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pry-inline

Usage

There is no need to edit any configuration. After you have added the dependency in Gemfile, pry-inline will enable the inline variables view functionality.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/seikichi/pry-inline. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

pry-inline's People

Contributors

rrosenblum avatar seikichi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pry-inline's Issues

require 'pry-inline' failed

I'm using pry-rails and pry from master and I just added pry-inline to the Gemfile:

gem 'pry', github: 'pry/pry'
gem 'pry-rails', github: 'rweng/pry-rails'
gem 'pry-inline', github: 'seikichi/pry-inline', require: false

rails c starts with the following message:

require 'pry-inline' # Failed, saying: undefined method `delete_hooks' for #<Pry::Hooks:0x007f895878fd50>
Did you mean?  delete_hook

Doesn't seem to work on the first statement

  • pry 0.10.3
  • pry-inline 1.0.0

Tested combinations

  1. pry-nav 0.2.4 + JRuby 9.0.4.0
  2. pry-byebug 3.3.0 + Ruby (MRI) 2.2.5

I'm sure it's something simple/obvious/PEBKAC, please feel free ping me with "@steakknife ..." if more debugging is needed.

Warnings in parser.rb

I'm getting several warnings when I run my app that loads pry-inline.

I'm on Ruby 2.2.5

/Users/cschneid/.rvm/gems/ruby-2.2.5/gems/pry-inline-1.0.2/lib/pry-inline/parser.rb:33: warning: method redefined; discarding old on_parse_error
/Users/cschneid/.rvm/gems/ruby-2.2.5/gems/pry-inline-1.0.2/lib/pry-inline/parser.rb:14: warning: previous definition of on_parse_error was here
>> require 'ripper'
=> true
>> Ripper::Version
=> "0.1.0"

It looks like Ripper::PARSER_EVENTS contains a :parse_error token, which creates the on_parse_error function. But then towards the bottom of the file, there's an explicit on_parse_error definition that triggers this warning.

The fix is pretty simple (next if event == :parse_error in the first loop).

Not compatible with pry 0.12

The current release of pry-inline does not work with pry 0.12, at least according to the gemspec. At this time, upgrading pry downgrades pry-inline to 0.1.0, since that release had a less-restrictive version specifier for pry.

Pry error after update pry-inline to support pry 0.13

Error is thrown after it hits binding.pry in the ruby code, for pry-inline 1.0.6 and pry 0.13.0:

...
before_session hook failed: NoMethodError: undefined method `inline' for #<Pry::Config:0x0000000004cf3380>
/home/hstastna/.rbenv/versions/2.5.4/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/config.rb:250:in `method_missing'
(see pry_instance.hooks.errors to debug)
...

Backtrace:

[4] pry(#<DashboardController>)> pry_instance.hooks.errors.first.backtrace
=> [
 "gems/pry-0.13.0/lib/pry/config.rb:250:in `method_missing'",
 "gems/pry-inline-1.0.6/lib/pry-inline/code_extension.rb:103:in `min_debug_info_width'",
 "gems/pry-inline-1.0.6/lib/pry-inline/code_extension.rb:39:in `block in print_to_output'",
 "gems/pry-inline-1.0.6/lib/pry-inline/code_extension.rb:34:in `each'",
 "gems/pry-inline-1.0.6/lib/pry-inline/code_extension.rb:34:in `print_to_output'",
 "gems/pry-0.13.0/lib/pry/code.rb:264:in `highlighted'",
 "gems/pry-0.13.0/lib/pry/commands/whereami.rb:108:in `process'",
 "gems/pry-0.13.0/lib/pry/class_command.rb:82:in `call'",
 "gems/pry-0.13.0/lib/pry/command.rb:495:in `call_with_hooks'",
 "gems/pry-0.13.0/lib/pry/command.rb:431:in `block in call_safely'",
 "gems/pry-0.13.0/lib/pry/command.rb:439:in `use_unpatched_symbol'",
 "gems/pry-0.13.0/lib/pry/command.rb:430:in `call_safely'",
 "gems/pry-0.13.0/lib/pry/command.rb:404:in `process_line'",
 "gems/pry-0.13.0/lib/pry/command_set.rb:354:in `process_line'",
 "gems/pry-0.13.0/lib/pry/pry_instance.rb:376:in `run_command'",
 "gems/pry-0.13.0/lib/pry/hooks.rb:20:in `block in default'",
 "gems/pry-0.13.0/lib/pry/hooks.rb:111:in `block in exec_hook'",
 "gems/pry-0.13.0/lib/pry/hooks.rb:109:in `map'",
 "gems/pry-0.13.0/lib/pry/hooks.rb:109:in `exec_hook'",
 "gems/pry-0.13.0/lib/pry/pry_instance.rb:396:in `exec_hook'",
 "gems/pry-0.13.0/lib/pry/repl.rb:48:in `prologue'",
 "gems/pry-0.13.0/lib/pry/repl.rb:37:in `start'",
 "gems/pry-0.13.0/lib/pry/repl.rb:15:in `start'",
 "gems/pry-0.13.0/lib/pry/pry_class.rb:191:in `start'",
 "gems/pry-byebug-3.9.0/lib/byebug/processors/pry_processor.rb:117:in `block in resume_pry'",
 "gems/pry-byebug-3.9.0/lib/byebug/processors/pry_processor.rb:30:in `block (2 levels) in run'",
 "gems/byebug-11.1.1/lib/byebug/helpers/eval.rb:94:in `allowing_other_threads'",
 "gems/pry-byebug-3.9.0/lib/byebug/processors/pry_processor.rb:30:in `block in run'",
 "gems/pry-byebug-3.9.0/lib/byebug/processors/pry_processor.rb:29:in `catch'",
 "gems/pry-byebug-3.9.0/lib/byebug/processors/pry_processor.rb:29:in `run'",
 "gems/pry-byebug-3.9.0/lib/byebug/processors/pry_processor.rb:113:in `resume_pry'",
 "gems/pry-byebug-3.9.0/lib/byebug/processors/pry_processor.rb:65:in `at_line'",
 "gems/byebug-11.1.1/lib/byebug/context.rb:98:in `at_line'",
 ...
]

When using lower version for pry-inline, error did not occur and everything worked as expected:
gem "pry-inline", "<1.0.6"

Not working

pry-inline

ruby 2.3.1p112

cat Gemfile.lock

...
    pry (0.10.3)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    pry-byebug (3.3.0)
      byebug (~> 8.0)
      pry (~> 0.10)
    pry-doc (0.8.0)
      pry (~> 0.9)
      yard (~> 0.8)
    pry-inline (1.0.2)
      pry (~> 0.10.0)
      unicode (~> 0.4.4)
    pry-rails (0.3.4)
      pry (>= 0.9.10)
    pry-stack_explorer (0.4.9.2)
      binding_of_caller (>= 0.7)
      pry (>= 0.9.11)
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.