Sha256: 6c91ba1f399756e65b6e803223579d57703c5bb4a8b4f82a4906f850dc71546a

Contents?: true

Size: 814 Bytes

Versions: 2

Compression:

Stored size: 814 Bytes

Contents

#!/usr/bin/env ruby

require 'bundler/setup'
require 'method_log'
require 'method_log/repository'
require 'method_log/api'
require 'trollop'

options = Trollop::options do
  opt :patch, 'Generate patch.', short: 'p'
  opt :max_count, 'Limit the number of commits to output.', type: :integer, short: 'n'
end

repository = MethodLog::Repository.new(path: Dir.pwd)
api = MethodLog::API.new(repository: repository)
api.diffs(ARGV[0], max_count: options[:max_count]).each do |method_commit, method_diff|
  puts "commit #{method_commit.sha}"
  puts "Author: #{method_commit.author[:name]} <#{method_commit.author[:email]}>"
  puts "Date:   #{method_commit.author[:time].strftime('%a %b %-e %T %Y %z')}"
  puts
  puts method_commit.message
  puts
  if options[:patch]
    puts method_diff.to_s(:color)
    puts
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
method_log-0.0.5 bin/method_log
method_log-0.0.4 bin/method_log