8554 Commits

Author SHA1 Message Date
Martin Afanasjew
c3076f0b69 formulary: use FormulaClassUnavailableError
Present a more helpful error message if a formula file was loaded, but
the class(es) therein didn't match the expected formula class name.
2016-04-17 21:16:01 +02:00
Martin Afanasjew
1ded40a744 exceptions: add FormulaClassUnavailableError 2016-04-17 21:16:01 +02:00
Martin Afanasjew
feb1e75b61 manpages: add editing instructions to ERB template
Closes #102.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-17 20:43:27 +02:00
Martin Afanasjew
3680c4667f man: replace split header/footer with ERB template 2016-04-17 20:43:27 +02:00
Martin Afanasjew
b4b53e5067 manpages: remove no longer needed 'brew.1.md'
Changes to the man page are made in `header.1.md`, `footer.1.md`, or the
documentation comment block in the respective command file. Remove old
Markdown file to reduce confusion, now that it is no longer needed (and
not even used by `brew man`).
2016-04-17 20:43:27 +02:00
Martin Afanasjew
d8e427577d man: pipe markup to 'ronn' to avoid temporary file 2016-04-17 20:43:27 +02:00
Martin Afanasjew
291ff3cc42 man: refactor and fix code style
Split monolithic method into more manageable chunks and fix code style.
2016-04-17 20:43:27 +02:00
Martin Afanasjew
8e42077a8e list: exclude zsh completions from unbrewed
Since edf000e4cd30c3626ccc28c52ed32f2d84a200dd `zsh` completions are in
`share/zsh/site-functions/_brew`, making this path a part of Homebrew.
Hide it from `brew list --unbrewed` to reduce confusion/noise.
2016-04-17 00:13:17 +02:00
Josh Hagins
0fe6acea3a tests: ensure desc prints short name only if there are conflicts
Fixes #70.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-04-16 16:15:08 +02:00
Cory Donnelly
bad28dc546 audit.rb: Base desc length check on short name
Currently, brew audit --strict includes the name of the tap when calculating the
length of a formula's description. This makes it difficult to pass the audit for
formulas in taps with lengthy names. In #47033 @jawshooah called out head-only
or devel-only taps specifically, but this is an issue elsewhere. For example:

homebrew/versions/elasticsearch20: Distributed search & analytics engine (72)

This commit updates audit.rb to use formula.name rather than formula.full_name.

Closes #47033 -- Audit shouldn't include tap name in description length
2016-04-16 16:14:15 +02:00
Josh Hagins
abff8a0cc8 desc: print short name unless multiple formulae have the same name 2016-04-16 16:14:15 +02:00
Xu Cheng
a8be17df57 test-bot: update for new deps/uses options
Closes #92.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-04-16 21:47:47 +08:00
Xu Cheng
df79659045 update manpage for deps/uses 2016-04-16 21:47:47 +08:00
Xu Cheng
7ba9eabc14 uses/deps: default to skip optional/build deps.
Also add options to include optional/build deps and an option
to skip recommended deps.

Closes Homebrew/legacy-homebrew#50066.
2016-04-16 21:47:47 +08:00
Mike McQuaid
f6d5ae2253 analytics: add more documentation, Linuxbrew ID. (#98) 2016-04-16 11:39:57 +01:00
Dominyk Tiller
b70e4341fe style: use rubocop 0.39
(#85)
2016-04-14 14:44:23 +01:00
Andrew Janke
36b2af2e0f superenv: fix formula prefix path to consider revisions
Old logic doesn't include revision. This fixes that, and passes the
whole formula prefix path to avoid duplicating the path-construction
logic.

Closes #80.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-04-13 10:41:01 -04:00
Andrew Janke
a8ed06ba74 superenv: allow paths under self's keg
Fixes build error in Homebrew/homebrew-core#100.

Closes #63.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-04-13 02:20:17 -04:00
Mike McQuaid
4e8c6e633c Document disabling of opt-in Homebrew analytics. (#79) 2016-04-12 12:17:56 +01:00
Xu Cheng
548be81b34 tap: various improvements (#77)
* make `read_or_set_private_config` private
* add doc
* add test
2016-04-12 18:51:43 +08:00
Mike McQuaid
891dcc7c27 update: use official GitHub SHA API. (#75)
This is coming out of preview shortly so use the new API content-type.
2016-04-12 11:12:23 +01: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
1d5458843e Cache Tap#private? checks.
Use both an in-class and a `.git/config` cache for this so we can ensure
that the `Tap#private?` check is fast. Also, make sure this cache value
is set both when initially installing and updating a tap.

Thanks to @xu-cheng for most of the implementation here.
2016-04-12 11:00:23 +01:00
Xu Cheng
c1427fd295 help: support highlighted output
Closes #68.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-04-12 17:57:18 +08:00
Xu Cheng
af1eb007e2 help: handle alias
Before this fix
```
$ brew --help ls
Error: Unknown command: ls
```

After this fix
```
$ brew --help ls
brew list, ls
<snip>
```
2016-04-12 14:29:49 +08:00
Mike McQuaid
4a7cd160c3 Auto-update when running brew install/upgrade.
Also, slightly tweak the behavior of `brew update` in this case so that
it doesn't print annoying output and still allows the `brew edit` flow
for people with `HOMEBREW_DEVELOPER` set.
2016-04-11 09:31:50 +01:00
Martin Afanasjew
0382134cf8 brew.rb: adjust behavior for undocumented commands
Don't exit with a non-zero status code just because an internal command
happens to be undocumented. Also print the generic help in these cases
to provide some help (including a reference to the man page).
2016-04-10 22:59:25 +02:00
Max Nordlund
10edfcd218 Fix documentation error
Closes #10.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-10 22:59:25 +02:00
Max Nordlund
c8a2cd4e10 Generate the new man page 2016-04-10 22:59:25 +02:00
Max Nordlund
fa1fd70a37 Add all the top level comments 2016-04-10 22:59:25 +02:00
Max Nordlund
b21f699ff2 Implement the brew help command
This is also used by `brew <cmd> --help`. The basic idea is to have the
documentation as a top level comment in each command file. To find these
comments, they have to be like this `#:`.

This is also used by the `brew man` command to keep the documentation
DRY, and for that there are now a header and footer for the man page.
2016-04-10 22:59:24 +02:00
Dominyk Tiller
32ae71b256 xcode: expect 7.3 on 10.11
xcode: expect 7.3 on 10.11
2016-04-10 20:00:11 +01:00
Martin Afanasjew
883751d666 diagnostic: fix style of previously skipped method
Fix style of previously omitted `check_for_bad_install_name_tool`
method to be in line with changes made in #49.

Closes #56.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-09 16:12:17 +02:00
Martin Afanasjew
eb137dc924 Revert "diagnostic: improve check for 'install_name_tool'"
This reverts commit 9f79c05656a44f926898774c6029025002bcd621.

Restore check to continue to inspect `/usr/bin/install_name_tool`. See
Homebrew/legacy-homebrew#50091 and Homebrew/legacy-homebrew#50509 for
the full context and more details.
2016-04-09 16:12:17 +02:00
Martin Afanasjew
1d9977b7c1 diagnostic: prefer guard clauses for readability
Guard clauses instead of if/unless blocks make the checks easier to
understand and reduce nesting, thus improving overall readability.

This includes the following additional minor changes:

- Make indentation of commands consistent inside diagnostic messages.
- Fix minor typos and inconsistent punctuation in diagnostic messages.
- Fix here documents to always start with `<<-EOS.undent` on a new line,
  followed by the message (indented once), followed by `EOS` (at the
  same level like `<<-EOS.undent`).
- Always separate the check logic (and guard clauses) from the following
  message by a single empty line (for consistency and readability).
- Standardize on `message` as the variable name when diagnostic messages
  need to be constructed from multiple parts.
- Where easily possible, adapt check logic to stay within 80-column
  limit, use more expressive variable names, and break down long
  expressions into multiple statements with intermediate results.

Closes #49.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-08 17:57:30 +02:00
Martin Afanasjew
6a82bc49c7 brew.sh: make sure to always use system 'awk'
This should prevent issues like #47 and make us more resilient.
2016-04-08 16:32:05 +02:00
Martin Afanasjew
d7aa0c0335 scm/git: prevent exec bomb with 'env :userpaths'
Using `git` from `Formula#install` can cause an exec bomb if used in a
formula with `env :userpaths` because that causes both `Library/ENV/4.3`
and `Library/ENV/scm` to be in PATH, both of which contain a `git`
binary that is the same SCM wrapper. Those will mutually exec each other
indefinitely as they fail to detect that they are the same wrapper.

Extend the exec-bomb protection to check the paths after all symbolic
links have been expanded to prevent this situation.

Fixes #43.
Fixes Homebrew/homebrew-core#133.
Fixed Homebrew/homebrew-core#143.

Closes #46.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-08 00:04:15 +02: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
Martin Afanasjew
f3cc0596a6 brew.sh: tweak HOMEBREW_PROCESSOR on Linux
`uname -p` seems to be less useful on Linux (Debian 8 yields `unknown`),
thus prefer `uname -m` on those systems to determine the processor type.

Closes #35.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-07 08:25:41 +02:00
Martin Afanasjew
2ca97490af brew.sh: fix HOMEBREW_OS_VERSION on Linux et al.
On Linux (and other non-OS X platforms), `HOMEBREW_OS_VERSION` was
*always* replaced with the product name, leading to less useful user
agent. E.g., on a reasonably up-to-date Debian system:
  Linuxbrew/0.9.9 (Linux; unknown Linuxbrew)

With this fix the user agent is instead (first if `lsb_release` is
available and outputs something, second otherwise):
  Linuxbrew/0.9.9 (Linux; unknown Debian GNU/Linux 8.3 (jessie))
  Linuxbrew/0.9.9 (Linux; unknown 3.16.0-4-amd64)
2016-04-07 08:25:41 +02:00
Martin Afanasjew
d83cd56603 brew.sh: avoid unnecessary 'cat'
Bash can read directly from a file in its command substitution.
2016-04-07 08:25:41 +02:00
Martin Afanasjew
b2fe2945d3 brew.sh: simplify HOMEBREW_OSX_VERSION_NUMERIC
Use `printf -v` and strip out the unnecessary `echo`, thus avoiding two
unnecessary command substitutions.
2016-04-07 08:25:41 +02:00
Martin Afanasjew
3a99d8093c brew.sh: streamline setting HOMEBREW_{OSX,LINUX}
For uses like this one, `case` is much more compact and easier to read.
2016-04-07 08:25:41 +02:00
Martin Afanasjew
8ab2fb6868 analytics: avoid unnecessary string interpolation 2016-04-07 08:25:41 +02:00
Martin Afanasjew
e747648c53 always prefer HOMEBREW_CURL over plain 'curl' 2016-04-07 08:25:41 +02:00
Misty De Meo
f016a21470 superenv: comment sources of ignored paths
Closes #32.

Signed-off-by: Misty De Meo <mistydemeo@github.com>
2016-04-06 16:16:14 -07:00
Misty De Meo
ef4cad0c77 superenv: don't filter out all /opt paths
This was intended to filter out MacPorts and X11 paths, but the user
may have valid reasons to have other things here that might get linked
against.
2016-04-06 16:16:14 -07:00
Andrew Janke
1f8b6cb576 test-bot: add safety margin to output truncation size 2016-04-06 16:48:07 -04:00
Dominyk Tiller
bbb1fcd17c test-bot: stop using --recursive for brew uses
We're not sure this is working as it was intended to, and the primary
end product so far has been making every Ruby 1.8.7 build, which is the Ruby
we use on Mavericks for compatibility, take 5-15 minutes longer per build
than 2.x Rubies.

Cumulatively this is responsible for the vast majority of CI slowness over the
last couple months as Mavericks plays catch-up and everything else waits for it
to do so.

We may revisit this in future, but for now the harm is greater than the "risk".

This technically reverts 7b26c585c2.
2016-04-06 17:57:05 +01:00
Martin Afanasjew
7771f3af81 tests: update prune --verbose test
Closes #15.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-06 10:31:54 +02:00