class Vx::Builder::BuildConfiguration::Deploy

Attributes

attributes[R]

Public Class Methods

new(new_env) click to toggle source
# File lib/vx/builder/build_configuration/deploy.rb, line 20
def initialize(new_env)
  normalize(new_env)
end
restore_modules(values) click to toggle source
# File lib/vx/builder/build_configuration/deploy.rb, line 7
def restore_modules(values)
  (values || []).inject([]) do |ac, pair|
    k = pair.keys.first
    if it = Base.module_by_key(k)
      ac << it.new(pair)
    end
    ac
  end
end

Public Instance Methods

empty?() click to toggle source
# File lib/vx/builder/build_configuration/deploy.rb, line 28
def empty?
  attributes.empty?
end
find_modules(branch) click to toggle source
# File lib/vx/builder/build_configuration/deploy.rb, line 32
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 Instance Methods

normalize(new_env) click to toggle source
# File lib/vx/builder/build_configuration/deploy.rb, line 47
def normalize(new_env)
  attrs =
    case new_env
    when Array
      new_env
    when Hash
      [new_env]
    else
      []
    end

  normalize_each(attrs)
end
normalize_each(new_env) click to toggle source
# File lib/vx/builder/build_configuration/deploy.rb, line 61
def normalize_each(new_env)
  @attributes = []
  @attributes = new_env.select{|i| i.is_a?(Hash) }
end