Class: FlashSDK::ClassGenerator

Inherits:
Sprout::Generator::Base show all
Includes:
FlashHelper
Defined in:
flashsdk/lib/flashsdk/generators/class_generator.rb

Overview

This Generator will create a new ActionScript class based on the ActionScript3Class.as template.

This Generator should only be executed from within a project that has a Gemfile. If your Gemfile loads the "asunit4" gem, a test case and test suite will also be created whenever this generator is run.

You can run this generator as follows:

$ sprout-class utils.MathUtil

You can prevent the creation of a test case and test suite by sending in the --no-test parameter as follows:

$ sprout-class utils.MathUtil --no-test

Direct Known Subclasses

ProjectGenerator

Constant Summary

Constants included from Sprout::Executable

DEFAULT_FILE_EXPRESSION, DEFAULT_PREFIX, DEFAULT_SHORT_PREFIX

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from FlashHelper

#actionscript_file_to_class_name, #class_directory, #class_name, #debug_swf_name, #default_package_name, #deploy_swf_name, #fully_qualified_class_name, #input_in_parts, #instance_name, #package_directory, #package_name, #project_name, #remove_file_extensions, #remove_slashes, #split_package, #test_case_classes, #test_cases, #test_cases=, #test_class_directory, #test_class_name, #test_glob, #test_glob=, #test_runner_name, #test_swf_name

Methods inherited from Sprout::Generator::Base

#create_template_paths, #default_search_paths, #directory, #do_show_template_paths, #execute, #file, #generator, inherited, #prepare_command, #resolve_template, #say, #template, #template_paths, #unexecute, #validate

Methods inherited from Sprout::Executable::Base

add_param, add_param_alias, #binary_path, #binary_path=, #create_outer_task, #default_file_expression, #execute, #execute_delegate, #from_hash, #initialize, #library_added, #parse!, #parse_extra_options!, #parse_rake_task_arg, #prepare, set, static_default_value_collection, static_parameter_collection, #stderr, #stderr=, #stdout, #stdout=, #system_execute, #to_hash, #to_help, #to_rake, #to_shell, #update_rake_task_name_from_args

Methods included from Sprout::Concern

#append_features, extended, #included

Constructor Details

This class inherits a constructor from Sprout::Executable::Base

Instance Attribute Details

- (String) assets

Returns:

  • (String)

    The path where assets will be created.

  • (String)

    An instance of String



# File ''

add_param :assets, String, { :default => 'assets' }

- (String) bin

Returns:

  • (String)

    The path where binaries should be created.

  • (String)

    An instance of String



# File ''

add_param :bin, String, { :default => 'bin' }

- (String) doc

Returns:

  • (String)

    The path where documentation should be created.

  • (String)

    An instance of String



# File ''

add_param :doc, String, { :default => 'doc' }

- (String) lib

Returns:

  • (String)

    The path where libraries should be added.

  • (String)

    An instance of String



# File ''

add_param :lib, String, { :default => 'lib' }

- (String) package

Returns:

  • (String)

    The default package to use.

  • (String)

    An instance of String



# File ''

add_param :package, String, { :default => ""}

- (String) skins

Returns:

  • (String)

    The path where skins will be created.

  • (String)

    An instance of String



# File ''

add_param :skins, String, { :default => 'skins' }

- (String) src

Returns:

  • (String)

    The path where source files should be created.

  • (String)

    An instance of String



# File ''

add_param :src, String, { :default => 'src' }

- (String) test

Returns:

  • (String)

    The path where test cases should be created.

  • (String)

    An instance of String



# File ''

add_param :test, String, { :default => 'test' }

- (Boolean) test_class

Returns:

  • (Boolean)

    Call the TestClassGenerator after creating class.

  • (Boolean)

    An instance of Boolean



# File ''

add_param :test_class, Boolean, { :default => true }

Instance Method Details

- (Object) manifest



61
62
63
64
65
66
67
68
69
70
71
# File 'flashsdk/lib/flashsdk/generators/class_generator.rb', line 61

def manifest
  if(!input.match(/Test$/))
    directory class_directory do
      template "#{class_name}.as", 'ActionScript3Class.as'
    end
  end

  if test_class
    generator :test_class, :input => "#{fully_qualified_class_name}Test"
  end
end