Module: SimpleDeploy::CLI::Shared
- Included in:
- Attributes, Clone, Create, Deploy, Destroy, Environments, Events, Execute, Instances, List, Outputs, Parameters, Protect, Resources, Status, Template, Update
- Defined in:
- lib/simple_deploy/cli/shared.rb
Instance Method Summary collapse
- #command_name ⇒ Object
- #parse_attributes(args) ⇒ Object
- #rescue_stackster_exceptions_and_exit ⇒ Object
- #valid_options?(args) ⇒ Boolean
Instance Method Details
#command_name ⇒ Object
38 39 40 |
# File 'lib/simple_deploy/cli/shared.rb', line 38 def command_name self.class.name.split('::').last.downcase end |
#parse_attributes(args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/simple_deploy/cli/shared.rb', line 6 def parse_attributes(args) attributes = args[:attributes] attrs = [] attributes.each do |attribs| key = attribs.split('=').first.gsub(/\s+/, "") value = attribs.gsub(/^.+?=/, '') logger.info "Read #{key}=#{value}" attrs << { key => value } end attrs end |
#rescue_stackster_exceptions_and_exit ⇒ Object
42 43 44 45 46 |
# File 'lib/simple_deploy/cli/shared.rb', line 42 def rescue_stackster_exceptions_and_exit yield rescue Stackster::Exceptions::Base exit 1 end |
#valid_options?(args) ⇒ Boolean
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/simple_deploy/cli/shared.rb', line 19 def (args) provided = args[:provided] required = args[:required] required.each do |opt| unless provided[opt] logger.error "Option '#{opt} (-#{opt[0]})' required but not specified." exit 1 end end if required.include? :environment unless Config.new.environments.keys.include? provided[:environment] logger.error "Environment '#{provided[:environment]}' does not exist." exit 1 end end end |