Merge pull request #3350 from DomT4/gpg_executable

gpg: a little intentional yak shaving
This commit is contained in:
Mike McQuaid 2017-10-22 19:48:57 +01:00 committed by GitHub
commit 357b7bb0b7
2 changed files with 6 additions and 12 deletions

View File

@ -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",

View File

@ -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