Sha256: 24daa9d48d6f9b121b9bfe53973c2b1e34e0b88fd7649ead5b7b3a90dd8e55b2

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 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}/script/epubcheck/epubcheck.jar", 0755
        chmod "#{app_path}/script/epubcheck/lib/jing.jar", 0755
        chmod "#{app_path}/script/epubcheck/lib/saxon.jar", 0755
        chmod "#{app_path}/script/kindlegen/kindlegen.exe", 0755
        chmod "#{app_path}/script/kindlegen/kindlegen_mac", 0755
        chmod "#{app_path}/script/kindlegen/kindlegen_linux", 0755
      end

    protected

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

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bookshop-0.1.3 lib/bookshop/generators/bookshop/app/app_generator.rb