module Rudy::Routines::Handlers::Depends
Public Instance Methods
execute(routine_name, argv=[])
click to toggle source
A simple wrapper for executing a routine.
-
routine_name
should be a Symbol representing a routine available to the current machine group.
This method finds the handler for the given routine, creates an instance, calls #raise_early_exceptions, and finally executes the routine.
# File lib/rudy/routines/handlers/depends.rb, line 30 def execute(routine_name, argv=[]) routine_obj = Rudy::Routines.get_routine routine_name ld "Executing dependency: #{routine_name} (#{routine_obj}) (argv: #{argv})" routine = routine_obj.new routine_name, {}, argv routine.raise_early_exceptions routine.execute end
execute_all(depends, argv=[])
click to toggle source
Calls execute for each routine name in depends
(an Array).
Does nothing if given an empty Array or nil.
# File lib/rudy/routines/handlers/depends.rb, line 40 def execute_all(depends, argv=[]) return if depends.nil? || depends.empty? depends = depends.flatten.compact ld "Found depenencies: #{depends.join(', ')}" depends.each { |routine| execute(routine, argv) } end
raise_early_exceptions(type, depends, rset, lbox, argv=nil)
click to toggle source
# File lib/rudy/routines/handlers/depends.rb, line 12 def raise_early_exceptions(type, depends, rset, lbox, argv=nil) unless depends.kind_of? Array raise Rudy::Error, "#{type} must be a kind of Array (#{depends.class})" end raise Rudy::Routines::EmptyDepends, type if depends.nil? || depends.empty? depends.flatten.compact.each do |name| raise Rudy::Routines::NoRoutine, name unless valid_routine?(name) end end