Class: Chapter07::Generators::BeginGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Chapter07::Generators::BeginGenerator
- Defined in:
- lib/generators/chapter07/begin/begin_generator.rb
Instance Method Summary collapse
- #augment_gemfile ⇒ Object
- #copy_app_tree ⇒ Object
- #generate_instructions ⇒ Object
- #insert_gitignore ⇒ Object
Instance Method Details
#augment_gemfile ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/generators/chapter07/begin/begin_generator.rb', line 17 def augment_gemfile gem 'devise', '~> 1.3.4' gem 'gravatar_image_tag', '~> 1.0.0' gem 'rspec-rails', :version => '~> 2.6.0', :group => :development gem 'rspec', :version => '~> 2.6.0', :group => :test gem 'webrat', :version => '~> 0.7.3', :group => :test gem 'factory_girl_rails', :version => '~> 1.0', :group => :test end |
#copy_app_tree ⇒ Object
6 7 8 |
# File 'lib/generators/chapter07/begin/begin_generator.rb', line 6 def copy_app_tree directory(self.class.source_root, Rails.root, :force => true) end |
#generate_instructions ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/generators/chapter07/begin/begin_generator.rb', line 26 def generate_instructions require 'rdiscount' instr_md = File.('../instructions.md',self.class.source_root) dest = File.join(Rails.root,'doc','chapter07.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_gitignore ⇒ Object
10 11 12 13 14 15 |
# File 'lib/generators/chapter07/begin/begin_generator.rb', line 10 def insert_gitignore dest = File.join(Rails.root,'.gitignore') insert_into_file(dest, :before => /\Z/) do # insert before end "\n.idea\n" end end |