123456789_123456789_123456789_123456789_123456789_

Class: Bundler::CLI::Config

Relationships & Source Files
Namespace Children
Classes:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Bundler::Thor
Defined in: lib/bundler/cli/config.rb

Constant Summary

::Bundler::Thor - Inherited

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

Class Method Summary

::Bundler::Thor - Inherited

.at_least_one
.check_unknown_options!

Extend check unknown options to accept a hash of conditions.

.command_help

Prints help information for the given command.

.default_command

Sets the default command when thor is executed without an explicit command to be called.

.default_task
.desc

Defines the usage and the description of the next command.

.disable_required_check!

Disable the check for required options for the given commands.

.exclusive
.help

Prints help information for this class.

.long_desc

Defines the long description of the next command.

.map

Maps an input to a command.

.method_at_least_one

Adds and declares option group for required at least one of options in the block of arguments.

.method_exclusive

Adds and declares option group for exclusive options in the block and arguments.

.method_option

Adds an option to the set of method options.

.method_options

Declares the options for the next command to be declared.

.option
.options
.package_name

Allows for custom “Command” package naming.

.printable_commands

Returns commands ready to be printed.

.printable_tasks
.register

Registers another ::Bundler::Thor subclass as a command.

.stop_on_unknown_option!

Stop parsing of options as soon as an unknown option or a regular argument is encountered.

.subcommand, .subcommand_classes, .subcommands,
.subtask

Alias for Thor.subcommand.

.subtasks

Alias for Thor.subcommands.

.task_help
.banner

The banner for this class.

.create_task
.find_command_possibilities

this is the logic that takes the command name passed in by the user and determines whether it is an unambiguous substrings of a command or alias name.

.find_task_possibilities
.normalize_task_name
.retrieve_task_name
.sort_commands!

Sort the commands, lexicographically by default.

.subcommand_help,
.subtask_help
.check_unknown_options?

Overwrite check_unknown_options? to take subcommands and options into account.

.deprecation_warning, .disable_required_check?, .stop_on_unknown_option?, .baseclass, .create_command,
.disable_required_check

help command has the required check disabled by default.

.dispatch

The method responsible for dispatching given the args.

.dynamic_command_class, .initialize_added,
.method_at_least_one_option_names

Returns this class at least one of required options array set.

.method_exclusive_option_names

Returns this class exclusive options array set.

.normalize_command_name

receives a (possibly nil) command name and returns a name that is in the commands hash.

.print_at_least_one_required_options, .print_exclusive_options,
.retrieve_command_name

Retrieve the command name from given args.

.stop_on_unknown_option

Instance Attribute Summary

Instance Method Summary

::Bundler::Thor - Inherited

::Bundler::Thor::Base - Included

#initialize

It receives arguments in an Array and two hashes, one for options and other for configuration.

Class Method Details

.scope_options (private)

[ GitHub ]

  
# File 'lib/bundler/cli/config.rb', line 7

def self.scope_options
  method_option :global, type: :boolean, banner: "Only change the global config"
  method_option :local, type: :boolean, banner: "Only change the local config"
end

Instance Method Details

#base(name = nil, *value)

[ GitHub ]

  
# 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)

[ GitHub ]

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

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

#list

[ GitHub ]

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

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

#set(name, value, *value_)

[ GitHub ]

  
# 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)

[ GitHub ]

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

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