Class: Bundler::CLI::Config

Inherits:
Thor
  • Object
show all
Defined in:
lib/bundler/cli/config.rb

Defined Under Namespace

Classes: Base

Constant Summary

Constants inherited from Thor

Thor::AmbiguousTaskError, Thor::Correctable, Thor::DynamicTask, Thor::HELP_MAPPINGS, Thor::HiddenTask, Thor::TEMPLATE_EXTNAME, Thor::THOR_RESERVED_WORDS, Thor::Task, Thor::UndefinedTaskError, Thor::VERSION

Instance Attribute Summary

Attributes included from Thor::Base

#args, #options, #parent_options

Instance Method Summary collapse

Methods inherited from Thor

check_unknown_options!, check_unknown_options?, command_help, default_command, deprecation_warning, desc, disable_required_check!, disable_required_check?, #help, help, long_desc, map, method_option, method_options, package_name, printable_commands, register, stop_on_unknown_option!, stop_on_unknown_option?, subcommand, subcommand_classes, subcommands

Methods included from Thor::Base

included, #initialize, register_klass_file, subclass_files, subclasses

Instance Method Details

#base(name = nil, *value) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/bundler/cli/config.rb', line 16

def base(name = nil, *value)
  new_args =
    if ARGV.size == 1
      ["config", "list"]
    elsif ARGV.include?("--delete")
      ARGV.map {|arg| arg == "--delete" ? "unset" : arg }
    elsif ARGV.include?("--global") || ARGV.include?("--local") || ARGV.size == 3
      ["config", "set", *ARGV[1..-1]]
    else
      ["config", "get", ARGV[1]]
    end

  SharedHelpers.major_deprecation 3,
    "Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead."

  Base.new(options, name, value, self).run
end

#get(name) ⇒ Object



40
41
42
# File 'lib/bundler/cli/config.rb', line 40

def get(name)
  Base.new(options, name, nil, self).run
end

#listObject



35
36
37
# File 'lib/bundler/cli/config.rb', line 35

def list
  Base.new(options, nil, nil, self).run
end

#set(name, value, *value_) ⇒ Object



46
47
48
# File 'lib/bundler/cli/config.rb', line 46

def set(name, value, *value_)
  Base.new(options, name, value_.unshift(value), self).run
end

#unset(name) ⇒ Object



52
53
54
55
# File 'lib/bundler/cli/config.rb', line 52

def unset(name)
  options[:delete] = true
  Base.new(options, name, nil, self).run
end