class Wire::AppGroupValidation

Run validations on appgroup model part

Public Instance Methods

appgroups_attached_to_zones?() click to toggle source

ensures that all application groups are attached to a zone

# File lib/wire/model/appgroup_validation.rb, line 22
def appgroups_attached_to_zones?
  objects_attached_to_zones? 'appgroups'
end
controllers_valid?() click to toggle source

ensures that all application groups have a known controller

# File lib/wire/model/appgroup_validation.rb, line 27
def controllers_valid?
  @project.get_element('appgroups').each do |appgroup_name, appgroup_data|
    controller_data = appgroup_data[:controller]
    type = 'appgroup'
    name = appgroup_name
    if !controller_data
      mark('Appgroup is not attached to a zone', type, name)
    else
      type = controller_data[:type]
      mark('Appgroup controller does not have a type', type, name) unless type && type.size > 0

      known_types = %w(fig)
      mark('Appgroup controller has an unkown type (#{type})',
           type, name) unless known_types.include?(type)
    end
  end
end
run_validations() click to toggle source

run validation steps on appgroup elements returns

# File lib/wire/model/appgroup_validation.rb, line 14
def run_validations
  return unless @project.element?('appgroups')

  appgroups_attached_to_zones?
  controllers_valid?
end