Sha256: ab741f2ca8dc60340fc35456b2c70d34f0482ebb818b0dd1ea051836d3722f48

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

module Troy
  # The Troy::Generator class will create a new book structure.
  #
  #   ebook = Troy::Generator.new
  #   ebook.destination_root = "/some/path/book-name"
  #   ebook.invoke_all
  #
  class Generator < Thor::Group
    include Thor::Actions

    desc "Generate a new site structure"

    def self.source_root
      File.expand_path("../../../templates", __FILE__)
    end

    def create_directories
      empty_directory "assets/javascripts"
      empty_directory "assets/stylesheets"
      empty_directory "assets/images"
      empty_directory "assets/media"
      empty_directory "source"
      empty_directory "config"
      empty_directory "layouts"
    end

    def copy_files
      copy_file "helpers.rb", "config/helpers.rb"
      copy_file "default.erb", "layouts/default.erb"
      copy_file "index.erb", "source/index.erb"
      copy_file "404.erb", "source/404.erb"
      copy_file "500.erb", "source/500.erb"
      copy_file "Gemfile", "Gemfile"
      copy_file "config.ru", "config.ru"
      copy_file "unicorn.rb", "config/unicorn.rb"
      copy_file "troy.rb", "config/troy.rb"
    end

    def bundle_install
      run "bundle install"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
troy-0.0.10 lib/troy/generator.rb
troy-0.0.9 lib/troy/generator.rb