Sha256: 2189fe4b006087bc39b2d50f5070e75836bf2874f82550b18db3436d7ec79d20

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require 'thor/group'
module Nakor
  module Generators
    class App < Thor::Group
      ASSET_FILES = %W{
        bk_default.png
        btn_about.png
        btn_about_over.png
        btn_help.png
        btn_help_over.png
        btn_play.png
        btn_play_over.png
        btn_settings.png
        btn_settings_over.png
        splash_screen.png
      }

      TEMPLATE_FILES = %W{
        about.lua
        build.settings
        config.lua
        help.lua
        init_buttons.lua
        io_ext.lua
        loadmenu.lua
        main.lua
        menu.lua
        orm.lua
        play.lua
        radlib.lua
        README
        settings.lua
        string_ext.lua
        table_ext.lua
        time_ext.lua
        ui.lua
        underscore.lua
      }

      include Thor::Actions

      argument :app_name, :type => :string

      def self.source_root
        File.dirname(__FILE__) + "/corona-game-template"
      end

      def create_group
        empty_directory(app_name)
      end

      def copy_source_files
        TEMPLATE_FILES.each do |template_file|
          template template_file, "#{app_name}/#{template_file}"
        end
      end

      def copy_asset_files
        ASSET_FILES.each do |asset_file|
          copy_file asset_file, "#{app_name}/#{asset_file}"
        end
      end

      def done
        puts "Successfully generated '#{app_name}'"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nakor-0.0.7 lib/nakor/generators/app.rb