class Amanuensis::Generator

Public Instance Methods

run!() click to toggle source
# File lib/amanuensis/generator.rb, line 4
def run!
  valid_configurations!

  CodeManager.use Amanuensis.code_manager.to_sym
  Tracker.use     Amanuensis.tracker.to_sym

  changelog = build_changelog
  result    = push_changelog(changelog)

  create_release if result.all?
end

Private Instance Methods

build_changelog() click to toggle source
# File lib/amanuensis/generator.rb, line 30
def build_changelog
  verbose "Build changelog for #{version}" do
    Builder.new(version, latest_release.created_at).build
  end
end
classify(integration) click to toggle source
# File lib/amanuensis/generator.rb, line 84
def classify(integration)
  "Amanuensis::#{integration.to_s.classify}".constantize
end
code_manager() click to toggle source
# File lib/amanuensis/generator.rb, line 80
def code_manager
  @code_manager ||= classify Amanuensis.code_manager
end
create_release() click to toggle source
# File lib/amanuensis/generator.rb, line 50
def create_release
  return unless Amanuensis.release

  verbose 'Create release' do
    CodeManager.create_release version
  end
end
latest_release() click to toggle source
# File lib/amanuensis/generator.rb, line 46
def latest_release
  @latest_release ||= CodeManager.latest_release
end
logger() click to toggle source
# File lib/amanuensis/generator.rb, line 26
def logger
  @logger ||= Logger.new
end
push() click to toggle source
# File lib/amanuensis/generator.rb, line 72
def push
  @push ||= Amanuensis.push.map(&method(:classify))
end
push_changelog(changelog) click to toggle source
# File lib/amanuensis/generator.rb, line 36
def push_changelog(changelog)
  Amanuensis.push.map do |type|
    Push.use type.to_sym

    verbose "Push on #{type}" do
      Push.run changelog
    end
  end
end
tracker() click to toggle source
# File lib/amanuensis/generator.rb, line 76
def tracker
  @tracker ||= classify Amanuensis.tracker
end
valid_configurations!() click to toggle source
# File lib/amanuensis/generator.rb, line 58
def valid_configurations!
  verbose 'Valid configuration' do
    Amanuensis.valid!

    push.map(&:valid!)
    tracker.valid!
    code_manager.valid!
  end
end
verbose(message, &block) click to toggle source
# File lib/amanuensis/generator.rb, line 18
def verbose(message, &block)
  if Amanuensis.verbose
    logger.call message, block
  else
    block.call
  end
end
version() click to toggle source
# File lib/amanuensis/generator.rb, line 68
def version
  @version = Version.new(latest_release.tag).get
end