2010-09-11 20:22:54 +01:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
module Homebrew extend self
|
|
|
|
def edit
|
|
|
|
if ARGV.named.empty?
|
|
|
|
# EDITOR isn't a good fit here, we need a GUI client that actually has
|
|
|
|
# a UI for projects, so apologies if this wasn't what you expected,
|
|
|
|
# please improve it! :)
|
2010-12-31 11:00:15 -08:00
|
|
|
exec 'mate', HOMEBREW_REPOSITORY+"bin/brew",
|
|
|
|
HOMEBREW_REPOSITORY+'README.md',
|
|
|
|
HOMEBREW_REPOSITORY+".gitignore",
|
2011-08-24 14:45:01 +01:00
|
|
|
*library_folders
|
2010-09-11 20:22:54 +01:00
|
|
|
else
|
|
|
|
# Don't use ARGV.formulae as that will throw if the file doesn't parse
|
|
|
|
paths = ARGV.named.map do |name|
|
2011-05-07 19:29:54 -05:00
|
|
|
HOMEBREW_REPOSITORY+"Library/Formula/#{Formula.canonical_name name}.rb"
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
unless ARGV.force?
|
|
|
|
paths.each do |path|
|
|
|
|
raise FormulaUnavailableError, path.basename('.rb').to_s unless path.file?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
exec_editor *paths
|
|
|
|
end
|
|
|
|
end
|
2011-08-24 14:45:01 +01:00
|
|
|
|
|
|
|
def library_folders
|
|
|
|
Dir["#{HOMEBREW_REPOSITORY}/Library/*"].reject do |d|
|
|
|
|
case File.basename(d) when 'LinkedKegs', 'Aliases' then true end
|
|
|
|
end
|
|
|
|
end
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|