Sha256: 574b7aca359f756033159a5f8f087a97c44bf14cab8bf18ec2ca61b5ef406a4e

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

require 'open-uri'
require 'fileutils'

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

1 entries across 1 versions & 1 rubygems

Version Path
dima-ruboss4ruby-1.0.5 merb_generators/ruboss_flex_app.rb