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
16 17 18 |
# File 'lib/avm/source_generators/base.rb', line 16 def option_list Avm::SourceGenerators::OptionList.new end |
Instance Method Details
#apply_template ⇒ Object
49 50 51 |
# File 'lib/avm/source_generators/base.rb', line 49 def apply_template root_template.apply(self, target_path) end |
#assert_clear_directory ⇒ Object
44 45 46 47 |
# File 'lib/avm/source_generators/base.rb', line 44 def assert_clear_directory target_path.mkpath raise "\"#{target_path}\" is not empty" if target_path.children.any? end |
#name ⇒ String
30 31 32 |
# File 'lib/avm/source_generators/base.rb', line 30 def name [OPTION_NAME].if_present(target_path.basename.to_path) end |
#option_list ⇒ Avm::SourceGenerators::OptionList
35 |
# File 'lib/avm/source_generators/base.rb', line 35 delegate :option_list, to: :class |
#perform ⇒ Object
37 38 39 40 41 42 |
# File 'lib/avm/source_generators/base.rb', line 37 def perform assert_clear_directory apply_template perform_jobs end |
#perform_jobs ⇒ Object
53 54 55 56 57 58 |
# File 'lib/avm/source_generators/base.rb', line 53 def perform_jobs setting_value(:jobs).each do |job| infom "Generating #{job.humanize}..." send("generate_#{job}") end end |
#root_template ⇒ EacTemlates::Modules::Base
67 68 69 |
# File 'lib/avm/source_generators/base.rb', line 67 def root_template template end |
#start_banner ⇒ void
This method returns an undefined value.
61 62 63 64 |
# File 'lib/avm/source_generators/base.rb', line 61 def infov 'Target path', target_path infov 'Application name', name end |