Class: Avm::EacRubyBase1::SourceGenerators::Base
- Inherits:
-
SourceGenerators::Base
- Object
- SourceGenerators::Base
- Avm::EacRubyBase1::SourceGenerators::Base
- Defined in:
- lib/avm/eac_ruby_base1/source_generators/base.rb
Defined Under Namespace
Classes: VersionBuilder
Constant Summary collapse
- IDENT =
' '
- JOBS =
%w[root_directory gemspec root_lib version_lib static gemfile_lock].freeze
- TEMPLATE_VARIABLES =
%w[lib_path name root_module].freeze
- OPTIONS =
{ 'eac-ruby-utils-version'.to_sym => 'Version for "eac_ruby_utils" gem.', 'eac-ruby-gem-support-version'.to_sym => 'Version for "eac_ruby_gem_support" gem.' }.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #eac_ruby_gem_support_version ⇒ Object
- #eac_ruby_utils_version ⇒ Object
- #lib_path ⇒ Object
- #name ⇒ Object
- #perform ⇒ Object
- #root_directory ⇒ Object
- #root_module ⇒ Object
- #root_module_close ⇒ Object
- #root_module_components ⇒ Object
- #root_module_inner_identation ⇒ Object
- #root_module_open ⇒ Object
Class Method Details
.option_list ⇒ Object
24 25 26 |
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 24 def option_list OPTIONS.inject(super) { |a, e| a.option(*e) } end |
Instance Method Details
#eac_ruby_gem_support_version ⇒ Object
33 34 35 |
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 33 def eac_ruby_gem_support_version dependency_version('eac_ruby_gem_support') end |
#eac_ruby_utils_version ⇒ Object
37 38 39 |
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 37 def eac_ruby_utils_version dependency_version('eac_ruby_utils') end |
#lib_path ⇒ Object
45 46 47 |
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 45 def lib_path name.split('-').join('/') end |
#name ⇒ Object
41 42 43 |
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 41 def name root_directory.basename.to_s end |
#perform ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 49 def perform infov 'Root directory', root_directory infov 'Gem name', name JOBS.each do |job| infom "Generating #{job.humanize}..." send("generate_#{job}") end end |
#root_directory ⇒ Object
29 30 31 |
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 29 def root_directory target_path end |
#root_module ⇒ Object
58 59 60 |
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 58 def root_module lib_path.camelize end |
#root_module_close ⇒ Object
62 63 64 65 66 |
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 62 def root_module_close root_module_components.count.times.map do |index| (IDENT * index) + 'end' end.reverse.join("\n") end |
#root_module_components ⇒ Object
78 79 80 |
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 78 def root_module_components root_module.split('::') end |
#root_module_inner_identation ⇒ Object
68 69 70 |
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 68 def root_module_inner_identation IDENT * root_module_components.count end |
#root_module_open ⇒ Object
72 73 74 75 76 |
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 72 def root_module_open root_module_components.each_with_index.map do |component, index| (IDENT * index) + 'module ' + component end.join("\n") end |