Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix fancy_irb and awesome_print requires for script/console

  • Loading branch information...
commit 2b423b36d6369511acce060a721d6fe353d2af28 1 parent 7ead844
@edsinclair authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 .irbrc
View
14 .irbrc
@@ -1,13 +1,17 @@
def unbundled_require(gem, options = {})
if defined?(::Bundler) && gem != "irb/ext/save-history"
- spec_path = Dir.glob("#{Gem.dir}/specifications/#{gem}-*.gemspec").last
+ spec_path = Dir.glob("#{Gem.dir}/specifications/#{gem.gsub('/','-')}-*.gemspec").last
if spec_path.nil?
warn "Couldn't find #{gem}"
return
end
spec = Gem::Specification.load spec_path
- spec.activate
+ begin
+ spec.activate
+ rescue Gem::LoadError => err
+ warn "Couldn't activate #{gem}: #{err}"
+ end
end
begin
@@ -26,14 +30,19 @@ unbundled_require "irb/ext/save-history" do
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
end
+# http://tagaholic.me/hirb/
unbundled_require "hirb" do
Hirb.enable
end
+# http://tagaholic.me/bond/
unbundled_require "bond" do
Bond.start
end
+# https://github.com/janlelis/fancy_irb
+unbundled_require "paint"
+unbundled_require "unicode/display_width"
unbundled_require "fancy_irb" do
FancyIrb.start :colorize => {
:rocket_prompt => [:blue],
@@ -47,6 +56,7 @@ unbundled_require "fancy_irb" do
}
end
+# https://github.com/michaeldv/awesome_print
unbundled_require "awesome_print" do
AwesomePrint.irb!
end
Please sign in to comment.
Something went wrong with that request. Please try again.