Sha256: 027ecd57b344795b6ccf8b0987b7e16cedb43c5a195e2c34a603accdb49042cb

Contents?: true

Size: 1.02 KB

Versions: 32

Compression:

Stored size: 1.02 KB

Contents

module Bundler
  class CLI::Console
    attr_reader :options, :group, :consoles
    def initialize(options, group, consoles)
      @options = options
      @group = group
      @consoles = consoles
    end

    def run
      group ? Bundler.require(:default, *(group.split.map! {|g| g.to_sym })) : Bundler.require
      ARGV.clear

      preferred = Bundler.settings[:console] || 'irb'

      # See if console is available
      begin
        require preferred || true
      rescue LoadError
        # Is it in Gemfile?
        Bundler.ui.error "Could not load the #{preferred} console"
        Bundler.ui.info "Falling back on IRB..."

        require 'irb'
        preferred = 'irb'
      end

      constant = consoles[preferred]

      console = begin
                  Object.const_get(constant)
                rescue NameError => e
                  Bundler.ui.error e.inspect
                  Bundler.ui.error "Could not load the #{constant} console"
                  return
                end

      console.start
    end

  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
bundler-1.7.15 lib/bundler/cli/console.rb
bundler-1.7.14 lib/bundler/cli/console.rb
bundler-1.7.13 lib/bundler/cli/console.rb
bundler-1.7.12 lib/bundler/cli/console.rb
bundler-1.7.11 lib/bundler/cli/console.rb
bundler-1.7.10 lib/bundler/cli/console.rb
bundler-1.7.9 lib/bundler/cli/console.rb
bundler-1.7.8 lib/bundler/cli/console.rb
bundler-1.7.7 lib/bundler/cli/console.rb
bundler-1.7.6 lib/bundler/cli/console.rb
bundler-1.6.9 lib/bundler/cli/console.rb
bundler-1.7.5 lib/bundler/cli/console.rb
bundler-1.6.8 lib/bundler/cli/console.rb
bundler-1.7.4 lib/bundler/cli/console.rb
bundler-1.6.7 lib/bundler/cli/console.rb
bundler-1.7.3 lib/bundler/cli/console.rb
bundler-1.6.6 lib/bundler/cli/console.rb
bundler-1.7.2 lib/bundler/cli/console.rb
bundler-1.7.1 lib/bundler/cli/console.rb
bundler-1.7.1.pre.3 lib/bundler/cli/console.rb