Module: Rudy::Routines::SCMHelper
- Extended by:
- SCMHelper
- Includes:
- HelperBase
- Included in:
- SCMHelper
- Defined in:
- lib/rudy/routines/helpers/scmhelper.rb
Instance Method Summary collapse
- #create_scm_objects(routine) ⇒ Object
-
#scm?(routine) ⇒ Boolean
Does the routine config contain SCM routines? Raises Rudy::Error if there is malformed configuration.
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
#create_scm_objects(routine) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rudy/routines/helpers/scmhelper.rb', line 20 def create_scm_objects(routine) return nil unless routine scmnames = SUPPORTED_SCM_NAMES & routine.keys vlist = [] # Look for scm config in the routine by checking all known scm types. # For each one we'll create an instance of the appropriate SCM class. scmnames.each do |scm| routine[scm].each_pair do |user,params| klass = eval "Rudy::SCM::#{scm.to_s.upcase}" params[:user] = user scm = klass.new(params) scm.raise_early_exceptions # Raises exceptions for obvious problems. vlist << scm end end vlist end |
#scm?(routine) ⇒ Boolean
Does the routine config contain SCM routines? Raises Rudy::Error if there is malformed configuration.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rudy/routines/helpers/scmhelper.rb', line 9 def scm?(routine) scmnames = SUPPORTED_SCM_NAMES & routine.keys # Find intersections. return false if scmnames.empty? # Nothing to do. scmnames.each do |scm| routine[scm].values.each do |t| # Each SCM should have a raise "Bad #{scm} config" if !t.kind_of?(Hash) # Hash config. Otherwise end # it's misconfigured. end true end |