In Files

  • bundler/cli/config.rb

Parent

Methods

Class/Module Index [+]

Quicksearch

Bundler::CLI::Config

Attributes

args[RW]
name[R]
options[R]
scope[R]
thor[R]

Public Class Methods

new(options, args, thor) click to toggle source
 
               # File bundler/cli/config.rb, line 8
def initialize(options, args, thor)
  @options = options
  @args = args
  @thor = thor
  @name = peek = args.shift
  @scope = "global"
  return unless peek && peek.start_with?("--")
  @name = args.shift
  @scope = peek[2..-1]
end
            

Public Instance Methods

run() click to toggle source
 
               # File bundler/cli/config.rb, line 19
def run
  unless name
    confirm_all
    return
  end

  unless valid_scope?(scope)
    Bundler.ui.error "Invalid scope --#{scope} given. Please use --local or --global."
    exit 1
  end

  if scope == "delete"
    Bundler.settings.set_local(name, nil)
    Bundler.settings.set_global(name, nil)
    return
  end

  if args.empty?
    if options[:parseable]
      if value = Bundler.settings[name]
        Bundler.ui.info("#{name}=#{value}")
      end
      return
    end

    confirm(name)
    return
  end

  Bundler.ui.info(message) if message
  Bundler.settings.send("set_#{scope}", name, new_value)
end