Class: Pry
- Inherits:
-
Object
- Object
- Pry
- Defined in:
- lib/pry-debundle.rb
Overview
Copyright © Conrad Irwin <[email protected]> – MIT License Source: github.com/ConradIrwin/pry-debundle
To install and use this:
-
Recommended
Add 'pry' to your Gemfile (in the development group)
Add 'pry-debundle' to your Gemfile (in the development group)
-
OK, if colleagues are wary of pry-debundle:
Add 'pry' to your Gemfile (in the development group)
Copy this file into ~/.pryrc
-
Meh, if colleagues don’t like Pry at all:
Copy this file into ~/.pryrc
Create a wrapper script that runs `pry -r<your-application>`
-
Pants, if you don’t like Pry:
Copy the definition of the debundle! method into your ~/.irbrc
Call 'debundle!' from IRB when you need to.
Class Method Summary collapse
-
.debundle! ⇒ Object
Break out of the Bundler jail.
-
.load_additional_plugins ⇒ Object
After we’ve escaped from Bundler we want to look around and find any plugins the user has installed locally but not added to their Gemfile.
Class Method Details
.debundle! ⇒ Object
Break out of the Bundler jail.
This can be used to load files in development that are not in your Gemfile (for example if you want to test something with a tool that you have locally).
Normally you don’t need to cal this directly though, as it is called for you when Pry starts.
See github.com/carlhuda/bundler/issues/183 for some background.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/pry-debundle.rb', line 38 def debundle! loaded = false if rubygems_18? Gem.post_reset_hooks.reject!{ |hook| hook.source_location.first =~ %r{/bundler/} } Gem::Specification.reset remove_bundler_mokeypatches loaded = true # Rubygems 1.6 — TODO might be quite slow. elsif Gem.source_index && Gem.send(:class_variable_get, :@@source_index) Gem.source_index.refresh! remove_bundler_mokeypatches loaded = true else raise "No hacks found :(" end rescue => e puts "Debundling failed: #{e.}" puts "When reporting bugs to https://github.com/ConradIrwin/pry-debundle, please include:" puts "* gem version: #{Gem::VERSION rescue 'undefined'}" puts "* bundler version: #{Bundler::VERSION rescue 'undefined'}" puts "* pry version: #{Pry::VERSION rescue 'undefined'}" puts "* ruby version: #{RUBY_VERSION rescue 'undefined'}" puts "* ruby engine: #{RUBY_ENGINE rescue 'undefined'}" else load_additional_plugins if loaded end |
.load_additional_plugins ⇒ Object
After we’ve escaped from Bundler we want to look around and find any plugins the user has installed locally but not added to their Gemfile.
71 72 73 74 75 76 77 |
# File 'lib/pry-debundle.rb', line 71 def load_additional_plugins old_plugins = Pry.plugins.values Pry.locate_plugins new_plugins = Pry.plugins.values - old_plugins new_plugins.each(&:activate!) end |