Class: Stationed::Generators::TemplatesGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



6
7
8
9
10
11
12
13
# File 'lib/generators/stationed/templates_generator.rb', line 6

def self.banner
  <<-BANNER.chomp
rails generate stationed:templates

Copies all generator templates from the Stationed gem into your project
directory for easy customisation.
  BANNER
end

Instance Method Details

#copy_filesObject



15
16
17
18
19
20
21
# File 'lib/generators/stationed/templates_generator.rb', line 15

def copy_files
  root = Pathname(self.class.source_root)
  Pathname.glob(root.join('**', '*.{haml,rb}')).each do |path|
    relpath = path.relative_path_from(root)
    copy_file relpath, Pathname('lib/templates').join(relpath)
  end
end