Class: Omniscient::Command::Run
- Inherits:
-
Object
- Object
- Omniscient::Command::Run
- Defined in:
- lib/omniscient/command.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#argv ⇒ Object
Returns the value of attribute argv.
-
#configurations ⇒ Object
Returns the value of attribute configurations.
Instance Method Summary collapse
- #help ⇒ Object
-
#initialize(argv = '') ⇒ Run
constructor
A new instance of Run.
- #request_configuration ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(argv = '') ⇒ Run
Returns a new instance of Run.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/omniscient/command.rb', line 12 def initialize argv = '' @argv = argv @configurations = Omniscient::Configuration.load unless (["h", "help"] & Shell::Parser.(argv)).empty? help if self.respond_to?('help') exit end unless (["v", "version"] & Shell::Parser.(argv)).empty? version if self.respond_to?('version') exit end if self.respond_to?('run') run unless defined? TESTING elsif self.respond_to?('help') help end end |
Instance Attribute Details
#argv ⇒ Object
Returns the value of attribute argv.
10 11 12 |
# File 'lib/omniscient/command.rb', line 10 def argv @argv end |
#configurations ⇒ Object
Returns the value of attribute configurations.
10 11 12 |
# File 'lib/omniscient/command.rb', line 10 def configurations @configurations end |
Instance Method Details
#help ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/omniscient/command.rb', line 37 def help print "Usage:\n" print "\s\somniscient COMMAND [options]" print "\n\n" print "Commands available:" print "\n" print "\s\sclone\t\tClones a database from a remote server" print "\n\n" print "Examples:" print "\n" print "\s\somniscient clone alias_server_name" print "\n" print "\tClones a database from a remote server. If \n" print "\talias_server_name is unknown to Ominiscient, \n" print "\tit'll ask you all connection information." print "\n\n" print "For more information, try:\n" print "\s\somniscient COMMAND -h" print "\n" end |
#request_configuration ⇒ Object
33 34 35 |
# File 'lib/omniscient/command.rb', line 33 def request_configuration @configurations = Omniscient::Configuration::questions(:alias_name => @alias_name) end |
#version ⇒ Object
58 59 60 61 |
# File 'lib/omniscient/command.rb', line 58 def version print "Omniscient v" + Omniscient::VERSION print "\n" end |