Class: Mercury::CLI::Commands::Bootstrap
- Inherits:
-
Cri::Command
- Object
- Cri::Command
- Mercury::CLI::Commands::Bootstrap
- Defined in:
- lib/mercury/cli/commands/bootstrap.rb
Overview
The bootstrap
command prepared the basic Mercury realms (if needed), and then links the current host to those realms. The basic realms consists of
Realm 0: Namespace. All the named realms stored in this domain.
Realm 1: *Realm Handlers*. The basic gateways needed to create/store/update other realms.
Realm 5: *Realm Code*. Libraries and other code which the realm handlers should use by preference when conducting operations on the realms.
If the IP address of a server (or a server name) is given to as an argument to this command, then we will use that IP address (name) for as the Mercury realm server to contact. Otherwise we will look for the same data from the file /etc/mercury.conf
: aborting if the file cannot be found.
Once we have made contact with the server, we look at the basic realms listed above, and attempt to ensure they can be found. If not, an attempt is made to create the basic realms: aborting if this attempt fails.
Finally, once everything has been set-up, we upload the core realm code (or update the existing code)
Instance Method Summary collapse
-
#aliases ⇒ Object
The aliases this sub-command is known by.
-
#long_desc ⇒ Object
A longer description, detailing both the purpose and the use of this command.
-
#name ⇒ Object
The name of the sub-command (as it appears in the command line app).
-
#option_definitions ⇒ Object
Define the options for this command.
-
#run(options, arguments) ⇒ Object
Execute the command.
-
#short_desc ⇒ Object
A short help text describing the purpose of this command.
-
#usage ⇒ Object
Show the user the basic syntax of this command.
Instance Method Details
#aliases ⇒ Object
The aliases this sub-command is known by
51 52 53 |
# File 'lib/mercury/cli/commands/bootstrap.rb', line 51 def aliases [] end |
#long_desc ⇒ Object
A longer description, detailing both the purpose and the use of this command
62 63 64 65 66 |
# File 'lib/mercury/cli/commands/bootstrap.rb', line 62 def long_desc 'Look for the specified server, adding the data required to link the ' + 'current host to that server. If the found server has not been set-up ' + 'then this command also performs the setup of the base realms as well. ' end |
#name ⇒ Object
The name of the sub-command (as it appears in the command line app)
46 47 48 |
# File 'lib/mercury/cli/commands/bootstrap.rb', line 46 def name 'bootstrap' end |
#option_definitions ⇒ Object
Define the options for this command
74 75 76 77 78 |
# File 'lib/mercury/cli/commands/bootstrap.rb', line 74 def option_definitions [ { :short => 's', :long => 'server', :argument => :optional } ] end |
#run(options, arguments) ⇒ Object
Execute the command
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/mercury/cli/commands/bootstrap.rb', line 81 def run(, arguments) # The first thing we need to do is to find the relevant server. So we # check the options and see if they can help unless [:server].nil? or [:server].empty? then # else # The user has not specified a server, so we will attempt to get one # from the system configuration if File.exists?("/etc/mercury.conf") then # # Everything has failed, so we abort else Mercury::CLI::Logger.instance.log_level(:high, :error, "Cannot locate a Mercury server. Either specify the server to connect to using the 'server' option, or create an appropriate configuration file.") end end end |
#short_desc ⇒ Object
A short help text describing the purpose of this command
56 57 58 |
# File 'lib/mercury/cli/commands/bootstrap.rb', line 56 def short_desc 'Create a link between this host and the mercury servers.' end |
#usage ⇒ Object
Show the user the basic syntax of this command
69 70 71 |
# File 'lib/mercury/cli/commands/bootstrap.rb', line 69 def usage "mercury bootstrap [-s server]" end |