Sha256: 95f602fa5d7418947d4e8c5a7fc58af05f442439ee879beb040b8caf6a933d9d

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

require 'rubygems'
require 'thor/group'

module Bookshop
  module Generators
    # Thor based generator for creating new projects based upon a template project which
    # is copied into the name_of_book project-folder when 'build new name_of_book' is issued
    class AppGenerator < Thor::Group
      include Thor::Actions

      # Define arguments and options
      argument :app_path,               :type => :string
      
      # Define source root of application
      def self.source_root
        File.dirname(__FILE__)
      end

      # Create the project from templates
      def create_base_project
        puts "creating base project"
        directory "templates", "#{app_path}"
      end

      # Adds third-party tools
      def add_tools
        directory "tools/", "#{app_path}/tools/"
      end

      # Change the permissions so tools are executable 
      def chmod_tools
        chmod "#{app_path}/tools/epubcheck-1.2.jar", 0755
        chmod "#{app_path}/tools/kindlegen", 0755
      end

    protected

      def self.banner
        "bookshop new #{self.arguments.map(&:usage).join(' ')} [options]"
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bookshop-0.0.15 lib/bookshop/generators/bookshop/app/app_generator.rb
bookshop-0.0.14 lib/bookshop/generators/bookshop/app/app_generator.rb
bookshop-0.0.13 lib/bookshop/generators/bookshop/app/app_generator.rb
bookshop-0.0.12 lib/bookshop/generators/bookshop/app/app_generator.rb
bookshop-0.0.11 lib/bookshop/generators/bookshop/app/app_generator.rb