Sha256: d57584b5d0b3bfc18b66208b8aefd86352e90047e0eb79058ef11a74e41cafec

Contents?: true

Size: 997 Bytes

Versions: 22

Compression:

Stored size: 997 Bytes

Contents

module SimpleDeploy
  module CLI
    module Shared

      def self.parse_attributes(args)
        attributes = args[:attributes]
        logger = args[:logger]

        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

      def self.valid_options?(args)
        provided = args[:provided]
        required = args[:required]

        required.each do |opt|
          unless provided[opt]
            puts "Option '#{opt} (-#{opt[0]})' required but not specified."
            exit 1
          end
        end

        if required.include? :environment
          unless Config.new.environments.keys.include? provided[:environment]
            puts "Environment '#{provided[:environment]}' does not exist."
            exit 1
          end
        end

      end

    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
simple_deploy-0.6.4 lib/simple_deploy/cli/shared.rb
simple_deploy-0.6.3 lib/simple_deploy/cli/shared.rb
simple_deploy-0.6.2 lib/simple_deploy/cli/shared.rb
simple_deploy-0.6.1 lib/simple_deploy/cli/shared.rb
simple_deploy-0.6.0 lib/simple_deploy/cli/shared.rb
simple_deploy-0.5.6 lib/simple_deploy/cli/shared.rb
simple_deploy-0.5.5 lib/simple_deploy/cli/shared.rb
simple_deploy-0.5.4 lib/simple_deploy/cli/shared.rb
simple_deploy-0.5.3 lib/simple_deploy/cli/shared.rb
simple_deploy-0.5.2 lib/simple_deploy/cli/shared.rb
simple_deploy-0.5.1 lib/simple_deploy/cli/shared.rb
simple_deploy-0.5.0 lib/simple_deploy/cli/shared.rb
simple_deploy-0.4.8 lib/simple_deploy/cli/shared.rb
simple_deploy-0.4.7 lib/simple_deploy/cli/shared.rb
simple_deploy-0.4.6 lib/simple_deploy/cli/shared.rb
simple_deploy-0.4.5 lib/simple_deploy/cli/shared.rb
simple_deploy-0.4.5.rc.0 lib/simple_deploy/cli/shared.rb
simple_deploy-0.4.4 lib/simple_deploy/cli/shared.rb
simple_deploy-0.4.3 lib/simple_deploy/cli/shared.rb
simple_deploy-0.4.2 lib/simple_deploy/cli/shared.rb