Sha256: 0ac190094df31ad3064ecb6fcdfe12130fa1b9fb810e6083eefc004601d83105

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

module Vx
  module Builder
    class BuildConfiguration
      class Deploy

        attr_reader :attributes

        def initialize(new_env)
          normalize_attributes(new_env)
        end

        def providers
          @providers
        end
        alias :attributes :providers

        private

          def normalize_attributes(new_env)
            attrs =
              case new_env
              when Array
                new_env
              when Hash
                [new_env]
              when String
                [{"command" => new_env}]
              else
                []
              end

            extract_options_and_normalize_items(attrs)
          end

          def extract_options_and_normalize_items(new_env)
            @providers = []
            new_env.each do |env|
              case
              when env["provider"]
                @providers.push env
              when env["command"]
                @providers.push env.merge("provider" => "shell")
              end
            end
          end

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vx-builder-0.1.8 lib/vx/builder/build_configuration/deploy.rb
vx-builder-0.1.7 lib/vx/builder/build_configuration/deploy.rb
vx-builder-0.1.6 lib/vx/builder/build_configuration/deploy.rb
vx-builder-0.1.5 lib/vx/builder/build_configuration/deploy.rb
vx-builder-0.1.4 lib/vx/builder/build_configuration/deploy.rb
vx-builder-0.1.3 lib/vx/builder/build_configuration/deploy.rb