diff options
| author | Mike McQuaid | 2017-10-22 19:48:57 +0100 |
|---|---|---|
| committer | GitHub | 2017-10-22 19:48:57 +0100 |
| commit | 357b7bb0b72f5f3e2747ffffdad76d694f73b626 (patch) | |
| tree | 42baa7002b2333063efa22fcbed18001b2593248 | |
| parent | a1ff34dfad792590c621a8ea2216658a07e967c7 (diff) | |
| parent | 1b084b5aa021d5399f4bc560ccab715766f09c16 (diff) | |
| download | brew-357b7bb0b72f5f3e2747ffffdad76d694f73b626.tar.bz2 | |
Merge pull request #3350 from DomT4/gpg_executable
gpg: a little intentional yak shaving
| -rw-r--r-- | Library/Homebrew/gpg.rb | 16 | ||||
| -rw-r--r-- | Library/Homebrew/requirements/gpg2_requirement.rb | 2 |
2 files changed, 6 insertions, 12 deletions
diff --git a/Library/Homebrew/gpg.rb b/Library/Homebrew/gpg.rb index ec4e62450..83b525b44 100644 --- a/Library/Homebrew/gpg.rb +++ b/Library/Homebrew/gpg.rb @@ -11,18 +11,12 @@ class Gpg end end - def self.gpg - find_gpg("gpg") + def self.executable + find_gpg("gpg") || find_gpg("gpg2") end - def self.gpg2 - find_gpg("gpg2") - end - - GPG_EXECUTABLE = gpg || gpg2 - def self.available? - File.executable?(GPG_EXECUTABLE.to_s) + File.executable?(executable.to_s) end def self.version @@ -43,12 +37,12 @@ class Gpg %no-protection %commit EOS - system GPG_EXECUTABLE, "--batch", "--gen-key", "batch.gpg" + system executable, "--batch", "--gen-key", "batch.gpg" end def self.cleanup_test_processes! odie "No GPG present to test against!" unless available? - gpgconf = Pathname.new(GPG_EXECUTABLE).parent/"gpgconf" + gpgconf = Pathname.new(executable).parent/"gpgconf" system gpgconf, "--kill", "gpg-agent" system gpgconf, "--homedir", "keyrings/live", "--kill", diff --git a/Library/Homebrew/requirements/gpg2_requirement.rb b/Library/Homebrew/requirements/gpg2_requirement.rb index ebdd71f6e..04097f9be 100644 --- a/Library/Homebrew/requirements/gpg2_requirement.rb +++ b/Library/Homebrew/requirements/gpg2_requirement.rb @@ -8,5 +8,5 @@ class GPG2Requirement < Requirement # GPGTools installs GnuPG 2.0.x as a `gpg` symlink pointing # to `gpg2`. Our `gnupg` installs only a non-symlink `gpg`. # The aim is to retain support for any version above 2.0. - satisfy(build_env: false) { Gpg.gpg || Gpg.gpg2 } + satisfy(build_env: false) { Gpg.available? } end |
