class EY::Serverside::Callbacks::Distributor::ViabilityFilter

Public Instance Methods

calculate_callback_name(input = {}) click to toggle source
# File lib/engineyard-serverside/callbacks/distributor/viability_filter.rb, line 54
def calculate_callback_name(input = {})
  if input[:viable].empty?
    return Failure(input.merge({:reason => :no_viable_hooks}))
  end

  Success(input[:viable].first.callback_name)
end
check_executable_candidates(input = {}) click to toggle source
# File lib/engineyard-serverside/callbacks/distributor/viability_filter.rb, line 37
def check_executable_candidates(input = {})
  hooks = input[:candidates].
    select {|hook| hook.flavor == :executable}

  hooks.each do |hook|
    if hook.path.executable?
      input[:viable].push(hook)
    else
      input[:shell].warning(
        "Skipping possible deploy hook #{hook} because it is not executable."
      )
    end
  end

  Success(input)
end
check_ruby_candidates(input = {}) click to toggle source
# File lib/engineyard-serverside/callbacks/distributor/viability_filter.rb, line 26
def check_ruby_candidates(input = {})
  hooks = input[:candidates].
    select {|hook| hook.flavor == :ruby}

  hooks.each do |hook|
    input[:viable].push(hook)
  end

  Success(input)
end
normalize_input(input = {}) click to toggle source
# File lib/engineyard-serverside/callbacks/distributor/viability_filter.rb, line 16
def normalize_input(input = {})
  input[:viable] = []

  unless input[:candidates].respond_to?(:each)
    input[:candidates] = [input[:candidates]]
  end

  Success(input)
end