Michael Ripley 1f9332611f Nil error when mirror download fails
This issue causes method in a Nil object to be read when a mirror download fails. In my case, this occurs due to my office's proxy blocking certain mirrors. This patch fixes the Nil access, exposing a more helpful error message.

## Before patch
```
$ brew install maven
Error: An exception occurred within a child process:
  NoMethodError: undefined method `unlock' for nil:NilClass
```

## After patch
```
$ brew install maven
Error: An exception occurred within a child process:
  DownloadError: Failed to download resource "maven"
Download failed: Couldn't determine mirror, try again later.
```

## Steps to reproduce
1.  Use brew 1.8.0
2.  Ensure maven is not installed:
    ```
    brew remove maven
    ```
3.  Ensure the download is not cached:
    ```
    rm "$HOME/Library/Caches/Homebrew/downloads/*--apache-maven-*-bin.tar.gz"
    ```
4.  Make the mirrors unreachable by pointing them at a nonfunctional proxy:
    ```
    export http{,s}_proxy=http://localhost:8080
    export no_proxy=*.github.com,*.brew.sh
    ```
5.  Attempt package installation
    ```
    brew install maven
    ```
2018-10-29 14:31:37 -05:00
..
2018-10-27 16:22:59 +02:00
2018-10-20 13:58:27 +01:00
2018-10-19 16:38:41 +01:00
2018-10-14 12:11:54 -07:00
2018-09-30 16:40:20 +02:00
2018-09-17 03:45:59 +02:00
2018-09-17 03:45:59 +02:00
2018-09-17 03:45:59 +02:00
2018-10-19 16:38:41 +01:00
2018-09-17 03:45:59 +02:00
2018-10-03 21:21:05 +00:00
2018-09-17 03:45:59 +02:00
2018-10-24 10:40:39 +01:00
2018-10-20 13:58:27 +01:00
2018-09-28 14:01:09 -07:00
2018-09-17 03:45:59 +02:00
2018-09-17 03:45:59 +02:00
2018-09-17 03:45:59 +02:00
2018-09-17 03:45:59 +02:00
2018-09-17 03:45:59 +02:00
2018-09-17 03:45:59 +02:00
2018-09-17 03:45:59 +02:00
2018-09-17 03:45:59 +02:00
2018-10-19 16:38:41 +01:00
2018-10-14 12:11:54 -07:00
2018-09-17 03:45:59 +02:00
2018-10-13 08:22:52 -07:00
2018-10-07 23:10:56 +02:00
2018-09-17 03:45:59 +02:00
2018-10-07 23:10:56 +02:00

Homebrew's Formula API

This is the (partially) documented public API for Homebrew.

The main class you should look at is the {Formula} class (and classes linked from there). That's the class that's used to create Homebrew formulae (i.e. package descriptions). Assume anything else you stumble upon is private.

You may also find the Formula Cookbook and Ruby Style Guide helpful in creating formulae.

Good luck!