Sha256: c953c82ce57eb323fe66f02ba126619e40b23c54f861f3b94abaf4909f69836c

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 KB

Contents

require 'open-uri'
require 'fileutils'
require 'ruboss4ruby/version'
require 'ruboss4ruby/configuration'

module Merb::Generators
  class RubossFlexAppGenerator < Generator
    include Ruboss::Configuration

    option :air, :as => :boolean, :default => false, :desc => 'Configure AIR project instead of Flex. Flex is default.'
    
    def initialize(*args)
      super
      @project_name, @flex_project_name, @command_controller_name, @base_package, @base_folder = extract_names

      @component_names = []
       if File.exists?("app/flex/#{base_folder}/components/generated")
         @component_names = list_mxml_files("app/flex/#{base_folder}/components/generated")
       end
    end

    def project_name
      @project_name
    end

    def flex_project_name
      @flex_project_name
    end

    def base_folder
      @base_folder
    end
    
    def base_package
      @base_package
    end
    
    def command_controller_name
      @command_controller_name
    end
    
    def component_names
      @component_names
    end
    
    def application_tag
      if get_option(:air)
        'WindowedApplication'
      else
        'Application'
      end
    end

    def self.source_root
      File.join(File.dirname(__FILE__), 'templates', 'ruboss_flex_app')
    end

    desc <<-DESC
      Generates main flex application file.
    DESC
    
    template :main_app do |t|
      t.source = 'mainapp.mxml'
      t.destination = File.join('app', 'flex', "#{project_name}.mxml")
    end
  end
  
  add :ruboss_flex_app, RubossFlexAppGenerator
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruboss4ruby-1.0.3 merb_generators/ruboss_flex_app.rb
ruboss4ruby-1.0.4 merb_generators/ruboss_flex_app.rb
ruboss4ruby-1.0.5 merb_generators/ruboss_flex_app.rb