lib/utility_belt.rb in utility_belt-1.0.6 vs lib/utility_belt.rb in utility_belt-1.1.0

- old
+ new

@@ -1,39 +1,22 @@ # This started as my (Giles Bowkett's) .irbrc file, turned into a recipe on IRB for the Pragmatic Programmers, # and soon became a scrapbook of cool code snippets from all over the place. All the RDoc lives in the README. # Check that file for usage information, authorship, copyright, and extensive details. You can also find a # nice, HTMLified version of the README content at http://utilitybelt.rubyforge.org. -UTILITY_BELT_IRB_STARTUP_PROCS = {} +UTILITY_BELT_IRB_STARTUP_PROCS = {} unless Object.const_defined? :UTILITY_BELT_IRB_STARTUP_PROCS -%w{rubygems - platform - wirble - net/http - tempfile}.each {|library| require library} -%w{init colorize}.each {|message| Wirble.send(message)} -%w{mac_clipboard - is_an - pastie - themes - irb_verbosity_control - rails_verbosity_control - command_history - not - language_greps - rails_finder_shortcut - amazon_upload_shortcut - irb_options - interactive_editor - string_to_proc - symbol_to_proc - hash_math - with}.each {|internal_library| require internal_library} +%w{rubygems utility_belt/equipper}.each {|internal_library| require internal_library} -# default: dark background -UtilityBelt::Themes.background(:dark) +if Object.const_defined? :IRB -# Called when the irb session is ready, after any external libraries have been loaded. I can't -# remember why I did this. it might be a cargo cult thing. -IRB.conf[:IRB_RC] = lambda do - UTILITY_BELT_IRB_STARTUP_PROCS.each {|symbol, proc| proc.call} + # Called when the irb session is ready, after any external libraries have been loaded. This + # allows the user to specify which gadgets in the utility belt to equip. (Kind of pushing the + # metaphor, but hey, what the hell.) + IRB.conf[:IRB_RC] = lambda do + UtilityBelt.equip(:defaults) unless UtilityBelt.equipped? + UTILITY_BELT_IRB_STARTUP_PROCS.each {|symbol, proc| proc.call} + end + + # default: dark background + UtilityBelt::Themes.background(:dark) if defined? UtilityBelt::Themes end