Sha256: 4720181d7910f75eddfcfa2eb76346b07c66f63f4c7b6c01636c5a367973b65c

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 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, :optional=> true, :type => :string
      
      # Define source root of application
      def self.source_root
        File.dirname(__FILE__)
      end

      
      # Create the project from templates
      def create_base_project
        raise GeneratorArgumentsError if app_path.nil?
        puts "creating base project"
        directory "templates", "#{app_path}"
      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
        chmod "#{app_path}/script/zip/zip.exe", 0755
      end
       
             
      
    protected

      def self.banner
        raise ArgumentsError
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bookshop-0.1.6 lib/bookshop/generators/bookshop/app/app_generator.rb
bookshop-0.1.5 lib/bookshop/generators/bookshop/app/app_generator.rb