Sha256: da2c7106baf499ea656a17bdaeeb4304e7ff938fce788755a6fe5cbb90187ba8

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

# coding: utf-8

require 'thor/group'
require 'grit'
require 'bundler'
require 'bundler/cli'
require 'retter'

class Retter::Generator::Base < Thor::Group
  TEMPLATES = %w(
    Retterfile
    Gemfile
    config.ru
    index.html
    layouts/entries.html.haml
    layouts/entry.html.haml
    layouts/article.html.haml
    layouts/profile.html.haml
    layouts/index.html.haml
    layouts/retter.html.haml
  )

  FILES = %w(
    .gitignore
    retters/.gitkeep
    images/.gitkeep
    entries/.gitkeep
    tmp/cache/.gitkeep
    javascripts/.gitkeep
    stylesheets/base.css
    stylesheets/retter.css
    stylesheets/pygments.css

    stylesheets/orange.css
    images/orange/bg_body.jpg
    images/orange/bg_entry.jpg
    images/orange/bg_header.png
  )

  include Thor::Actions

  argument :name

  def self.source_root
    File.dirname(__FILE__)
  end

  def create_files
    FILES.each do |file|
      copy_file %(skel/#{file}), %(#{name}/#{file})
    end

    TEMPLATES.each do |file|
      template %(skel/#{file}), %(#{name}/#{file})
    end
  end

  def bundle_install
    Dir.chdir name do
      cli = Bundler::CLI.new

      cli.install
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
retter-0.2.5 lib/retter/generator/base.rb
retter-0.2.4 lib/retter/generator/base.rb
retter-0.2.3 lib/retter/generator/base.rb