560 Commits

Author SHA1 Message Date
Mike McQuaid
f0e9292acd Use git describe to get the HOMEBREW_VERSION.
For tagged commits produces the output:
- `1.0.1`

For untagged commits with a dirty tree produces the output:
- `1.0.1-19-g23efbc5-dirty`

Performance:
```
git describe --tags --dirty 2> /dev/null
0.07s user 0.01s system 96% cpu 0.086 total
```

This means we can tag any commit without needing to manually remember
to bump the revision every time.
2016-09-22 08:56:40 +01:00
Mike McQuaid
0d76dfadcc utils: fix completions/manpages/docs linking. 2016-09-20 10:41:42 +01:00
Alyssa Ross
4c773725c7 Use user GEM_HOME for installing gems
Save the value of GEM_HOME before unsetting it,
and resetting it when setting up a gem environment.

Fixes #944.
2016-09-19 19:09:55 +01:00
Mike McQuaid
569dbf4d05 utils: skip migration of broken formulae symlinks.
Closes https://github.com/Homebrew/homebrew-core/issues/4973
2016-09-19 10:40:18 +01:00
Mike McQuaid
59b7f16bfd Merge pull request #989 from MikeMcQuaid/rubocop-final
Rubocop: apply auto-corrections and don't use hash-rockets
2016-09-18 13:28:15 +01:00
Zhiming Wang
58b17a0cfc
utils: convert formula name from pathname to string
`name` is passed as argument to Formulary.factory which could later be
downcased at formulary.rb:349, but Pathname doesn't have a downcase
method. Converting `name` to String as it should be fixes the problem.

Fixes #1000.
2016-09-17 23:55:28 -04:00
Mike McQuaid
295e937f27 utils: create missing kegs directories if needed. 2016-09-17 19:23:42 +01:00
Mike McQuaid
eb23a39701 utils: remove bad symlink if it already exists. 2016-09-17 19:02:36 +01:00
Mike McQuaid
241d7b991b Improve legacy symlink migration.
Read the old symlinks and migrate them across rather than assuming a
unlink/link will work fine (as users have conflicts.)
2016-09-17 18:50:25 +01:00
Mike McQuaid
3982950e61 rubocop --auto-correct all hash-rocket usage. 2016-09-17 16:14:13 +01:00
Mike McQuaid
8f1ae3b28b Move LinkedKegs migration.
Move the `LinkedKegs` migration into `utils.rb` so it can also be called
from `brew.rb` on startup.
2016-09-17 15:00:46 +01:00
Mike McQuaid
9ee4426cf9 utils: link_src_dst_dirs: paths not files.
This can ask for you to remove directories (e.g.
`/usr/local/share/homebrew`) so don’t call this files to avoid
confusion.
2016-09-15 09:19:36 +01:00
Mike McQuaid
56b6c43686 utils: fix Rubocop warnings. 2016-09-11 19:12:59 +01:00
Mike McQuaid
1160d0e347 update-report: also link docs, completions.
These are more files in the HOMEBREW_REPOSITORY that we want to link to
the HOMEBREW_PREFIX.
2016-09-06 09:04:51 +01:00
Mike McQuaid
3ebc5a88e8 utils: split link_path_manpages method.
Pull more logic into the more generic `link_src_dst_dirs` to be used to
do more linkage.
2016-09-06 09:04:51 +01:00
Mike McQuaid
dfcbefff73 Merge pull request #201 from gregory-nisbet/feature-env-shells
--env: support more shells, allow explicit shell selection
2016-09-04 21:23:33 +01:00
Mike McQuaid
283706e72a utils: fix link_path_manpages message indentation.
Otherwise looks weird with multiple items.
2016-09-01 20:53:25 +01:00
Markus Reiter
db88ca1e18 Fix missing magenta in Tty. 2016-08-26 14:14:18 +02:00
Mike McQuaid
8cc027a3cd utils: add link_path_manpages method. 2016-08-24 11:06:58 +01:00
Xu Cheng
e423617d77
remove ruby 1.8 compatible codes 2016-08-18 14:35:39 +08:00
Mike McQuaid
aa435825d2 Merge pull request #702 from MikeMcQuaid/silence-audit-revisions
Silence auditing formula revisions deprecations
2016-08-14 10:00:13 +01:00
Shaun Jackman
2b847959f0 oh1: Add a truncate option 2016-08-12 20:54:18 -04:00
Mike McQuaid
c56625f8b7 utils: check raise deprecation exceptions value. 2016-08-12 21:06:41 +01:00
Greg Nisbet
dcc3377aa3 move shell_profile to compat/utils.rb & deprecate 2016-08-10 23:21:30 -07:00
Dominyk Tiller
de4016e049
utils: add with_custom_locale helper 2016-08-02 03:50:49 +01:00
Mike McQuaid
7a00f03c92 utils: tell people to report deprecations to tap.
This should hopefully avoid Homebrew/brew or Homebrew/homebrew-core
having these exceptions reported to us.
2016-07-31 19:22:12 +01:00
Martin Afanasjew
1244aa6ece utils: fix option handling in 'odisabled'
Options passed to `odisabled` were completely ignored. Instead, merge
them with the defaults that distinguish `odisabled` from `odeprecated`.
2016-07-30 14:59:16 +02:00
Martin Afanasjew
0a33cc591d utils: provide a better location in 'odeprecated'
Try to find a formula in the backtrace to make the warning message more
helpful in identifying the culprit, as the formula is not always the
immediate caller of a deprecated method. Provide some sane fallbacks if
there's not formula in the call stack.
2016-07-30 14:51:14 +02:00
Mike McQuaid
10ddb2ed97 utils: add API removal messaging methods.
Add new `odeprecated` and `odisabled` methods to print API removal
messages. Currently these are just used by things in `compat/`.
2016-07-29 21:21:29 -06:00
Mike McQuaid
a5ec0aa259 emoji: extract logic into generic OS classes. (#450) 2016-07-09 13:51:43 +01:00
Martin Afanasjew
77dd9d56ff Use GitRepositoryExtension for HOMEBREW_REPOSITORY 2016-07-07 01:46:58 +02:00
Andrew Janke
f518f57bd8 gist-logs: truncate log files to be gist-friendly (#279)
Truncates each log file to about 1 MB. This avoids upload and
download errors with the gists, and respects GitHub's suggested
size limits.
2016-07-05 08:45:17 -04:00
Mike McQuaid
883b201c09 utils: output what files edit is opening. (#444)
Since we've moved all formulae to taps it's not necessarily obvious
what the path for the files are otherwise.
2016-07-04 16:09:24 +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
Mike McQuaid
7829af7508 bottle/test-bot: deep merge bottle JSON hashes. 2016-05-28 20:11:07 +01:00
Martin Afanasjew
e517e2e41d utils: avoid using 'gem' as an identifier (#278)
Avoid breaking code highlighting of some editors (e.g. Sublime Text)
when `gem` is used as an identifier. This messes up the highlighting
below the first use and makes working with the file rather annoying.
2016-05-26 16:27:53 +02:00
Mike McQuaid
ddb576b582 Add support for testing generic OS.
If the environment variable HOMEBREW_TEST_GENERIC_OS is set ensure that
neither Mac nor Linux-specific code is loaded. This allows easier
testing of cross-platform code on OS X and will make it easier to port
Homebrew to platforms other than OS X and Linux.
2016-05-08 16:51:22 +01:00
Score_Under
b5007c48e0 Tty: Avoid truncating if not sensible
This causes truncate to simply return the original string if the
terminal is not very wide, or if the terminal is unsupported.
2016-05-03 15:56:47 +01:00
Martin Afanasjew
8600b9edf1 Update Homebrew/homebrew references in comments
Replace `homebrew` with `brew`, `homebrew-core`, or `legacy-homebrew`
depending on context.
2016-05-02 21:19:09 +02:00
Andrew Janke
a3b70d38a7 brew-audit: pull style checks in to main audit output
This collects all violations for each formula in a single place, instead
of doing `brew style` outputs for all formulae first, and then the other
audit checks.

Closes #112.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-04-21 14:45:33 -04:00
Andrew Janke
acc9a7ca85 brew test, install, update-test: add --keep-tmp option
Also enables sandbox for --interactive and --debug use of install
and test, using automatic retention.

Closes #66.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-04-18 12:23:08 -04:00
Xu Cheng
d5085edce0 curl: fall back to /usr/bin/curl when HOMEBREW_CURL doesn't exist
This can happen when `HOMEBREW_CURL` is set to brewed curl, but during

`brew resinstall curl`, brewed curl's symlink is temporary

unlinked.



So let's fallback to /usr/bin/curl in this case.
2016-04-07 14:57:37 +08:00
Mike McQuaid
1238c65ba1 utils: add analytics functions. 2016-04-04 12:27:47 +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
bc19a47eb9 GitHub: fix issues/pr searching
Closes #6.
2016-04-04 02:00:21 +08:00
Xu Cheng
2bb30fc5f0 --version/config: show core tap information 2016-04-02 21:51:36 +08:00
Mike McQuaid
6135da800e utils, gist-logs: improve/fix credential handling.
The API used (`Net::HTTP::Post`) does not handle basic authentication
credentials in the same way as `open` so fix both cases so they work.

Also, do some general usability tweaks to point out to people what could
be wrong with their tokens or credentials to help them debug.

Closes Homebrew/homebrew#50410.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-03-28 18:22:47 +08:00
Tim D. Smith
8aaa95ee99 Add advice about keychain credentials
Fixes Homebrew/homebrew#50050. Closes Homebrew/homebrew#50059.
2016-03-20 14:55:58 +08:00
Mike McQuaid
c8debd8fa4 utils: API Git credential tweaks.
- Use empty array when `git credential-osxkeychain` lookup fails to
  cache and avoid rerunning it when there's no valid results.
- Redirect `stderr` to avoid printing errors when there's a failure
  or no `git credential-osxkeychain` installed.

Closes Homebrew/homebrew#49954.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-03-10 18:45:43 +08:00
Mike McQuaid
ec2a3f979e utils: use string arg to IO.popen.
Closes Homebrew/homebrew#49882.
2016-03-09 16:00:22 +08:00