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_at_least_one, method_exclusive, 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
33
# 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

  message = "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."
  removed_message = "Using the `config` command without a subcommand [list, get, set, unset] is has been removed. Use `bundle #{new_args.join(" ")}` instead."
  SharedHelpers.major_deprecation 3, message, removed_message: removed_message

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

#get(name) ⇒ Object



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

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

#listObject



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

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

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



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

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

#unset(name) ⇒ Object



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

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