Sha256: 9785384614054d56168467f62b34b562459a0b197e1f70b50ae642f523067c19

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 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"
      copy_file "style.scss", "assets/stylesheets/style.scss"
      copy_file "script.js", "assets/javascripts/script.js"
    end

    def bundle_install
      run "bundle install"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troy-0.0.11 lib/troy/generator.rb