Sha256: 6425cc08468f88fb3a9a5fcab7807438608ce0d1eb888b445011e70f2c23e647
Contents?: true
Size: 1.2 KB
Versions: 18
Compression:
Stored size: 1.2 KB
Contents
module SimpleDeploy module CLI module Shared def parse_attributes(args) attributes = args[:attributes] attrs = [] attributes.each do |attribs| key = attribs.split('=').first.gsub(/\s+/, "") value = attribs.gsub(/^.+?=/, '') SimpleDeploy.logger.info "Read #{key}=#{value}" attrs << { key => value } end attrs end def valid_options?(args) provided = args[:provided] required = args[:required] required.each do |opt| unless provided[opt] SimpleDeploy.logger.error "Option '#{opt} (-#{opt[0]})' required but not specified." exit 1 end end if required.include? :environment unless SimpleDeploy.environments.keys.include? provided[:environment] SimpleDeploy.logger.error "Environment '#{provided[:environment]}' does not exist." exit 1 end end end def command_name self.class.name.split('::').last.downcase end def rescue_exceptions_and_exit yield rescue SimpleDeploy::Exceptions::Base exit 1 end end end end
Version data entries
18 entries across 18 versions & 1 rubygems