Class: Avm::EacRubyBase1::SourceGenerators::Base
- Inherits:
-
SourceGenerators::Base
- Object
- SourceGenerators::Base
- Avm::EacRubyBase1::SourceGenerators::Base
show all
- Defined in:
- lib/avm/eac_ruby_base1/source_generators/base.rb,
lib/avm/eac_ruby_base1/source_generators/base/options.rb,
lib/avm/eac_ruby_base1/source_generators/base/dependencies.rb,
lib/avm/eac_ruby_base1/source_generators/base/gemfile_lock.rb,
lib/avm/eac_ruby_base1/source_generators/base/version_builder.rb
Defined Under Namespace
Modules: Dependencies, GemfileLock, Options
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
Instance Method Summary
collapse
Instance Method Details
#lib_path ⇒ Object
28
29
30
|
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 28
def lib_path
name.split('-').join('/')
end
|
#name ⇒ Object
24
25
26
|
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 24
def name
root_directory.basename.to_s
end
|
32
33
34
35
36
37
38
39
|
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 32
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
20
21
22
|
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 20
def root_directory
target_path
end
|
#root_module ⇒ Object
41
42
43
|
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 41
def root_module
lib_path.camelize
end
|
#root_module_close ⇒ Object
45
46
47
48
49
|
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 45
def root_module_close
root_module_components.count.times.map do |index|
(IDENT * index) + 'end'
end.reverse.join("\n")
end
|
#root_module_components ⇒ Object
61
62
63
|
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 61
def root_module_components
root_module.split('::')
end
|
#root_module_inner_identation ⇒ Object
51
52
53
|
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 51
def root_module_inner_identation
IDENT * root_module_components.count
end
|
#root_module_open ⇒ Object
55
56
57
58
59
|
# File 'lib/avm/eac_ruby_base1/source_generators/base.rb', line 55
def root_module_open
root_module_components.each_with_index.map do |component, index|
(IDENT * index) + 'module ' + component
end.join("\n")
end
|