170 Commits

Author SHA1 Message Date
Mike McQuaid
facd76bc51 portable-ruby: respect HOMEBREW_BOTTLE_DOMAIN variable.
This was requested in:
https://discourse.brew.sh/t/adding-additional-download-sources-to-homebrew/2446

With this change you can use e.g. Artifactory for Homebrew's portable
ruby.
2018-06-29 19:51:18 +01:00
Markus Reiter
c53a52daee Move --version logic into cmd/--version.rb. 2018-05-21 05:35:44 +02:00
Gautham Goli
d22b750e17 Store common switch as Homebrew.args global var 2018-04-10 00:00:35 +05:30
Mike McQuaid
9fca172d03 Fix HOMEBREW_RUBY_WARNINGS="-w"
Fix various circular requirements, method redefinitions, etc.
2018-04-07 20:28:56 +01:00
Gautham Goli
d45ff9c0fd audit: Add a global flag to silent warning when auditing 2017-09-04 23:57:09 +05:30
Markus Reiter
3b4ee58c49 Refactor using Forwardable and DelegateClass. 2017-06-28 09:25:31 +02:00
Mike McQuaid
021cef4b2b Autocorrect Rubocop Style/SpecialGlobalVars. 2017-06-12 09:11:42 +01:00
Markus Reiter
22f624b373 Make PATH enumerable. 2017-04-30 21:11:28 +02:00
Markus Reiter
f8ad9d7efd Use PATH where possible. 2017-04-30 21:11:27 +02:00
Markus Reiter
a16746906d Add PATH class. 2017-04-30 21:11:27 +02:00
Mike McQuaid
6b0afa3e9c Remove puts_hash, require pp
I wasn’t aware this existed when I created puts_hash so: may as well
remove it.
2017-04-24 11:45:32 +01:00
Mike McQuaid
45a7730f61 Fix and remove various TODOs.
Fix those that can be done so without tearing Homebrew to pieces and
remove the comments for those that can never be done.
2017-04-23 15:10:18 +01:00
Mike McQuaid
e7e53b89fc global: set HOMEBREW_PATH if unset. 2017-04-23 11:40:53 +01:00
Mike McQuaid
d02b4f321d Hide sensitive tokens from install/test/post.
Hide these tokens to avoid malicious subprocesses e.g. sending them
over the network. Also, support using these tokens with environment
filtering and clear `HOMEBREW_PATH` from subprocesses to stop them
sniffing it. Finally, use `HOMEBREW_PATH` to detect Homebrew’s user’s
PATH for e.g. `brew doctor` etc.
2017-04-22 16:31:19 +01:00
ilovezfs
a81bd81a14 brew uninstal alias for brew uninstall
If `brew instal` is permissible, `brew uninstal` should be, too.
2017-02-21 04:37:46 -08:00
Mike McQuaid
9344174379 Use HTTPS for the homepage. 2017-02-12 13:58:07 +00:00
Mike McQuaid
34e03532a0 audit: improve homepage audit reliability.
Try first with an (exact, actual) browser user agent from Safari and
then try again with the default Homebrew `curl` user agent.
2017-01-26 16:19:38 +00:00
Mike McQuaid
e7a81caaf4 Allow brew audit to fake a Safari user-agent.
This allows us to detect if homepages such as e.g. `aiccu` which
blocks `curl` are up or not.
2017-01-07 14:03:08 +00:00
Mike McQuaid
e6fb3c3114 curl: make curl_args more configurable.
Allow configuring whether output should be shown or the default the
default user agent is used.
2016-12-29 12:51:12 +00:00
Markus Reiter
6c1d42386d Remove flat_map compatibility layer. 2016-11-14 09:45:44 +01:00
Markus Reiter
0ab750bf24 Use module_function for commands. 2016-10-02 00:24:47 +02:00
Markus Reiter
e851c9bf6c Style/Alias: Prefer alias. 2016-09-23 18:19:53 +02:00
Mike McQuaid
1bdbb0f462 Improve rescue nesting. 2016-09-17 17:01:04 +01:00
Mike McQuaid
6693915399 rubocop --auto-correct all remaining files.
But remove some manual `.freeze`s on constants that shouldn't be
constants.
2016-09-17 16:14:13 +01:00
Mike McQuaid
e3609b6fd4 Move LinkedKegs/PinnedKegs/Locks from Library.
These don't make sense to be tied to the `HOMEBREW_REPOSITORY` but
instead should live in the `HOMEBREW_PREFIX` as they all relate to its
state.
2016-09-16 13:51:56 +01:00
Mike McQuaid
72d10fff0b Use constants for LinkedKegs/PinnedKegs/Locks.
These definitions are scattered throughout the codebase which makes it
hard to refactor them later (my goal is to move them outside of
HOMEBREW_LIBRARY). Unify their definitions for clearer code and easier
movement later.
2016-09-15 18:28:42 +01:00
Xu Cheng
e423617d77
remove ruby 1.8 compatible codes 2016-08-18 14:35:39 +08:00
Mike McQuaid
179ef2bf8c global: raise unless Ruby 2. 2016-08-17 09:19:56 +01:00
Mike McQuaid
e091e74c0c global: add Homebrew.raise_deprecation_exceptions 2016-08-12 21:06:00 +01:00
Mike McQuaid
23306ab434 github: produce better curl error messages. (#441)
* global: add RUBY_TWO global variable.

* test-bot: use RUBY_TWO global variable.

* github: produce better curl error messages.

If we don't know why curl has failed then ensure that the error messages
that it produced are included as part of the user output.
2016-07-12 19:46:29 +01:00
Martin Afanasjew
77dd9d56ff Use GitRepositoryExtension for HOMEBREW_REPOSITORY 2016-07-07 01:46:58 +02:00
Martin Afanasjew
6cdc6b1460 Add GitRepositoryExtension
Add an extension for accessing Git-related meta data that can be mixed
in into a Pathname object (e.g. `HOMBREW_REPOSITORY` or the path of a
`Tap` instance). The goal here is to eliminate code duplication.
2016-07-07 01:46:58 +02:00
Mike McQuaid
bf42959609 Revert "Revert "Test officially supported cmd taps. (#390)""
This reverts commit dba1958bd79c1c9d18f215dfc2b806ea62edd1c8.
2016-07-04 17:05:37 +01:00
Martin Afanasjew
dba1958bd7 Revert "Test officially supported cmd taps. (#390)"
This reverts commit 252c701c59227c385ef6178fe99523cca8c843bb.

Taps installed prior to running the test suite are not visible to the
test suite as most Homebrew paths are redefined as to not mess up the
local installation.
2016-07-04 17:41:14 +02:00
Mike McQuaid
252c701c59 Test officially supported cmd taps. (#390)
All of these taps use Homebrew internal APIs (or will shortly) and we
autoinstall them all from `brew $CMD`. We should adjust our CI to ensure
that we never accidentally break these taps when making changes to core
code so that these taps can rely more on this core code rather than
having to e.g. vendor equivalent code that never changes on our end.
2016-07-04 16:08:53 +01:00
Mike McQuaid
8e0e1642ad Use curl for the GitHub API (#295)
* Move GitHub API module to utils/github.rb.

* Move curl method to utils/curl.rb.

* global: use long curl arguments and an array.

This makes the code more self-documenting.

* utils/curl: support reading curl's output.

* utils/github: use curl instead of open-uri.

It has far better proxy support.

* pull: set Homebrew user agent.

* gist-logs: remove trailing whitespace.

* gist-logs: use first instead of [0].

Easier to read.

* gist-logs: use curl-based GitHub.open method.
2016-06-03 13:05:18 +01:00
Xu Cheng
41325bcfa0 HOMEBREW_CURL_ARGS: add -R to preserve remote timestamp
Reference from `man curl`

>  -R, --remote-time
>    When  used,  this will make curl attempt to figure out the time-
>    stamp of the remote file, and if  that  is  available  make  the
>    local file get that same timestamp.
2016-05-26 22:13:50 +08:00
Mike McQuaid
0c85113053 Homebrew (opt-in) Analytics tweaks. (#57)
- add `HOMEBREW_PRODUCT` global variable
- only differentiate between `/usr/local` and `non-/usr/local` Homebrew
  prefixes to avoid sharing sensitive user information
- note if e.g. build errors are occurring under CI
- Add `HOMEBREW_NO_ANALYTICS` variable (this will be how people opt-out
  when this is enabled for everyone)
- Add `HOMEBREW_ANALYTICS_DEBUG` variable to output all the analytics
  that are sent
- Move Bash analytics code to `Library/Homebrew/utils/analytics.sh`
- Add documentation for our analytics and why/what/when/how and opt-out
- Only official Homebrew commands are reported
- Ruby analytics are now reported in a forked, background process
2016-04-12 11:02:22 +01:00
Mike McQuaid
77611bafb1 Make Homebrew user agent consistent, use a slash.
Generally it seems user agents are all `software/version` but ours is
not. Also, set the user agent in a way that it's shared between Bash
and Ruby code.

Closes https://github.com/Homebrew/legacy-homebrew/pull/50480.
2016-04-04 12:18:21 +01:00
Xu Cheng
5bb8e8985d audit/test-bot/pull: fix for core/formula separation
All formulae are in taps now.
2016-04-02 21:51:36 +08:00
Mike McQuaid
2c3a7e8c75 Fix brew update user agent.
This needs to be `Homebrew $HOMEBREW_VERSION` so we can be adequately
filtered.

Closes Homebrew/homebrew#49961.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-03-11 13:32:54 +08:00
Mike McQuaid
041c8502c5 Set HOMEBREW_API_TOKEN from Git when available.
As requested in Homebrew/homebrew#46578. Falls back to existing functionality.

Closes Homebrew/homebrew#46578.

Closes Homebrew/homebrew#49846.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-03-08 20:52:11 +08:00
Mike McQuaid
f6cbf7bab0 Move internal command aliases from Ruby to Bash.
This means that internal command aliases can be used for Bash commands
(such as the new, Bash-based `brew update`).

Fixes Homebrew/homebrew#49182.

Closes Homebrew/homebrew#49184.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-15 11:35:25 +00:00
Xu Cheng
3cc101ec5e pull: use tap object
Fix the regression introduced by Homebrew/homebrew#46735.
2015-12-13 01:29:52 +08:00
Baptiste Fontaine
abfaa59e06 MacOS: full_version added
Closes Homebrew/homebrew#44988.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-10-18 22:57:42 +08:00
Xu Cheng
7c72b0c68a backport flat_map for Ruby 1.8
Code is copied from
https://github.com/marcandre/backports/blob/master/lib/backports/1.9.2/enumerable/flat_map.rb
(MIT License by Marc-Andre Lafortune)

Closes Homebrew/homebrew#42543.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-08-06 22:33:46 +08:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Xu Cheng
78a7dea3a0 add brew command
Closes Homebrew/homebrew#41034.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-07-03 14:22:38 +08:00
Jack Nagel
ec1727a1be Remove backports for Ruby 1.8.6
refs. Homebrew/linuxbrew#438, mistydemeo/tigerbrew#327,
mistydemeo/tigerbrew#334
2015-06-19 22:20:47 -04:00
Jack Nagel
f4027cc9ac "Mac OS X" -> "OS X" in copy 2015-06-16 20:02:10 -04:00