Class: Avm::SourceGenerators::Base
Constant Summary
collapse
- OPTION_NAME =
'name'
- JOBS =
[].freeze
Class Method Summary
collapse
Instance Method Summary
collapse
#stereotype_namespace_module
Instance Method Details
#apply_template ⇒ Object
52
53
54
|
# File 'lib/avm/source_generators/base.rb', line 52
def apply_template
root_template.apply(self, target_path)
end
|
#assert_clear_directory ⇒ Object
47
48
49
50
|
# File 'lib/avm/source_generators/base.rb', line 47
def assert_clear_directory
target_path.mkpath
raise "\"#{target_path}\" is not empty" if target_path.children.any?
end
|
#name ⇒ String
31
32
33
|
# File 'lib/avm/source_generators/base.rb', line 31
def name
options[OPTION_NAME].if_present(target_path.basename.to_path)
end
|
36
37
38
|
# File 'lib/avm/source_generators/base.rb', line 36
def option_list
self.class.option_list
end
|
40
41
42
43
44
45
|
# File 'lib/avm/source_generators/base.rb', line 40
def perform
start_banner
assert_clear_directory
apply_template
perform_jobs
end
|
56
57
58
59
60
61
|
# File 'lib/avm/source_generators/base.rb', line 56
def perform_jobs
setting_value(:jobs).each do |job|
infom "Generating #{job.humanize}..."
send("generate_#{job}")
end
end
|
#root_template ⇒ EacTemlates::Modules::Base
70
71
72
|
# File 'lib/avm/source_generators/base.rb', line 70
def root_template
template
end
|
#start_banner ⇒ void
This method returns an undefined value.
64
65
66
67
|
# File 'lib/avm/source_generators/base.rb', line 64
def start_banner
infov 'Target path', target_path
infov 'Application name', name
end
|