Class: Stopover::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



11
12
13
14
15
16
17
# File 'lib/generators/stopover/install_generator.rb', line 11

def self.banner
  <<-BANNER.chomp
rails g stopover:install

    Copies a layout, template and initializer to your application.
BANNER
end

Instance Method Details

#copy_initializerObject



20
21
22
# File 'lib/generators/stopover/install_generator.rb', line 20

def copy_initializer
  template 'stopover.rb', 'config/initializers/stopover.rb'
end

#copy_layoutObject



24
25
26
27
# File 'lib/generators/stopover/install_generator.rb', line 24

def copy_layout
  layout = "layouts/#{Stopover.layout_name}.html.#{template_engine}"
  copy_file layout, "app/views/#{layout}"
end

#copy_viewObject



29
30
31
32
# File 'lib/generators/stopover/install_generator.rb', line 29

def copy_view
  view = "404.html.#{template_engine}"
  copy_file "views/#{view}", "app/views/#{Stopover.view_path}/#{view}"
end

#show_readmeObject



34
35
36
# File 'lib/generators/stopover/install_generator.rb', line 34

def show_readme
  readme 'README' if behavior == :invoke
end