Class: Sprout::SWFMillTask
- Inherits:
-
ToolTask
- Object
- ToolTask
- Sprout::SWFMillTask
- Defined in:
- lib/sprout/tasks/swfmill_task.rb,
lib/sprout/tasks/swfmill_rdoc.rb,
lib/sprout/tasks/swfmill_documentation.rb
Overview
Compile a set of assets (pngs, gifs, jpegs, mp3s, fonts, etc) into a library swf using SWFMill.
The resulting SWF file can be a Flash Player 6, 7 or 8 file format and is appropriately used as asset input for MTASC or MXMLC compilation.
This task simplifies SWFMill usage so that you can essentially point it at a directory of images, set the task as a prerequisite for an MTASCTask or an MXMLCTask, and have them self-configure to include the output.
A simple example is as follows:
swfmill 'assets/skins/SomeProjectSkin.swf' do |t|
t.input = 'assets/skins/SomeProjectSkin'
end
Instance Method Summary collapse
-
#define ⇒ Object
:nodoc:.
- #initialize_task ⇒ Object
-
#input=(string) ⇒ Object
The input can be one of the following * SWFMill XML document: Create and manually manage an input file as described at www.swfmill.org * Directory: if you point at a directory, this task will automatically include all files found forward of that directory.
-
#output=(file) ⇒ Object
The output parameter should not be set from outside of this task, the output file should be the task name.
-
#simple=(boolean) ⇒ Object
Set the SWFMill simple flag.
-
#template=(file) ⇒ Object
An ERB template to send to the generated SWFMillInputTask.
Instance Method Details
#define ⇒ Object
:nodoc:
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/sprout/tasks/swfmill_task.rb', line 63 def define # :nodoc: raise SWFMillError.new("The SWFMillTask should be given a SWF file as a task name instead of '#{name}'") unless output.match(/\.swf$/) CLEAN.add(output) # Respond to input parameter configuration if(File.directory?(input)) swfmill_input input_task_name do |t| t.input = input self.input = t.output # not a typo! end prerequisites << input_task_name simple = true end if(input.match(/.xml$/)) @simple = true end end |
#initialize_task ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/sprout/tasks/swfmill_task.rb', line 27 def initialize_task @default_gem_name = 'sprout-swfmill-tool' add_param(:simple, :boolean) do |p| p.value = true p.hidden_value = true p.prefix = '' p.description = "Set the SWFMill simple flag. This setting will determine what kind of xml document the compiler expects. Unless you really know what you're doing with SWFMill, this setting will usually be left alone." end add_param(:input, :string) do |p| p.hidden_name = true p.description =<<EOF The input can be one of the following * SWFMill XML document: Create and manually manage an input file as described at http://www.swfmill.org * Directory: if you point at a directory, this task will automatically include all files found forward of that directory. As it descends into child directories, the items found will be exposed in the library using period delimiters as follows: The file: yourcompany/yourproject/SomeFile.png Will be available in the compiled swf with a linkage identifier of: yourcompany.yourproject.SomeFile EOF end add_param(:output, :file) do |p| p.hidden_name = true p.description = "The output parameter should not be set from outside of this task, the output file should be the task name" end add_param(:template, :file) do |p| p.description = "An ERB template to send to the generated SWFMillInputTask. This template can be used to generate an XML input document based on the contents of a directory. If no template is provided, one will be created for you after the first run, and once created, you can configure it however you wish." end self.output = name.to_s end |
#input=(string) ⇒ Object
The input can be one of the following
-
SWFMill XML document: Create and manually manage an input file as described at www.swfmill.org
-
Directory: if you point at a directory, this task will automatically include all files found forward of that directory. As it descends into child directories, the items found will be exposed in the library using period delimiters as follows:
The file:
yourcompany/yourproject/SomeFile.png
Will be available in the compiled swf with a linkage identifier of:
yourcompany.yourproject.SomeFile
16 17 18 |
# File 'lib/sprout/tasks/swfmill_rdoc.rb', line 16 def input=(string) @input = string end |
#output=(file) ⇒ Object
The output parameter should not be set from outside of this task, the output file should be the task name
21 22 23 |
# File 'lib/sprout/tasks/swfmill_rdoc.rb', line 21 def output=(file) @output = file end |
#simple=(boolean) ⇒ Object
Set the SWFMill simple flag. This setting will determine what kind of xml document the compiler expects. Unless you really know what you’re doing with SWFMill, this setting will usually be left alone.
4 5 6 |
# File 'lib/sprout/tasks/swfmill_rdoc.rb', line 4 def simple=(boolean) @simple = boolean end |
#template=(file) ⇒ Object
An ERB template to send to the generated SWFMillInputTask. This template can be used to generate an XML input document based on the contents of a directory. If no template is provided, one will be created for you after the first run, and once created, you can configure it however you wish.
26 27 28 |
# File 'lib/sprout/tasks/swfmill_rdoc.rb', line 26 def template=(file) @template = file end |