Module: Rudy::Routines::DependsHelper
- Extended by:
- DependsHelper
- Includes:
- HelperBase
- Included in:
- DependsHelper
- Defined in:
- lib/rudy/routines/helpers/dependshelper.rb
Instance Method Summary collapse
-
#get(timing, routine) ⇒ Object
Returns an Array of the dependent routines for the given
timing
(before/after). - #has_depends?(timing, routine) ⇒ Boolean
Methods included from HelperBase
#command_separator, #execute_rbox_command, #keep_going?
Methods included from Huxtable
change_environment, change_position, change_region, change_role, change_zone, #check_keys, #config_dirname, create_domain, #current_group_name, #current_machine_address, #current_machine_count, #current_machine_group, #current_machine_hostname, #current_machine_image, #current_machine_name, #current_machine_size, #current_user, #current_user_keypairpath, debug?, #debug?, domain, domain_exists?, #group_metadata, #has_keypair?, #has_keys?, #has_pem_keys?, #has_root_keypair?, keypair_path_to_name, #known_machine_group?, #root_keypairname, #root_keypairpath, #switch_user, update_config, update_global, update_logger, #user_keypairname, #user_keypairpath
Instance Method Details
#get(timing, routine) ⇒ Object
Returns an Array of the dependent routines for the given timing
(before/after)
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rudy/routines/helpers/dependshelper.rb', line 12 def get(timing, routine) return if !(routine.is_a?(Caesars::Hash) || routine[timing].is_a?(Caesars::Hash)) # This will produce an Array containing the routines to run. The # elements are the valid routine names. # NOTE: The "timing" elements are removed from the routines hash. dependencies = [] routine[timing].each_pair do |n,v| next unless v.nil? # this skips all "script" blocks raise "#{timing}: #{n} is not a known routine" unless valid_routine?(n) routine[timing].delete(n) dependencies << n end # We need to return only the keys b/c the values are nil dependencies = nil if dependencies.empty? dependencies end |
#has_depends?(timing, routine) ⇒ Boolean
7 8 9 |
# File 'lib/rudy/routines/helpers/dependshelper.rb', line 7 def has_depends?(timing, routine) (!routine.is_a?(Caesars::Hash) || routine[timing].is_a?(Caesars::Hash)) end |