297 Commits

Author SHA1 Message Date
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
Jack Nagel
0397d68259 Extract runtime configuration from global.rb
This allows global.rb to be safely loaded in the test environment.
2015-04-29 19:15:11 -04:00
Jack Nagel
d4c8f83381 Inline error message 2015-04-21 20:46:02 -04:00
Mike McQuaid
858f7fb529 Document Formula attributes.
The beginnings of some decent API documentation.

Also, tweak `.yardopts` to better fix our internal style.
2014-12-08 12:41:50 +00:00
Jack Nagel
2b1b7ef0e4 Ruby 1.8 doesn't have the \h regexp metacharacter 2014-07-21 17:27:37 -05:00
Jack Nagel
26b8c5a27d Improve pull request URL regexp
- use a regexp literal and avoid escaping forward slashes
 - escape the period in "github.com"
 - match only hex characters in the commit part
 - allow hyphen in usernames and repo names, matching what we allow for
   tap names
 - avoid unnecessary capture
2014-07-19 20:25:32 -05:00
Shaun Jackman
1fb1677532 Linuxbrew: Move ISSUES_URL to os from global
Closes Homebrew/linuxbrew#103

Closes Homebrew/homebrew#30830.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2014-07-12 15:39:59 -05:00
Jack Nagel
3952a4acc6 Give the cache the same permissions as the installer does 2014-07-06 22:06:09 -05:00
Jack Nagel
d5a01de8e3 Extend with a module instead of aliasing on the singleton class 2014-07-06 22:05:53 -05:00
Jack Nagel
dd3446ded1 Remove inaccurate comment 2014-07-06 21:59:58 -05:00
Jack Nagel
10a1952d2c Only "extend self" once on the Homebrew module 2014-06-19 13:10:36 -05:00
Jack Nagel
83f2ee5aea Use RbConfig.ruby if it's available 2014-06-09 21:36:36 -05:00
Jack Nagel
fcacb25cd5 Eliminate FORMULA_META_FILES constant 2014-06-07 21:15:56 -05:00
Tsukasa OMOTO
d1f15e967b Taps: cleanup regexps around Taps
Closes Homebrew/homebrew#29139.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2014-05-14 11:12:51 -05:00
Jack Nagel
d8c15c8fbf The \w character class already includes underscore
Newer versions of Ruby issue a warning for repeated character classes.
2014-05-03 15:03:22 -05:00
Tsukasa OMOTO
54004a4759 Make the on-disk representation of taps unambiguous
This commit supports "-" and "_" in names of user and repository.

Closes Homebrew/homebrew#28203.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2014-04-24 17:10:41 -05:00
Mike McQuaid
d7c13f84b6 Update string references to mxcl/homebrew. 2013-12-14 18:18:35 +00:00
Jack Nagel
c6c7b9b165 Extract HOMEBREW_TEMP constant 2013-12-14 09:35:58 -06:00
Mike McQuaid
d311fe666c Allow configuring HOMEBREW_LOGS. 2013-10-31 17:02:20 -07:00
Mike McQuaid
d9d2443d5d Cleanup use of some global constants. 2013-10-30 13:20:48 -07:00
Mike McQuaid
202c6ef826 global: add more tap regexes. 2013-10-30 11:19:46 -07:00
Jack Nagel
e67286369e Stop coercing MACOS_VERSION to a float 2013-10-25 17:29:36 -05:00
Mike McQuaid
57e541f040 global: further limit tap formula regex. 2013-10-23 12:59:42 +01:00
Mike McQuaid
98b28f5ac3 Different regex for user/tap/formula and user/tap.
Closes Homebrew/homebrew#23430.
2013-10-22 11:58:40 +01:00