Module: VGH
- Defined in:
- lib/vgh.rb,
lib/vgh/cli.rb,
lib/vgh/ec2.rb,
lib/vgh/apps.rb,
lib/vgh/output.rb,
lib/vgh/system.rb,
lib/vgh/logging.rb,
lib/vgh/version.rb,
lib/vgh/ec2/volume.rb,
lib/vgh/system/lvm.rb,
lib/vgh/ec2/metadata.rb,
lib/vgh/ec2/snapshot.rb,
lib/vgh/system/mysql.rb,
lib/vgh/configuration.rb,
lib/vgh/apps/checkpoint.rb,
lib/vgh/apps/ec2_backup.rb
Overview
See the README file.
Defined Under Namespace
Modules: APPS, EC2, System Classes: CLI, Configuration, Logging, Output
Constant Summary collapse
- VERSION =
Version number
"0.2.6"
Instance Method Summary collapse
-
#app ⇒ String
Returns the app name specified in the command line.
-
#cli ⇒ Hash
Returns a global collection of options.
-
#config ⇒ Hash
Global config method.
-
#ec2 ⇒ Object
Creates a global ec2 method.
-
#fqdn ⇒ String
Returns the FQDN (either the one specified in the configuration file or the system’s one).
-
#instance_id ⇒ String
Looks for the instance id in the configuration.
-
#log ⇒ Object
Log message.
-
#logging? ⇒ Boolean
Returns logging.
-
#message ⇒ Object
Creates a global message method.
-
#run ⇒ Object
The main run method.
-
#show_footer ⇒ Object
Returns the footer.
-
#show_header ⇒ Object
Returns the header.
-
#verbose? ⇒ Boolean
Returns verbosity.
-
#version ⇒ Object
Returns the version number.
Instance Method Details
#app ⇒ String
Returns the app name specified in the command line
13 14 15 |
# File 'lib/vgh/cli.rb', line 13 def app $app ||= cli[:app] end |
#cli ⇒ Hash
Returns a global collection of options.
7 8 9 |
# File 'lib/vgh/cli.rb', line 7 def cli $cli ||= CLI.new. end |
#config ⇒ Hash
Global config method
10 11 12 |
# File 'lib/vgh/configuration.rb', line 10 def config $config ||= Configuration.new.config end |
#ec2 ⇒ Object
Creates a global ec2 method.
6 7 8 |
# File 'lib/vgh/ec2.rb', line 6 def ec2 $ec2 = AWS::EC2.new end |
#fqdn ⇒ String
Returns the FQDN (either the one specified in the configuration file or the system’s one)
6 7 8 9 10 11 12 13 |
# File 'lib/vgh/system.rb', line 6 def fqdn remote_fqdn = config[:fqdn] if remote_fqdn $fqdn ||= remote_fqdn else $fqdn ||= System.fqdn end end |
#instance_id ⇒ String
Looks for the instance id in the configuration. If it does not exist then it queries the API server for it.
8 9 10 11 12 13 14 15 16 |
# File 'lib/vgh/ec2/metadata.rb', line 8 def instance_id remote_instance = config[:instance] if remote_instance $instance_id ||= remote_instance else $instance_id ||= VGH::EC2::MetaData.new.instance_id end return $instance_id end |
#log ⇒ Object
Log message
6 7 8 9 10 11 12 |
# File 'lib/vgh/logging.rb', line 6 def log if logging? $log ||= Logging.new.log else $log ||= Logger.new('/dev/null') end end |
#logging? ⇒ Boolean
Returns logging
25 26 27 |
# File 'lib/vgh/cli.rb', line 25 def logging? $logging = cli[:logging] end |
#message ⇒ Object
Creates a global message method
4 5 6 |
# File 'lib/vgh/output.rb', line 4 def $message ||= Output.new end |
#run ⇒ Object
The main run method
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vgh.rb', line 22 def run # Display header show_header # Run apps case app when 'ec2-backup' APPS::EC2_Backup.new.run when 'checkpoint' APPS::Checkpoint.new.run end # Display footer end |
#show_footer ⇒ Object
Returns the footer
46 47 48 |
# File 'lib/vgh.rb', line 46 def . end |
#show_header ⇒ Object
Returns the header
41 42 43 |
# File 'lib/vgh.rb', line 41 def show_header .header end |
#verbose? ⇒ Boolean
Returns verbosity
19 20 21 |
# File 'lib/vgh/cli.rb', line 19 def verbose? $verbose = cli[:verbose] end |
#version ⇒ Object
Returns the version number
6 7 8 |
# File 'lib/vgh/version.rb', line 6 def version VERSION end |