Xu Cheng 8297810e3c add Formulary::path method
This is a little code refactoring splited from Homebrew/homebrew#36753

The idea is to eliminate `Formula#path` outside of `formulary.rb`.
And I indent to deprecate `Formula#path` method when I reimplement
symlink free tap function.

Closes Homebrew/homebrew#39313.
2015-05-08 13:51:26 +08:00

15 lines
313 B
Ruby

require "formula"
module Homebrew
def log
if ARGV.named.empty?
cd HOMEBREW_REPOSITORY
exec "git", "log", *ARGV.options_only
else
path = Formulary.path(ARGV.named.first)
cd path.dirname # supports taps
exec "git", "log", *ARGV.options_only + ["--", path]
end
end
end