aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominyk Tiller2017-10-22 02:48:38 +0100
committerDominyk Tiller2017-10-22 05:11:25 +0100
commitdad939c4d1beb3b00d6b477c6b1d1725dafdd29c (patch)
tree354f02ffc78ba1deaf4ee443b549486dd5cca47b
parentce0e96c3205e10fe975b8c107092c290b9373af9 (diff)
downloadbrew-dad939c4d1beb3b00d6b477c6b1d1725dafdd29c.tar.bz2
gpg: make executable a function, not a constant
It's a lot nicer to call `Gpg.executable` rather than `Gpg::GPG_EXECUTABLE` externally. Also squash some logic.
-rw-r--r--Library/Homebrew/gpg.rb16
1 files changed, 5 insertions, 11 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",