diff options
| author | Dominyk Tiller | 2016-08-10 20:53:58 +0100 |
|---|---|---|
| committer | Dominyk Tiller | 2016-08-13 03:33:33 +0100 |
| commit | e62fc26b9ce05aee374cc7e32ca37ba8bb46d36e (patch) | |
| tree | 5da81861c21de7b6df1fa0c6e6a19d195d66f2da /Library | |
| parent | 15916338888e48e70edc4ade7f0aff94e3607e76 (diff) | |
| download | brew-e62fc26b9ce05aee374cc7e32ca37ba8bb46d36e.tar.bz2 | |
gpg_requirement: centralise logic in Gpg class
Removes the detection logic from the Requirement in favour of it living inside
the Gpg class & us calling it from there. It's a bit nicer & avoids us calling
Requirement code from outside of direct requirement handling & fulfillment.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/requirements/gpg_requirement.rb | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/Library/Homebrew/requirements/gpg_requirement.rb b/Library/Homebrew/requirements/gpg_requirement.rb index ef33a4fc5..bb41f0b0b 100644 --- a/Library/Homebrew/requirements/gpg_requirement.rb +++ b/Library/Homebrew/requirements/gpg_requirement.rb @@ -1,27 +1,12 @@ require "requirement" +require "gpg" class GPGRequirement < Requirement fatal true default_formula "gnupg2" - satisfy(:build_env => false) { gpg2 || gpg } - # MacGPG2/GPGTools installs GnuPG 2.0.x as a vanilla `gpg` symlink # pointing to `gpg2`, as do we. Ensure we're actually using a 2.0 `gpg`. # Temporarily, only support 2.0.x rather than the 2.1.x "modern" series. - def gpg - which_all("gpg").detect do |gpg| - gpg_short_version = Utils.popen_read(gpg, "--version")[/\d\.\d/, 0] - next unless gpg_short_version - Version.create(gpg_short_version.to_s) == Version.create("2.0") - end - end - - def gpg2 - which_all("gpg2").detect do |gpg2| - gpg2_short_version = Utils.popen_read(gpg2, "--version")[/\d\.\d/, 0] - next unless gpg2_short_version - Version.create(gpg2_short_version.to_s) == Version.create("2.0") - end - end + satisfy(:build_env => false) { Gpg.gpg2 || Gpg.gpg } end |
