Class: Avm::SourceGenerators::Base
- Inherits:
-
Object
- Object
- Avm::SourceGenerators::Base
- Includes:
- With::ApplicationStereotype
- Defined in:
- lib/avm/source_generators/base.rb
Constant Summary collapse
- OPTION_NAME =
'name'
- JOBS =
[].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #apply_template ⇒ Object
- #assert_clear_directory ⇒ Object
- #name ⇒ String
- #option_list ⇒ Avm::SourceGenerators::OptionList
- #perform ⇒ Object
- #perform_jobs ⇒ Object
- #root_template ⇒ EacTemlates::Modules::Base
- #start_banner ⇒ void
Class Method Details
.option_list ⇒ Avm::SourceGenerators::OptionList
13 14 15 |
# File 'lib/avm/source_generators/base.rb', line 13 def option_list Avm::SourceGenerators::OptionList.new end |
Instance Method Details
#apply_template ⇒ Object
46 47 48 |
# File 'lib/avm/source_generators/base.rb', line 46 def apply_template root_template.apply(self, target_path) end |
#assert_clear_directory ⇒ Object
41 42 43 44 |
# File 'lib/avm/source_generators/base.rb', line 41 def assert_clear_directory target_path.mkpath raise "\"#{target_path}\" is not empty" if target_path.children.any? end |
#name ⇒ String
27 28 29 |
# File 'lib/avm/source_generators/base.rb', line 27 def name [OPTION_NAME].if_present(target_path.basename.to_path) end |
#option_list ⇒ Avm::SourceGenerators::OptionList
32 |
# File 'lib/avm/source_generators/base.rb', line 32 delegate :option_list, to: :class |
#perform ⇒ Object
34 35 36 37 38 39 |
# File 'lib/avm/source_generators/base.rb', line 34 def perform assert_clear_directory apply_template perform_jobs end |
#perform_jobs ⇒ Object
50 51 52 53 54 55 |
# File 'lib/avm/source_generators/base.rb', line 50 def perform_jobs setting_value(:jobs).each do |job| infom "Generating #{job.humanize}..." send("generate_#{job}") end end |
#root_template ⇒ EacTemlates::Modules::Base
64 65 66 |
# File 'lib/avm/source_generators/base.rb', line 64 def root_template template end |
#start_banner ⇒ void
This method returns an undefined value.
58 59 60 61 |
# File 'lib/avm/source_generators/base.rb', line 58 def infov 'Target path', target_path infov 'Application name', name end |