Class: TemplateGenerator

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/defgen/generators/template/template_generator.rb

Constant Summary collapse

TEMPLATES =
templates.map { |f| File.basename(f, '.erb') }

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_stubsObject



22
23
24
# File 'lib/defgen/generators/template/template_generator.rb', line 22

def self.create_stubs
  new.create_stubs
end

.source_rootObject



6
7
8
# File 'lib/defgen/generators/template/template_generator.rb', line 6

def self.source_root
  File.join(File.dirname(__FILE__), 'templates')
end

Instance Method Details

#create_stubsObject



26
27
28
29
30
# File 'lib/defgen/generators/template/template_generator.rb', line 26

def create_stubs
  TEMPLATES.map(&:upcase).each do |template_file|
    template self.class.const_get("#{template_file}_SOURCE"), self.class.const_get("#{template_file}_DEST")
  end
end