Sha256: d9a02a588924e34d12f2fad3f23d29c6883472f0465678a1d5d1457c2ec424b6

Contents?: true

Size: 942 Bytes

Versions: 4

Compression:

Stored size: 942 Bytes

Contents

module Roark
  module CLI
    module Shared
      def validate_required_options(options)
        options.each do |o|
          unless @options[o]
            @logger.error "Option '#{o.to_s}' required."
            exit 1
          end
        end
      end

      def validate_account_ids_format
        @options[:account_ids].each do |a|
          unless a =~ /^[0-9]{12}$/
            @logger.error "Account '#{a}' invalid. IDs must be 12 digits without dashes."
            exit 1
          end
        end
      end

      def command_name
        self.class.name.split('::').last.downcase
      end

      def help
        puts option_parser.help
      end

      def aws
        Roark::Aws::Connection.new :access_key_id  => @options[:access_key_id],
                                   :aws_secret_key => @options[:secret_access_key],
                                   :region         => @options[:region]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roark-0.2.2 lib/roark/cli/shared.rb
roark-0.2.1 lib/roark/cli/shared.rb
roark-0.2.0 lib/roark/cli/shared.rb
roark-0.1.0 lib/roark/cli/shared.rb