Sha256: 66dd9f1ec5543aef15ea702af6819328d61258311a2bca2e4b440439ec3d81b8

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

module Vx
  module Builder
    class BuildConfiguration
      class Deploy

        attr_reader :attributes

        def initialize(new_env)
          normalize(new_env)
        end

        def attributes
          @attributes
        end

        def find_modules(branch)
          modules = []
          Base.loaded.each do |l|
            attributes.each do |attr|
              if l.detect(attr)
                modules << l.new(attr)
              end
            end
          end
          modules.select{ |m| m.branch?(branch) }
        end

        private

          def normalize(new_env)
            attrs =
              case new_env
              when Array
                new_env
              when Hash
                [new_env]
              else
                []
              end

            normalize_each(attrs)
          end

          def normalize_each(new_env)
            @attributes = []
            @attributes = new_env.select{|i| i.is_a?(Hash) }
          end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vx-builder-0.3.0 lib/vx/builder/build_configuration/deploy.rb