Sha256: 346828f875b8dec4f1f3e80cb355d5e929c606be921a721b59d8efa2d0647c63
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true module Gistory module Cli class Main def initialize(repo_path:, args:, io: Gistory::Cli::Io.new) @repo_path = repo_path @args = args @io = io end def run repo = GitRepo.new(path: @repo_path) parser = Cli::ArgParser.new(args: @args, io: @io) config = parser.parse history(repo, config.gem_name) rescue Gistory::ParserError => e @io.error e.message @io.puts parser rescue Gistory::Error => e @io.error e.message end private def history(repo, gem_name) changes = ChangeLog.new(repo: repo).changelog_for_gem(gem_name) if changes.empty? raise(Gistory::Error, "Gem '#{gem_name}' not found in lock file, maybe a typo?") end @io.puts "Gem: #{gem_name}" @io.puts "Current version: #{changes.first.version}" @io.puts '' @io.puts 'Change history:' changes.each do |change| @io.puts "#{change.version} on #{change.date.strftime('%a, %e %b %Y %H:%M %Z')} (commit #{change.short_hash})" end @io.puts '' max = Gistory.config.max_lockfile_changes @io.puts "The last #{max} changes to the lock file were taken into account, to see farther in the past use the -m switch" # rubocop:disable Metrics/LineLength end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gistory-0.1.8 | lib/gistory/cli/main.rb |