Class: Avm::Ruby::Gems::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/avm/ruby/gems/generator.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

Instance Method Summary collapse

Instance Method Details

#eac_ruby_gem_support_versionObject



21
22
23
# File 'lib/avm/ruby/gems/generator.rb', line 21

def eac_ruby_gem_support_version
  dependency_version('eac_ruby_gem_support')
end

#eac_ruby_utils_versionObject



25
26
27
# File 'lib/avm/ruby/gems/generator.rb', line 25

def eac_ruby_utils_version
  dependency_version('eac_ruby_utils')
end

#lib_pathObject



33
34
35
# File 'lib/avm/ruby/gems/generator.rb', line 33

def lib_path
  name.split('-').join('/')
end

#nameObject



29
30
31
# File 'lib/avm/ruby/gems/generator.rb', line 29

def name
  root_directory.basename.to_s
end

#root_moduleObject



37
38
39
# File 'lib/avm/ruby/gems/generator.rb', line 37

def root_module
  lib_path.camelize
end

#root_module_closeObject



41
42
43
44
45
# File 'lib/avm/ruby/gems/generator.rb', line 41

def root_module_close
  root_module_components.count.times.map do |index|
    (IDENT * index) + 'end'
  end.reverse.join("\n")
end

#root_module_componentsObject



57
58
59
# File 'lib/avm/ruby/gems/generator.rb', line 57

def root_module_components
  root_module.split('::')
end

#root_module_inner_identationObject



47
48
49
# File 'lib/avm/ruby/gems/generator.rb', line 47

def root_module_inner_identation
  IDENT * root_module_components.count
end

#root_module_openObject



51
52
53
54
55
# File 'lib/avm/ruby/gems/generator.rb', line 51

def root_module_open
  root_module_components.each_with_index.map do |component, index|
    (IDENT * index) + 'module ' + component
  end.join("\n")
end