- 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
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.
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.
`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>
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)
If analytics are enabled and `brew` is used in a command substitution
context, e.g. `brew search` for tab completion, the result is that even
though the Google Analytics `curl` process runs in the background it
still is attached to the captured `stdout`, thus could theoretically
contribute to the result of the command substitution and consequently
makes the command substitution block on the completion of this process.
Redirecting `stdout` (and `stderr` for good measure) to `/dev/null`
makes this process truly asynchronous in these contexts.
Furthermore, even if the process is in the background, it is still
included in the shell's job list and thus shell internals like `wait`
(used in `cmd/update.sh`) have to wait on this process, even if they
never intended to do so. Removing the analytics process from the job
list via `disown` avoids this unintended effect.
Fixes#29.
Closes#34.
Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
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.
* move shell completion scripts to where can be auto picked up
Let's use switching new remote as opportunity to put shell completion
scripts to where they should be and avoid git conflict during the process.
* add Library/Formula and Library/Aliases symlinks
Formulae and Aliases has been relocated to homebrew/core tap.
The symlinks are pointed to new location to keep backward compatibility.
* remove formula_renames and tap_migrations
They have been replaced by the json files in the core tap.
* update: set new remote
* bump Homebrew version to 0.9.9
This needs to be `Homebrew $HOMEBREW_VERSION` so we can be adequately
filtered.
ClosesHomebrew/homebrew#49961.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Follow-up to Homebrew/homebrew#49327 that leaves empty argument handling to the Ruby code
(it is a bit more sophisticated and distinguished between `help` and an
empty argument list and treats them differently) instead of hard-wiring
the former to the `help` command.
ClosesHomebrew/homebrew#49538.
Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
`bin/brew` is getting a bit bloated and it's annoying to open all of
`HOMEBREW_PREFIX` in your editor of choice and have it search through
the `Cellar`. Let's instead keep the bare minimum in `bin/brew` and
move the rest to `Library`.
ClosesHomebrew/homebrew#49185.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>