Class: RubyConfig::Main
- Inherits:
-
Object
- Object
- RubyConfig::Main
- Defined in:
- lib/ruby_config/main.rb
Constant Summary collapse
- RUBY_CONFIG_PATH =
File.join(ENV['HOME'], ".ruby-config")
Instance Method Summary collapse
-
#initialize ⇒ Main
constructor
A new instance of Main.
- #main(argv) ⇒ Object
Constructor Details
#initialize ⇒ Main
Returns a new instance of Main.
14 15 16 17 18 19 20 |
# File 'lib/ruby_config/main.rb', line 14 def initialize @rubygems = RubyConfig::Rubygems.new(RUBY_CONFIG_PATH) @registry = RubyConfig::Registry.new(RUBY_CONFIG_PATH) @installer = RubyConfig::Installer.new(RUBY_CONFIG_PATH) @switcher = RubyConfig::Switcher.new(RUBY_CONFIG_PATH) @config = RubyConfig::Config.new(RUBY_CONFIG_PATH) end |
Instance Method Details
#main(argv) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/ruby_config/main.rb', line 22 def main(argv) arguments = argv = RubyConfig::OptionsParser.new begin = .(arguments) if .help help() exit end rescue OptionParser::ParseError => e puts e .print_help exit end commands = .parse_commands!(arguments) if commands.list list_installed elsif commands.available list_available elsif commands.install install(commands.handle) elsif commands.uninstall uninstall(commands.handle) elsif commands.switch switch(commands.handle) elsif commands.setup setup else puts "Unknown Command: #{arguments}" .print_help end end |