Class: Gem::Commands::MultirepCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::MultirepCommand
- Defined in:
- lib/rubygems/commands/multirep_command.rb
Overview
new, #execute, #arguments, #defaults_str, #description and #usage Gem.ensure_gem_subdirectories @gem_home
Constant Summary collapse
- DEFAULT_CONFIG_FILE =
File.join system_config_path, 'repositories_gemrc'
Instance Method Summary collapse
-
#description ⇒ Object
:nodoc:.
- #execute ⇒ Object
-
#initialize ⇒ MultirepCommand
constructor
A new instance of MultirepCommand.
-
#usage ⇒ Object
:nodoc:.
Constructor Details
#initialize ⇒ MultirepCommand
Returns a new instance of MultirepCommand.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rubygems/commands/multirep_command.rb', line 26 def initialize @repositories = [] super 'multirep', "Add capability to have multiple local GEM repositories" add_option('-a', '--add PATH', 'Add new repository to list') do |value, | [:add] = value end add_option('-r', '--remove PATH', 'Remove repository from list') do |value, | [:remove] = value end remove_option '--config-file' end |
Instance Method Details
#description ⇒ Object
:nodoc:
46 47 48 |
# File 'lib/rubygems/commands/multirep_command.rb', line 46 def description # :nodoc: "" end |
#execute ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rubygems/commands/multirep_command.rb', line 50 def execute @repositories = load_file(DEFAULT_CONFIG_FILE) if [:add] || [:remove] if [:add] require 'ruby-debug' debugger @repositories << [:add] elsif [:remove] @repositories.delete([:remove]) end save_file(DEFAULT_CONFIG_FILE) end say "List of repositories:" say @repositories end |
#usage ⇒ Object
:nodoc:
42 43 44 |
# File 'lib/rubygems/commands/multirep_command.rb', line 42 def usage # :nodoc: "#{program_name}" end |