Merge pull request #8230 from MikeMcQuaid/tap-pin

Remove more tap pinning code.
This commit is contained in:
Mike McQuaid 2020-08-06 12:49:47 +01:00 committed by GitHub
commit a9f5925cdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 0 additions and 78 deletions

View File

@ -69,7 +69,6 @@ module Homebrew
puts unless i.zero?
info = "#{tap}: "
if tap.installed?
info += tap.pinned? ? "pinned" : "unpinned"
info += ", private" if tap.private?
info += if (contents = tap.contents).empty?
", no commands/casks/formulae"

View File

@ -247,17 +247,6 @@ class TapAlreadyTappedError < RuntimeError
end
end
class TapPinStatusError < RuntimeError
attr_reader :name, :pinned
def initialize(name, pinned)
@name = name
@pinned = pinned
super pinned ? "#{name} is already pinned." : "#{name} is already unpinned."
end
end
class OperationInProgressError < RuntimeError
def initialize(name)
message = <<~EOS

View File

@ -500,26 +500,6 @@ class Tap
@pinned = pinned_symlink_path.directory?
end
# Pin this {Tap}.
def pin
raise TapUnavailableError, name unless installed?
raise TapPinStatusError.new(name, true) if pinned?
pinned_symlink_path.make_relative_symlink(path)
@pinned = true
end
# Unpin this {Tap}.
def unpin
raise TapUnavailableError, name unless installed?
raise TapPinStatusError.new(name, false) unless pinned?
pinned_symlink_path.delete
pinned_symlink_path.parent.rmdir_if_possible
pinned_symlink_path.parent.parent.rmdir_if_possible
@pinned = false
end
def to_hash
hash = {
"name" => name,
@ -533,7 +513,6 @@ class Tap
"cask_tokens" => cask_tokens,
"cask_files" => cask_files.map(&:to_s),
"command_files" => command_files.map(&:to_s),
"pinned" => pinned?,
}
if installed?

View File

@ -117,20 +117,6 @@ describe TapAlreadyTappedError do
its(:to_s) { is_expected.to eq("Tap foo already tapped.\n") }
end
describe TapPinStatusError do
context "pinned" do
subject { described_class.new("foo", true) }
its(:to_s) { is_expected.to eq("foo is already pinned.") }
end
context "unpinned" do
subject { described_class.new("foo", false) }
its(:to_s) { is_expected.to eq("foo is already unpinned.") }
end
end
describe BuildError do
subject { described_class.new(formula, "badprg", %w[arg1 arg2], {}) }

View File

@ -304,16 +304,6 @@ describe Tap do
(HOMEBREW_PREFIX/"share").rmtree if (HOMEBREW_PREFIX/"share").exist?
end
specify "#pin and #unpin" do
expect(subject).not_to be_pinned
expect { subject.unpin }.to raise_error(TapPinStatusError)
subject.pin
expect(subject).to be_pinned
expect { subject.pin }.to raise_error(TapPinStatusError)
subject.unpin
expect(subject).not_to be_pinned
end
specify "#config" do
setup_git_repo

View File

@ -876,7 +876,6 @@ _brew() {
switch) _brew_switch ;;
tap) _brew_tap ;;
tap-info) _brew_tap_info ;;
tap-pin) __brew_complete_tapped ;;
tap-new) _brew_tap_new ;;
tap-unpin) _brew_tap_unpin ;;
test) __brew_complete_installed ;;

View File

@ -532,14 +532,6 @@ __fish_brew_complete_arg 'tap-info; and not __fish_brew_opt --installed' -l inst
__fish_brew_complete_arg 'tap-info; and not __fish_brew_opt --json=v1' -l json=v1 -d "Format output in JSON format"
__fish_brew_complete_cmd 'tap-pin' "Prioritize tap's formulae over core"
__fish_brew_complete_arg 'tap-pin' -a '(__fish_brew_suggest_taps_installed)'
__fish_brew_complete_cmd 'tap-unpin' "Don't prioritize tap's formulae over core anymore"
__fish_brew_complete_arg 'tap-unpin' -a '(__fish_brew_suggest_taps_pinned)'
__fish_brew_complete_cmd 'uninstall' "Uninstall formula"
# FIXME: uninstall has a weird alias uninstal (with single l), probably it should also be supported
__fish_brew_complete_arg 'uninstall remove rm' -a '(__fish_brew_suggest_formulae_installed)'

View File

@ -123,8 +123,6 @@ __brew_common_commands() {
'switch:switch between different versions of a formula'
'tap:tap a new formula repository from GitHub, or list existing taps'
'tap-info:information about a tap'
'tap-pin:pin a tap'
'tap-unpin:unpin a tap'
'test-bot:test a formula and build a bottle'
'uninstall:uninstall a formula'
'unlink:unlink a formula'
@ -679,11 +677,6 @@ _brew_tap_info() {
'(--installed)*:taps:__brew_installed_taps'
}
# brew tap-pin tap:
_brew_tap_pin() {
__brew_installed_taps
}
# brew tap_readme [-v] name:
# TODO missing argument docs (verbose perhaps)
_brew_tap_readme() {
@ -692,11 +685,6 @@ _brew_tap_readme() {
':name: '
}
# brew tap-unpin tap:
_brew_tap_unpin() {
__brew_pinned_taps
}
# brew test [--devel|--HEAD] [--debug] [--keep-tmp] formulae:
_brew_test() {
_arguments \