diff options
| author | Mike McQuaid | 2016-07-09 13:51:19 +0100 | 
|---|---|---|
| committer | GitHub | 2016-07-09 13:51:19 +0100 | 
| commit | 4da990587f723a563e602a665403393f67fc8e70 (patch) | |
| tree | 18d76344dd5fed749d0f49a0882dc2fc9c3f660a /Library/Homebrew/tap.rb | |
| parent | 4f2e31b3e3ef3ab4758e3ac3c22dafd190652d5d (diff) | |
| download | brew-4da990587f723a563e602a665403393f67fc8e70.tar.bz2 | |
tap: run readall when tapping. (#396)
* readall: move readall logic to new class.
* tap: run readall when tapping.
This will prevent tapping an tap with syntax errors from causing issues
for users.
Fixes #58.
Diffstat (limited to 'Library/Homebrew/tap.rb')
| -rw-r--r-- | Library/Homebrew/tap.rb | 10 | 
1 files changed, 8 insertions, 2 deletions
diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 0b10f20c0..3dda1cab8 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -1,4 +1,5 @@  require "extend/string" +require "readall"  # a {Tap} is used to extend the formulae provided by Homebrew core.  # Usually, it's synced with a remote git repository. And it's likely @@ -211,9 +212,14 @@ class Tap      begin        safe_system "git", *args -    rescue Interrupt, ErrorDuringExecution +      unless Readall.valid_tap?(self, :aliases => true) +        raise "Cannot tap #{name}: invalid syntax in tap!" +      end +    rescue Interrupt, ErrorDuringExecution, RuntimeError        ignore_interrupts do -        sleep 0.1 # wait for git to cleanup the top directory when interrupt happens. +        # wait for git to possibly cleanup the top directory when interrupt happens. +        sleep 0.1 +        FileUtils.rm_rf path          path.parent.rmdir_if_possible        end        raise  | 
