Method: AsProject::AsClass#execute

Defined in:
lib/asclass.rb

#executeObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/asclass.rb', line 41

def execute
  name = @arguments.name
  
  # Only build class and test case if a name
  # was provided...
  if(!name.nil?)
    is_test_case = false
    is_interface = false

    template = ''
    if(@arguments.mxml)
      @project['display_object'] = true
      template = mxml_template
    elsif(@arguments.component)
      template = component_template
    elsif(name.match(/Test$/))
      is_test_case = true
      template = test_case_template
    elsif(name.match(/^I[A-Z]/) || name.match(/able$/))
      is_interface = true
      template = interface_template
    else
      template = class_template
    end
    
    if(!is_test_case)
      create_class(template)
    end
    
    if(!is_interface && @arguments.build_test_case || is_test_case)
      template = test_case_template
      create_test_case(template)
    end
  end
  
  if(@arguments.build_test_suites)
    create_test_suites
  end
end