Giter Site home page Giter Site logo

pry-debundle's Issues

Emit warning when loading a gem that isn't bundled

I ran into the situation described in the README:

Before you rush off to try this, a word of warning: you will waste debugging time because of this. Why? Because running a require 'ampex' inside Pry works, but running a require 'ampex' outside Pry doesn't. "XOMGWTF? Ohhhh! GAH!!" I hear your future self cry as you forget this warning, and then painfully recall it.

So, is there a way to tell when a requested gem is not already part of the bundle and emit a warning when it's been requested? It would have indeed saved a lot of time...

Can't call Bundler.preserve_gem_path anymore in Bundler >= 1.12

Debundling failed: undefined method `preserve_gem_path' for Bundler:Module
When reporting bugs to https://github.com/ConradIrwin/pry-debundle, please include:
* gem version: 2.5.1
* bundler version: 1.12.5
* pry version: 0.10.1
* ruby version: 2.3.1
* ruby engine: ruby

Doesn't work for me...

Trying to debundle and load awesome_print...

~/myapp$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]

~/myapp$ bundle exec rails -v
Rails 3.2.14

~/myapp$ gem list | grep awesome_print
awesome_print (1.1.0)

~/myapp$ cat ~/.irbrc
# Try to load Pry instead of IRB
begin
  require 'pry'
  Pry.start
  exit
rescue LoadError => e
  warn "Couldn't load pry: #{e}"
end

~/myapp$ cat ~/.pryrc
begin
  require 'awesome_print'
  AwesomePrint.pry!
rescue LoadError => e
  warn "Couldn't load awesome_print: #{e}"
end

Pry.config.prompt_name = File.basename(Dir.pwd)

extend Rails::ConsoleMethods if defined?(Rails) && Rails.env.present?

~/myapp$ bundle list | grep pry
  * pry (0.9.12.2)
  * pry-debundle (0.7)

~/myapp$ bundle exec rails console
Loading production environment (Rails 3.2.14)
Couldn't load awesome_print: cannot load such file -- awesome_print
[1] 20130903164115(main)> require 'awesome_print'
LoadError: cannot load such file -- awesome_print
from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
[2] 20130903164115(main)> Pry.debundle!
=> nil
[3] 20130903164115(main)> require 'awesome_print'
LoadError: cannot load such file -- awesome_print
from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'

"Gem::LoadError (ipaddr is not part of the bundle. Add it to your Gemfile.)" after upgrading to Rails 2.5

In the large Rails app I work on, we started getting errors of this form when we upgraded to Ruby 2.5:

Gem::LoadError (ipaddr is not part of the bundle. Add it to your Gemfile.)

We got such errors with a few different gems: csv, date, fileutils, ipaddr, and webrick. These are all default gems.

We removed pry-debundle for other reasons, but removing it turned out to fix this error as well. I tried reproducing the issue with a new Rails app, but I couldn't. I'm creating this issue so that maybe someone who's googling for the error will find it and save some time.

This is brilliant.

I am totally going to start using this, and suggesting it to people who are desperate to use personal gems for development purposes. Thanks for making this. :)

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.