561 Commits

Author SHA1 Message Date
Markus Reiter
8b26e380a2 Refactor and document Svn. 2020-08-23 06:33:58 +02:00
Bo Anderson
1c41127005 download_strategy: require lock_file 2020-08-21 20:31:43 +01:00
Mike McQuaid
3a91c37e66
Fix RuboCop checks. 2020-08-19 17:12:32 +01:00
Mike McQuaid
a0fd62fddd
Merge pull request #8307 from Bo98/svn-date
download_strategy: more direct SVN modified date detection
2020-08-12 10:51:53 +01:00
Bo Anderson
d7864d7efb download_strategy: more direct SVN modified date detection 2020-08-11 21:01:53 +01:00
Markus Reiter
a19a0917b1 Reinstate #shutup!. 2020-08-11 20:18:30 +02:00
Markus Reiter
490e503b1b Replace Homebrew.args with Context. 2020-08-06 16:13:14 +02:00
Mike McQuaid
f951ea83d4
Fix brew style. 2020-07-07 12:23:29 +01:00
Mike McQuaid
dd50714d1e
Fix RuboCop failures. 2020-06-22 14:09:33 +01:00
Issy Long
0041ea21f5
Change occurrences of "whitelist" to "allowlist" 2020-06-06 22:38:32 +01:00
Mike McQuaid
aa81982aba
brew style --fix 2020-06-02 09:49:23 +01:00
Mike McQuaid
12bdb38663
rubocop: brew style --fix autocorrections. 2020-05-12 08:32:27 +01:00
Markus Reiter
7ef9ea0880 Delete trailing ; in Content-Disposition header. 2020-04-14 04:54:52 +02:00
Mike McQuaid
3381cbf5c7
Use Homebrew::EnvConfig. 2020-04-07 09:58:26 +01:00
Dawid Dziurla
37dcbbaf65
download_strategy: unlink the lock file after unlocking it 2020-04-06 09:56:56 +02:00
Chris Tompkinson
4bfed9cdb0 flatten before compact 2020-04-01 15:46:28 +01:00
Chris Tompkinson
931e379fec remove extra space 2020-03-26 10:40:21 +00:00
Chris Tompkinson
90488ed848 rerun tests due to failure 2020-03-26 10:40:04 +00:00
Chris Tompkinson
6d5e37654e
Update Library/Homebrew/download_strategy.rb
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
2020-03-18 14:29:36 +00:00
Chris Tompkinson
0f10d7ba40 use even more concise method for header and headers 2020-03-17 14:32:50 +00:00
Chris Tompkinson
278bba0523 Use concise method for both header and headers 2020-03-12 11:32:47 +00:00
Chris Tompkinson
38da4dcac0 Add headers option to URLs in forumlas 2020-03-10 10:16:25 +00:00
Gautham Goli
acde828a45 ARGV: Replace ARGV.verbose? with Homebrew.args.verbose? 2020-02-02 14:00:04 +01:00
Mike McQuaid
dccedbf104
download_strategy: use (more consistent) TypeError.
Rather than a base `RuntimeError`.

Fixes https://github.com/Homebrew/brew/issues/6839
2019-12-16 11:34:31 +00:00
Nathan
5400883bd9 Upped the timeout for curl to 15 seconds 2019-11-16 10:16:00 -06:00
Issy Long
1f6168fe8a
Change regexp.match?(string) to string.match?(regexp) everywhere
- Only try to call `.match?` on strings that aren't nil.
2019-10-13 23:22:51 +01:00
Issy Long
b78028b9c2
Auto-fix Performance/RegexpMatch offenses 2019-10-13 16:04:26 +01:00
沙漠之子
52511d3f77
Modify curl's header option -H to --header 2019-10-07 18:56:03 +08:00
沙漠之子
e1a592c76c
Adding the header option to CurlDownloadStrategy.
It's easy to access github private resources later through specific `header` settings.
e.g.
```
cask 'XXXX' do
...
  url "https://raw.githubusercontent.com/....",
      header : "Authorization: token #{ENV['HOMEBREW_GITHUB_API_TOKEN']}"
...
end
 ```
2019-10-07 16:19:33 +08:00
Melvyn Depeyrot
cf040149c4
Respect ARGV.verbose
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
2019-10-02 07:03:13 -07:00
Melvyn Depeyrot
554aca9522
Quiet SVN output 2019-10-01 17:25:52 -07:00
Markus Reiter
ff7c9ef1b9 Add fallback for out-of-spec Last-Modified header. 2019-08-20 03:18:12 +02:00
Mike McQuaid
dca43851af
download_strategy: fix brew style, refactor. 2019-07-16 21:10:36 +01:00
Markus Reiter
0a0672fade Don't URL-encode cookies. 2019-05-31 23:39:59 +02:00
Markus Reiter
b12623f4eb Don't redownload “latest” casks unnecessarily. 2019-05-31 20:50:31 +02:00
Joe George
2d89e48bbc
Fix #6188
Add trailing -- to git reset when performing a branch reset to remove
ambiguity between revision and file
2019-05-31 08:58:17 -04:00
Mike McQuaid
c4f72312ce
Fixup brew style failures. 2019-04-30 09:19:18 +01:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Markus Reiter
4576fb0a68 Force GET for head requests. 2019-04-03 12:08:15 +02:00
Mike McQuaid
20e4262fb9
unpack_strategy: prioritise extension instead.
Instead of only looking at the extension when invoked as part of
Homebrew's formulae' download strategies instead prioritise the
extension if it actually exists. When it does not, fall back to the
magic detection logic which is likely to be more reliable.

Fixes https://github.com/Homebrew/brew/issues/5895
2019-04-03 10:32:29 +01:00
Mike McQuaid
d64429a736
rubocop: enable Style/IfUnlessModifier. 2019-02-21 12:55:49 +00:00
Mike McQuaid
0c44498581
download_strategy: more robust filename content encoding handling.
Fixes #5713.
2019-02-13 13:29:37 +00:00
Markus Reiter
de5b35876f Use Mechanize to parse Content-Disposition. 2019-01-30 04:15:34 +01:00
Kevin Abel
8fddd87472
Resource, CurlDownloadStrategy: Deduplicate the curl HEAD requests
Fixes #5357

* Eliminates getting a new strategy instance via Resource methods
* only call resolve_url_basename_time once and store the time result as
an instance variable for reuse
2018-12-16 13:56:58 -06:00
Chongyu Zhu
6f8d81e780
GitDownloadStrategy: disable automatic tag following 2018-12-12 19:42:12 +08:00
EricFromCanada
5e2f87f7ac CurlDownloadStrategy: handle Location indicating the current dir.
If a response contains a Location header starting with `./`, substitute just final component of the URL path with the given filename.
2018-11-22 19:24:30 -05:00
Markus Reiter
eddbab6a1c
Merge pull request #5217 from reitermarkus/download-time
Check if cached downloads are up-to-date.
2018-11-04 18:06:30 +01:00
Mike McQuaid
737b84b54b
brew style --fix fixes. 2018-11-02 17:29:23 +00:00
Markus Reiter
3d805295eb Check if cached downloads are up-to-date. 2018-11-01 20:29:18 +01:00
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