class Gemsmith::Generators::Base

Abstract class from which all generators inherit from.

Constants

LIB_ROOT
LIB_ROOT_GEM

Attributes

cli[R]
configuration[R]

Public Class Methods

new(cli, configuration: {}) click to toggle source
# File lib/gemsmith/generators/base.rb, line 16
def initialize cli, configuration: {}
  @cli = cli
  @configuration = configuration
end
run(cli, configuration: {}) click to toggle source
# File lib/gemsmith/generators/base.rb, line 12
def self.run cli, configuration: {}
  new(cli, configuration: configuration).run
end

Public Instance Methods

run() click to toggle source
# File lib/gemsmith/generators/base.rb, line 21
def run
  fail NotImplementedError, "The method, #run, is not implemented yet."
end

Protected Instance Methods

gem_name() click to toggle source
# File lib/gemsmith/generators/base.rb, line 29
def gem_name
  configuration.dig :gem, :name
end
gem_path() click to toggle source
# File lib/gemsmith/generators/base.rb, line 33
def gem_path
  configuration.dig :gem, :path
end
gem_root() click to toggle source
# File lib/gemsmith/generators/base.rb, line 37
def gem_root
  Pathname(cli.destination_root).join gem_name
end
template(path) click to toggle source
# File lib/gemsmith/generators/base.rb, line 41
def template path
  cli.template path, configuration
end