Sha256: 5155e72f649ce0df8efbff5a94f7974834e4905c5483e304d4d8dc10409886c9

Contents?: true

Size: 957 Bytes

Versions: 6

Compression:

Stored size: 957 Bytes

Contents

module Chapter08_09
  module Generators
    class BeginGenerator < Rails::Generators::Base
      source_root File.expand_path("../templates", __FILE__)

      def copy_app_tree
        directory(self.class.source_root, Rails.root)
      end

      def insert_css
        src  = File.expand_path("../snippets/custom.css", __FILE__)
        dest = File.join(Rails.root,'public','stylesheets','custom.css')
        insert_into_file(dest, File.binread(src), :before => /\Z/) # insert before end
      end

      def generate_instructions
        require 'rdiscount'
        
        instr_md = File.expand_path('../instructions.md',self.class.source_root)
        dest = File.join(Rails.root,'doc','chapter08_09.html')
        copy_file(instr_md, dest, :force => true) do |content|
          RDiscount.new(content).to_html
        end
        say_status('Note',"Now open file://#{dest} in your web browser for instructions", :cyan)
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
tft_rails_dbc-0.1.3 lib/generators/chapter08_09/begin/begin_generator.rb
tft_rails_dbc-0.1.1 lib/generators/chapter08_09/begin/begin_generator.rb
tft_rails_dbc-0.1 lib/generators/chapter08_09/begin/begin_generator.rb
tft_rails-0.6.2 lib/generators/chapter08_09/begin/begin_generator.rb
tft_rails-0.6.1 lib/generators/chapter08_09/begin/begin_generator.rb
tft_rails-0.6.0 lib/generators/chapter08_09/begin/begin_generator.rb