Class: Avm::SourceGenerators::Base

Inherits:
Object
  • Object
show all
Includes:
With::ApplicationStereotype
Defined in:
lib/avm/source_generators/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from With::ApplicationStereotype

#stereotype_namespace_module

Class Method Details

.option_listAvm::SourceGenerators::OptionList



14
15
16
# File 'lib/avm/source_generators/base.rb', line 14

def option_list
  Avm::SourceGenerators::OptionList.new
end

Instance Method Details

#apply_templateObject



39
40
41
# File 'lib/avm/source_generators/base.rb', line 39

def apply_template
  template.apply(self, target_path)
end

#assert_clear_directoryObject



34
35
36
37
# File 'lib/avm/source_generators/base.rb', line 34

def assert_clear_directory
  target_path.mkpath
  raise "\"#{target_path}\" is not empty" if target_path.children.any?
end

#option_listAvm::SourceGenerators::OptionList



25
26
27
# File 'lib/avm/source_generators/base.rb', line 25

def option_list
  self.class.option_list
end

#performObject



29
30
31
32
# File 'lib/avm/source_generators/base.rb', line 29

def perform
  assert_clear_directory
  apply_template
end