class Chapter08_09::Generators::BeginGenerator
Public Instance Methods
copy_app_tree()
click to toggle source
# File lib/generators/chapter08_09/begin/begin_generator.rb, line 6 def copy_app_tree directory(self.class.source_root, Rails.root) end
generate_instructions()
click to toggle source
# File lib/generators/chapter08_09/begin/begin_generator.rb, line 16 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
insert_css()
click to toggle source
# File lib/generators/chapter08_09/begin/begin_generator.rb, line 10 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