Sha256: 76526e194a180beb6e1613bbb252fd9d70bbb8b62d3dbe0ad5d66eb970243330

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require 'generators/transponder'

module Transponder
  module Generators
    class InstallGenerator < Base
      class_option :type,   type: :string, default: 'basic', desc: "type of app to generate", aliases: "-t"
      class_option :shared, type: :boolean, default: false
 
      def create_module
        directory "#{options[:type]}",     "app/assets/javascripts/#{file_name}"
      end

      def add_setup
        template "#{options[:type]}_setup.coffee", "app/assets/javascripts/#{file_name}/initializers/setup.coffee"
      end

      def add_manifest
        template "manifest.coffee", "app/assets/javascripts/#{file_name}/initializers/manifest.coffee" unless options[:shared]
      end

      def add_shared
        template "#{options[:type]}_shared.coffee", "app/assets/javascripts/#{file_name}/#{file_name}.coffee" if options[:shared]
      end

      def add_module_file
        template "#{options[:type]}.coffee", "app/assets/javascripts/#{file_name}.coffee" unless options[:shared]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
transponder-0.8.2 lib/generators/transponder/install/install_generator.rb