diff options
| author | Markus Reiter | 2017-12-01 23:59:04 +0100 | 
|---|---|---|
| committer | Markus Reiter | 2017-12-02 00:10:55 +0100 | 
| commit | 96733bcb2e6836c55bb2e3fea4324c5f38061355 (patch) | |
| tree | 3c3a8a91e34de19a7f5243b25f46ee5425a6705a /Library/Homebrew/cask/lib | |
| parent | 76c64f9bbf54c9f3b6915469f170d1f8c02be208 (diff) | |
| download | brew-96733bcb2e6836c55bb2e3fea4324c5f38061355.tar.bz2 | |
Support environment filtering in Casks.
Diffstat (limited to 'Library/Homebrew/cask/lib')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/container/cab.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/container/generic_unar.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/container/gpg.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/container/lzma.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/container/xz.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/system_command.rb | 4 | 
7 files changed, 14 insertions, 10 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index e2deb6f67..7197303a8 100644 --- a/Library/Homebrew/cask/lib/hbc/cli.rb +++ b/Library/Homebrew/cask/lib/hbc/cli.rb @@ -96,7 +96,7 @@ module Hbc        if command.respond_to?(:run)          # usual case: built-in command verb          command.run(*args) -      elsif require?(which("brewcask-#{command}.rb")) +      elsif require?(which("brewcask-#{command}.rb"), ENV["HOMEBREW_PATH"])          # external command as Ruby library on PATH, Homebrew-style        elsif command.to_s.include?("/") && require?(command.to_s)          # external command as Ruby library with literal path, useful diff --git a/Library/Homebrew/cask/lib/hbc/container/cab.rb b/Library/Homebrew/cask/lib/hbc/container/cab.rb index 010fccbc4..327aece6e 100644 --- a/Library/Homebrew/cask/lib/hbc/container/cab.rb +++ b/Library/Homebrew/cask/lib/hbc/container/cab.rb @@ -10,7 +10,7 @@ module Hbc        end        def extract -        if (cabextract = which("cabextract")).nil? +        unless cabextract = which("cabextract", PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin"))            raise CaskError, "Expected to find cabextract executable. Cask '#{@cask}' must add: depends_on formula: 'cabextract'"          end diff --git a/Library/Homebrew/cask/lib/hbc/container/generic_unar.rb b/Library/Homebrew/cask/lib/hbc/container/generic_unar.rb index 7a465e12e..63ab917ea 100644 --- a/Library/Homebrew/cask/lib/hbc/container/generic_unar.rb +++ b/Library/Homebrew/cask/lib/hbc/container/generic_unar.rb @@ -6,14 +6,14 @@ module Hbc    class Container      class GenericUnar < Base        def self.me?(criteria) -        !(lsar = which("lsar")).nil? && -          criteria.command.run(lsar, -                               args:         ["-l", "-t", "--", criteria.path], -                               print_stderr: false).stdout.chomp.end_with?("passed, 0 failed.") +        return false unless lsar = which("lsar", PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin")) +        criteria.command.run(lsar, +                             args:         ["-l", "-t", "--", criteria.path], +                             print_stderr: false).stdout.chomp.end_with?("passed, 0 failed.")        end        def extract -        if (unar = which("unar")).nil? +        unless unar = which("unar", PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin"))            raise CaskError, "Expected to find unar executable. Cask #{@cask} must add: depends_on formula: 'unar'"          end diff --git a/Library/Homebrew/cask/lib/hbc/container/gpg.rb b/Library/Homebrew/cask/lib/hbc/container/gpg.rb index 3f37b5aa6..09c75468a 100644 --- a/Library/Homebrew/cask/lib/hbc/container/gpg.rb +++ b/Library/Homebrew/cask/lib/hbc/container/gpg.rb @@ -24,7 +24,7 @@ module Hbc        end        def extract -        if (gpg = which("gpg")).nil? +        unless gpg = which("gpg", PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin"))            raise CaskError, "Expected to find gpg executable. Cask '#{@cask}' must add: depends_on formula: 'gpg'"          end diff --git a/Library/Homebrew/cask/lib/hbc/container/lzma.rb b/Library/Homebrew/cask/lib/hbc/container/lzma.rb index 1221acfbc..1e165ba2a 100644 --- a/Library/Homebrew/cask/lib/hbc/container/lzma.rb +++ b/Library/Homebrew/cask/lib/hbc/container/lzma.rb @@ -10,7 +10,7 @@ module Hbc        end        def extract -        if (unlzma = which("unlzma")).nil? +        unless unlzma = which("unlzma", PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin"))            raise CaskError, "Expected to find unlzma executable. Cask '#{@cask}' must add: depends_on formula: 'lzma'"          end diff --git a/Library/Homebrew/cask/lib/hbc/container/xz.rb b/Library/Homebrew/cask/lib/hbc/container/xz.rb index cd9f9aee2..4086ae188 100644 --- a/Library/Homebrew/cask/lib/hbc/container/xz.rb +++ b/Library/Homebrew/cask/lib/hbc/container/xz.rb @@ -10,7 +10,7 @@ module Hbc        end        def extract -        if (unxz = which("unxz")).nil? +        unless unxz = which("unxz", PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin"))            raise CaskError, "Expected to find unxz executable. Cask '#{@cask}' must add: depends_on formula: 'xz'"          end diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb index 86e4d2268..a890c42e4 100644 --- a/Library/Homebrew/cask/lib/hbc/system_command.rb +++ b/Library/Homebrew/cask/lib/hbc/system_command.rb @@ -83,6 +83,10 @@ module Hbc      def each_output_line(&b)        executable, *args = expanded_command +      unless File.exist?(executable) +        executable = which(executable, PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin")) +      end +        raw_stdin, raw_stdout, raw_stderr, raw_wait_thr =          Open3.popen3([executable, executable], *args, **options)  | 
