class EmergentGenerator < RubiGen::Base include RestfulX::Configuration attr_reader :project_name, :flex_project_name, :base_package, :base_folder, :command_controller_name, :component_names, :application_tag, :use_air def initialize(runtime_args, runtime_options = {}) super usage if args.empty? @destination_root = File.expand_path(args.shift) @project_name, @flex_project_name, @command_controller_name, @base_package, @base_folder = extract_names(base_name) @use_air = options[:air_config] if @use_air @application_tag = 'WindowedApplication' else @application_tag = 'Application' end @component_names = [] end def manifest record do |m| m.directory '' %w(script lib db bin-debug).each { |dir| m.directory dir } m.file 'core/default_tasks.rake', 'Rakefile' unless File.exist?('Rakefile') m.file 'core/flex.properties', '.flexProperties' m.file 'core/generate.rb', 'script/generate', { :chmod => 0755 } if @use_air m.template 'core/actionscriptair.properties', '.actionScriptProperties' m.template 'core/projectair.properties', '.project' else m.template 'core/actionscript.properties', '.actionScriptProperties' m.template 'core/project.properties', '.project' m.directory 'html-template/history' %w(index.template.html AC_OETags.js playerProductInstall.swf).each do |file| m.file "core/html-template/#{file}", "html-template/#{file}" end %w(history.css history.js historyFrame.html).each do |file| m.file "core/html-template/history/#{file}", "html-template/history/#{file}" end m.directory 'public/javascripts' m.file 'core/swfobject.js', 'public/javascripts/swfobject.js' m.file 'core/expressInstall.swf', 'public/expressInstall.swf' m.template 'core/index.html.erb', 'public/index.html' end end end protected def add_options!(opt) opt.separator '' opt.separator 'Options:' opt.on("-a", "--air", "Configure AIR project instead of Flex. Flex is default.", "Default: false") { |v| options[:air_config] = v } opt.on("--gae", "Generate Google App Engine Python classes in addition to RestfulX Flex resources.", "Default: false") { |v| options[:gae] = v } end end