Sha256: 501e88b06c1531984d36bd7b9150d67d7f636c4abf8f9a4e99e129677efa1c26

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'boson/console_runner'

module Boson
  CONFIG.update console_defaults: []

  # Additional options added to Repo:
  # [:console_defaults] Array of libraries to load at start up when used in irb. Default is to load all library files and libraries
  #                     defined in the config.
  # [:console] Console to load when using --console from commandline. Default is irb.
  module Console
    # Start Boson by loading repositories and their configured libraries.
    # See ConsoleRunner.start for its options.
    def start(options={})
      ConsoleRunner.start(options)
    end
  end
  extend Console

  # [:console] This drops Boson into irb after having loaded default commands and any explict libraries with
  #            :load option. This is a good way to start irb with only certain libraries loaded.
  module ConsoleOptions
    def early_option?(args)
      if @options[:console]
        ConsoleRunner.bin_start(@options[:console], @options[:load])
        true
      else
        super
      end
    end
  end

  if defined? BinRunner
    class BinRunner < BareRunner
      GLOBAL_OPTIONS.update console:
        {:type=>:boolean,
          :desc=>"Drops into irb with default and explicit libraries loaded"}
      extend ConsoleOptions
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
boson-more-0.1.0 lib/boson/console.rb