dev-cmd/edit: simplify project view handling.
The way Homebrew is structured now there’s no need to manually specify a few different directories here.
This commit is contained in:
parent
88bf60d589
commit
c6b6fc678e
@ -26,36 +26,15 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
# If no brews are listed, open the project root in an editor.
|
# If no brews are listed, open the project root in an editor.
|
||||||
if ARGV.named.empty?
|
paths = [HOMEBREW_REPOSITORY] if ARGV.named.empty?
|
||||||
editor = File.basename which_editor
|
|
||||||
if ["atom", "subl", "mate"].include?(editor)
|
|
||||||
# If the user is using Atom, Sublime Text or TextMate
|
|
||||||
# give a nice project view instead.
|
|
||||||
exec_editor HOMEBREW_REPOSITORY/"bin/brew",
|
|
||||||
HOMEBREW_REPOSITORY/"README.md",
|
|
||||||
HOMEBREW_REPOSITORY/".gitignore",
|
|
||||||
*library_folders
|
|
||||||
else
|
|
||||||
exec_editor HOMEBREW_REPOSITORY
|
|
||||||
end
|
|
||||||
else
|
|
||||||
# Don't use ARGV.formulae as that will throw if the file doesn't parse
|
|
||||||
paths = ARGV.named.map do |name|
|
|
||||||
path = Formulary.path(name)
|
|
||||||
|
|
||||||
raise FormulaUnavailableError, name unless path.file? || args.force?
|
# Don't use ARGV.formulae as that will throw if the file doesn't parse
|
||||||
|
paths ||= ARGV.named.map do |name|
|
||||||
path
|
path = Formulary.path(name)
|
||||||
end
|
raise FormulaUnavailableError, name if !path.file? && !args.force?
|
||||||
exec_editor(*paths)
|
path
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def library_folders
|
exec_editor(*paths)
|
||||||
Dir["#{HOMEBREW_LIBRARY}/*"].reject do |d|
|
|
||||||
case File.basename(d)
|
|
||||||
when "LinkedKegs", "Aliases" then true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user