Class: EY::Serverside::Callbacks::Distributor::ViabilityFilter
- Inherits:
-
Object
- Object
- EY::Serverside::Callbacks::Distributor::ViabilityFilter
- Includes:
- Railway
- Defined in:
- lib/engineyard-serverside/callbacks/distributor/viability_filter.rb
Instance Method Summary collapse
- #calculate_callback_name(input = {}) ⇒ Object
- #check_executable_candidates(input = {}) ⇒ Object
- #check_ruby_candidates(input = {}) ⇒ Object
- #normalize_input(input = {}) ⇒ Object
Methods included from Railway
Methods included from Result::DSL
Instance Method Details
#calculate_callback_name(input = {}) ⇒ Object
54 55 56 57 58 59 60 |
# 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 = {}) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# 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 = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# 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 = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# 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 |