Sha256: cfca7c97b0af6ec1e7c3a3cc660ce1eb391e252906507ccd8d79d2623c87c413

Contents?: true

Size: 1.35 KB

Versions: 24

Compression:

Stored size: 1.35 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"
      empty_directory "partials"
    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
      inside destination_root do
        run "bundle install"
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
troy-0.0.35 lib/troy/generator.rb
troy-0.0.34 lib/troy/generator.rb
troy-0.0.33 lib/troy/generator.rb
troy-0.0.32 lib/troy/generator.rb
troy-0.0.31 lib/troy/generator.rb
troy-0.0.30 lib/troy/generator.rb
troy-0.0.29 lib/troy/generator.rb
troy-0.0.28 lib/troy/generator.rb
troy-0.0.27 lib/troy/generator.rb
troy-0.0.26 lib/troy/generator.rb
troy-0.0.25 lib/troy/generator.rb
troy-0.0.24 lib/troy/generator.rb
troy-0.0.23 lib/troy/generator.rb
troy-0.0.22 lib/troy/generator.rb
troy-0.0.21 lib/troy/generator.rb
troy-0.0.20 lib/troy/generator.rb
troy-0.0.19 lib/troy/generator.rb
troy-0.0.18 lib/troy/generator.rb
troy-0.0.17 lib/troy/generator.rb
troy-0.0.16 lib/troy/generator.rb