Sha256: 5706340b57a6097a75cb6bb172d46148ced1a6c076abd4a2b9a5f12abf284514

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'rails/generators'

class SanteyBlogGenerator < Rails::Generators::Base
  include Rails::Generators::Migration
  
  class_option :css,     :type => :boolean, :default => false, :desc => "--css option - Install stylesheets to public/stylesheets"
  class_option :migrate, :type => :boolean, :default => false, :desc => "--migrate option - Install migrations to db/migrate"
  
  def self.source_root
    @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
  end
  
  def self.next_migration_number(dirname)
    Time.now.strftime("%Y%m%d%H%M%S")
  end
  
  def install_config
    directory "initializers", "config/initializers"
  end
  
  # copy stylesheets to public folder
  def install_css
    directory "css", "public/stylesheets/santey_blog" if options[:css] == true
  end
  
  # copy migrations to db/migrate
  def install_migrations
    migration_template "migrations/create_posts.rb", File.join('db/migrate', "create_posts.rb") if options[:migrate] == true
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
santey_blog-0.1.2 lib/generators/santey_blog_generator.rb