cmd/*: don't restrict dev-cmd to Homebrew developers.

This commit is contained in:
Mike McQuaid 2016-09-05 21:32:58 +01:00
parent 691d57f594
commit 4f6bae46f9
4 changed files with 4 additions and 12 deletions

View File

@ -21,11 +21,7 @@ module Homebrew
def internal_command_path(cmd)
extensions = %w[rb sh]
paths = extensions.map { |ext| HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.#{ext}" }
if ARGV.homebrew_developer?
paths += extensions.map { |ext| HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.#{ext}" }
end
paths.find { |p| p.file? }
end
end

View File

@ -8,7 +8,7 @@ module Homebrew
def commands
if ARGV.include? "--quiet"
cmds = internal_commands + external_commands
cmds += internal_development_commands if ARGV.homebrew_developer?
cmds += internal_development_commands
cmds += HOMEBREW_INTERNAL_COMMAND_ALIASES.keys if ARGV.include? "--include-aliases"
puts_columns cmds.sort
else

View File

@ -72,11 +72,11 @@ module Homebrew
def command_path(cmd)
if File.exist?(HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh")
HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh"
elsif ARGV.homebrew_developer? && File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh")
elsif File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh")
HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh"
elsif File.exist?(HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb")
HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb"
elsif ARGV.homebrew_developer? && File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb")
elsif File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb")
HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb"
end
end

View File

@ -70,10 +70,6 @@ class CommandsTests < Homebrew::TestCase
end
def test_internal_dev_command_path
ARGV.stubs(:homebrew_developer?).returns false
assert_nil Homebrew.send(:internal_command_path, "rbdevcmd")
ARGV.stubs(:homebrew_developer?).returns true
assert_equal HOMEBREW_LIBRARY_PATH/"dev-cmd/rbdevcmd.rb",
Homebrew.send(:internal_command_path, "rbdevcmd")
assert_equal HOMEBREW_LIBRARY_PATH/"dev-cmd/shdevcmd.sh",