| Class | Sprout::ProjectModel |
| In: |
sprout/lib/sprout/project_model.rb
|
| Parent: | Hash |
The ProjectModel gives you a place to describe your project so that you don‘t need to repeat yourself throughout a rakefile.
The default set of properties are also used from code generators, library tasks and sometimes tools.
The ProjectModel can be configured as follows:
project_model :model do |p|
p.name = 'SomeProject'
p.source_path << 'somedir/otherdir'
p.library_path << 'somedir'
end
This class should have some reasonable default values, but can be modified from any rakefile. If you don‘t find some properties that you‘d like on the ProjectModel, you can simply add new properties and use them however you wish.
Arbitrary properties can be added as follows:
m = project_model :model do |p|
p.unknown_property = 'someValue'
end
puts "Unknown Property: #{m.unknown_property}"
The ProjectModel is typically treated as if it is a Singleton, and many helper tasks will automatically go look for their model at:
Sprout::ProjectModel.instance
Unlike a real Singleton, this static property will actually be populated with the most recently instantiated ProjectModel, and any well-behaved helper task will also allow you to send in a model as a prerequisite.
project_model :model_a project_model :model_b desc 'Compile and run a' debug :debug_a => :model_a desc 'Compile and run b' debug :debug_b => :model_b
| asset_dir | [RW] | Relative path to the folder where compile time assets will be stored |
| background_color | [RW] | The Background Color of the SWF file |
| bin_dir | [RW] | The folder where binary files will be created. Usually this is where any build artifacts like SWF files get placed. |
| compiler_gem_name | [RW] |
If you don‘t want to use the default compiler for your language set
it manually here. Possible values are:
|
| compiler_gem_version | [RW] | The version number of the compiler gem to use |
| contributors | [RW] | Contributors to the SWF file |
| creator | [RW] | The primary creator of the SWF file |
| doc_dir | [RW] | Directory where documentation should be placed. |
| external_css | [RW] | CSS documents that should be individually compiled for runtime stylesheet loading. |
| frame_rate | [RW] | The default frame rate of the SWF file |
| height | [RW] | The default height of the SWF file _(This value is overridden when embedded in an HTML page)_ |
| language | [RW] | The technology language that is being used, right now this value can be ‘as2’, ‘as3’ or ‘mxml’. Code generators take advantage of this setting to determine which templates to use and build tasks use this setting to determin the input file suffix (.as or .mxml). |
| lib_dir | [RW] |
The relative path to your library directory. Defaults to ‘lib‘
Any remote .SWC and source libraries that are referenced in your rakefile will be installed into this directory. Source libraries will be placed in a folder that matches the library name, while SWCs will be simply placed directly into the lib_dir. |
| libraries | [RW] | Array of sprout library symbols |
| library_path | [RW] | The Array of SWC paths to add to all compilation tasks |
| locale | [RW] | The locale for the SWF file |
| modules | [RW] | A collection of Flex Module root source files. If this collection has items added to it, the deploy task will generate a ‘link_report’ from the main application compilation and then consume it as ‘load_externs’ for each module compilation. |
| organization | [RW] | Organization responsible for this SWF file |
| output | [RW] | The production file that this Project will generate |
| preprocessed_path | [RW] | Folder where preprocessed files will be created. Defaults to ’.preprocessed‘ |
| preprocessor | [RW] | Terminal command to preprocessor application that accepts STDIN and returns on STDOUT |
| project_name | [RW] | The real name of the project, usually capitalized like a class name ‘SomeProject‘ |
| skin_dir | [RW] | The folder where compile time skins can be loaded from |
| skin_output | [RW] | The skin file that will be generated |
| source_path | [RW] | The Array of source paths to add to all compilation tasks _Do not add task-specific paths (like lib/asunit) to this value_ |
| src_dir | [RW] | The relative path to your main source directory. Defaults to ‘src‘ |
| strict | [RW] | Enforce strict type checking |
| swc_dir | [RW] | The relative path to the directory where swc files should be kept. This value defaults to lib_dir |
| test_dir | [RW] | Relative path to the folder that contains your test cases |
| test_height | [RW] | The test runner SWF height |
| test_output | [RW] | The test executable |
| test_width | [RW] | The test runner SWF width |
| use_fcsh | [RW] | Tasks that can, will use the Flex Compiler SHell. |
| use_fdb | [RW] | Flash Player Tasks will launch using the Flex Debugger. |
| width | [RW] | The default width of the SWF file _(This value is overridden when embedded in an HTML page)_ |
Static method that returns the most recently instantiated ProjectModel, or instantiates one if none have been created yet.
Simple MVC helper for project-wide views if your project is called ‘SomeProject’ this will default to:
SomeProject/src/someproject/controllers
Simple MVC helper for project-wide models if your project is called ‘SomeProject’ this will default to:
SomeProject/src/someproject/models
Simple MVC helper for project-wide views if your project is called ‘SomeProject’ this will default to:
SomeProject/src/someproject/views