Class: Bread::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/bread/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#inject_htmlObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/bread/install_generator.rb', line 10

def inject_html
  destination_path = 'app/views/layouts/application.html.erb'
  template_path = File.join(File.expand_path('../templates', __FILE__), "view.html.erb")
  html = open(template_path).read
  after_regex = /<body(.*)>/i

  inject_into_file destination_path, html, after: after_regex

rescue Errno::ENOENT
  puts "\tGENERATOR HAS FAILED"
  puts "\tINSERT THIS BLOCK ON #{destination_path}".red
  puts html.green
end

#main_config_filesObject



6
7
8
# File 'lib/generators/bread/install_generator.rb', line 6

def main_config_files
  directory "bread", "app/lib/bread"
end