module Sprout # The Sprout::MXMLCFlexBuilder task is intended to # transform Sprout::ProjectModel instances into Flex Builder Eclipse # project files. # # This task should also be able to analyze Flex Builder project files # and emit a Sprout::ProjectModel based on the information found there. # # The current incarnation is a proof of concept and may not work properly, # but here is an example just in case: # # flex_builder :project # class MXMLCFlexBuilder < MXMLCHelper # :nodoc: PROJECT = '.project' ACTION_SCRIPT_PROPERTIES = '.actionScriptProperties' def initialize(args, &block) super outer_task = task args => [PROJECT, ACTION_SCRIPT_PROPERTIES] t = file PROJECT do |t| File.open(t.name, 'w') do |file| file.write t.to_xml end end configure_project_task t t = file ACTION_SCRIPT_PROPERTIES do |t| File.open(t.name, 'w') do |file| file.write t.to_xml end end configure_action_script_properties t return outer_task end def configure_project_task(project_task) def project_task.xml=(str) @xml = str end project_task.xml = < #{model.project_name} com.adobe.flexbuilder.project.flexbuilder com.adobe.flexbuilder.project.actionscriptnature EOF def project_task.to_xml return @xml end end def configure_action_script_properties(properties_task) def properties_task.xml=(str) @xml = str end str1 = < EOF str2 = "" model.source_path.each do |path| str2 << "\n" end str3 = < EOF str4 = < EOF str5 = "" model.library_path.each do |path| str5 << "\n" end str6 = < EOF properties_task.xml = str1 + str2 + str3 + str4 + str5 + str6 def properties_task.to_xml return @xml end end end end def flex_builder(args, &block) return Sprout::MXMLCFlexBuilder.new(args, &block) end