Module: SwitchDb
- Defined in:
- lib/switch_db.rb,
lib/switch_db/cli.rb,
lib/switch_db/utils.rb,
lib/switch_db/dialog.rb,
lib/switch_db/command.rb,
lib/switch_db/version.rb,
lib/switch_db/database.rb,
lib/switch_db/reference.rb,
lib/switch_db/command/rm.rb,
lib/switch_db/exceptions.rb,
lib/switch_db/command/base.rb,
lib/switch_db/command/list.rb,
lib/switch_db/command/store.rb,
lib/switch_db/configuration.rb,
lib/switch_db/option_parser.rb,
lib/switch_db/reference_set.rb,
lib/switch_db/command/config.rb,
lib/switch_db/database/mysql.rb,
lib/switch_db/command/restore.rb,
lib/switch_db/database/abstract.rb
Defined Under Namespace
Modules: Command, Database, Dialog, Utils
Classes: Cli, CommandNotFound, Configuration, OptionParser, Reference, ReferenceSet, SwitchDbError, UnknownConfigurationKey
Constant Summary
collapse
- VERSION =
'0.1.1'.freeze
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
14
15
16
|
# File 'lib/switch_db.rb', line 14
def self.configuration
@configuration ||= Configuration.new
end
|
.run(argv) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/switch_db.rb', line 18
def self.run(argv)
option_parser = SwitchDb::OptionParser.new(argv)
args = option_parser.parse!
command = args.delete(:command)
Cli.run!(command, args)
rescue SwitchDb::CommandNotFound => error
$stderr.puts(error.message)
$stderr.puts
$stderr.puts(option_parser.option_parser.banner)
rescue SwitchDb::UnknownConfigurationKey => error
$stderr.puts(error.message)
$stderr.puts
$stderr.puts("Allowed configuration keys are #{configuration.configuration_keys.map(&:to_s)}")
$stderr.puts
$stderr.puts(option_parser.option_parser.banner)
end
|