Class: UnbundleParameters
- Inherits:
-
ParametersBase
- Object
- OptionParser
- ParametersBase
- UnbundleParameters
- Defined in:
- lib/ec2/amitools/unbundleparameters.rb
Constant Summary collapse
- MANIFEST_DESCRIPTION =
"The path to the AMI manifest file."
- SOURCE_DESCRIPTION =
'The directory containing bundled AMI parts to unbundle. Defaults to ".".'
- DESTINATION_DESCRIPTION =
'The directory to unbundle the AMI into. Defaults to the ".".'
Constants inherited from ParametersBase
ParametersBase::BATCH_DESCRIPTION, ParametersBase::DEBUG_DESCRIPTION, ParametersBase::HELP_DESCRIPTION, ParametersBase::MANUAL_DESCRIPTION, ParametersBase::PASS_DESCRIPTION, ParametersBase::USER_ACCOUNT_DESCRIPTION, ParametersBase::USER_CERT_PATH_DESCRIPTION, ParametersBase::USER_DESCRIPTION, ParametersBase::USER_PK_PATH_DESCRIPTION, ParametersBase::VERSION_DESCRIPTION
Instance Attribute Summary collapse
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#manifest_path ⇒ Object
Returns the value of attribute manifest_path.
-
#source ⇒ Object
Returns the value of attribute source.
-
#user_pk_path ⇒ Object
Returns the value of attribute user_pk_path.
Attributes inherited from ParametersBase
#batch_mode, #debug, #manual, #show_help, #version
Instance Method Summary collapse
-
#mandatory_params ⇒ Object
—————————————————————————-#.
-
#optional_params ⇒ Object
—————————————————————————-#.
-
#set_defaults ⇒ Object
—————————————————————————-#.
-
#validate_params ⇒ Object
—————————————————————————-#.
Methods inherited from ParametersBase
#assert_directory_exists, #assert_exists, #assert_file_executable, #assert_file_exists, #assert_glob_expands, #assert_good_key, #assert_option_in, #common_params, #early_exit?, #initialize, #interactive?, #version_copyright_string
Constructor Details
This class inherits a constructor from ParametersBase
Instance Attribute Details
#destination ⇒ Object
Returns the value of attribute destination.
19 20 21 |
# File 'lib/ec2/amitools/unbundleparameters.rb', line 19 def destination @destination end |
#manifest_path ⇒ Object
Returns the value of attribute manifest_path.
19 20 21 |
# File 'lib/ec2/amitools/unbundleparameters.rb', line 19 def manifest_path @manifest_path end |
#source ⇒ Object
Returns the value of attribute source.
19 20 21 |
# File 'lib/ec2/amitools/unbundleparameters.rb', line 19 def source @source end |
#user_pk_path ⇒ Object
Returns the value of attribute user_pk_path.
19 20 21 |
# File 'lib/ec2/amitools/unbundleparameters.rb', line 19 def user_pk_path @user_pk_path end |
Instance Method Details
#mandatory_params ⇒ Object
—————————————————————————-#
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ec2/amitools/unbundleparameters.rb', line 26 def mandatory_params() on('-k', '--privatekey PATH', String, USER_PK_PATH_DESCRIPTION) do |path| assert_file_exists(path, '--privatekey') @user_pk_path = path end on('-m', '--manifest PATH', String, MANIFEST_DESCRIPTION) do |manifest| assert_file_exists(manifest, '--manifest') @manifest_path = manifest end end |
#optional_params ⇒ Object
—————————————————————————-#
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ec2/amitools/unbundleparameters.rb', line 40 def optional_params() on('-s', '--source DIRECTORY', String, SOURCE_DESCRIPTION) do |directory| assert_directory_exists(directory, '--source') @source = directory end on('-d', '--destination DIRECTORY', String, DESTINATION_DESCRIPTION) do |directory| assert_directory_exists(directory, '--destination') @destination = directory end end |
#set_defaults ⇒ Object
—————————————————————————-#
61 62 63 64 |
# File 'lib/ec2/amitools/unbundleparameters.rb', line 61 def set_defaults() @source ||= Dir::pwd() @destination ||= Dir::pwd() end |
#validate_params ⇒ Object
—————————————————————————-#
54 55 56 57 |
# File 'lib/ec2/amitools/unbundleparameters.rb', line 54 def validate_params() raise MissingMandatory.new('--manifest') unless @manifest_path raise MissingMandatory.new('--privatekey') unless @user_pk_path end |