Sha256: 493c705c0823a3fe5b536ecdad31155fa09741d58f928e81868479b8b53ac92d
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
#!/usr/bin/env ruby require 'method_log' require 'method_log/version' require 'optimist' options = Optimist::options do version MethodLog::VERSION banner <<-EOS Display the commit history for a single method. Usage: method_log [options] <method-signature> where <method-signature> is in the Ruby Index format e.g. Foo#bar, Bar::Baz#foo, Baz.foo. and [options] are: EOS opt :patch, 'Generate patch.' opt :ruby_version, 'Parser Ruby version (e.g. 2.5)', default: 'current' opt :max_count, 'Limit the number of commits to output.', type: :integer, short: 'n' opt :stop_at_latest_introduction_of_method, 'Stop at lastest introduction of method.', default: true opt :repository_path, 'Path to repository', default: Dir.pwd end Optimist.die 'No method signature specified' if ARGV.empty? method_signature = ARGV[0] case ruby_version = options[:ruby_version] when 'current' require 'parser/current' when /^(\d)\.(\d)$/ begin require "parser/ruby#{$1}#{$2}" Parser::CurrentRuby = Parser.const_get("Ruby#{$1}#{$2}") rescue LoadError Optimist.die "Ruby version not supported: #{ruby_version}" end else Optimist.die "Ruby version not supported: #{ruby_version}" end require 'method_log/repository' require 'method_log/api' repository = MethodLog::Repository.new(options[:repository_path]) api = MethodLog::API.new(repository) api.diffs(method_signature, options).each do |method_commit, method_diff| puts method_commit.to_s puts if options[:patch] puts method_diff.to_s(:color) puts end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
method_log-0.2.1 | bin/method_log |