Tweak the logic further to make the no-op case even faster.
Before:
```
brew update 1.10s user 1.05s system 92% cpu 2.325 total
brew update --preinstall 0.60s user 0.77s system 96% cpu 1.433 total
```
After:
```
brew update 0.60s user 0.34s system 83% cpu 1.132 total
brew update --preinstall 0.29s user 0.24s system 62% cpu 0.860 total
```
These times are now fast enough to avoid any further special-casing for
`--preinstall`, roll it out to users by default and not print a message
unless we've actually found some updates.
This is less than ideal but it gets the time on my machine down from ~6s
to ~2s when checking no taps. It still shows that we're doing way more
in `update.sh` than we need to be doing but that's a future PR.
Introduce `--fetch-HEAD` option. Without this option upgrade and
outdated never fetch latest upstream commit to detect if HEAD is
outdated -- tabs are used instead. However, if option is passed,
we fetch commit from upstream, which is more time consuming,
but we can be sure that version is up-to-date or outdated.
No longer output every cask under the list of changed formulae but
instead create a dedicated, unprinted report section for casks and then
iterate through that instead.
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)).
Rather than nudge people to run `--strict` and then ignore some of the
results sometimes (e.g. GitHub repository notability) instead add a
dedicated `--new-formula` option that implies this is a one-time
advisory check.
This extends the approach in #597 to further prevent linkage of formulae
that conflict with the system OpenSSL and can cause the issues
described in that issue.
Since we are loading options as Formula#build from tab, we will have to explicitly read
options from ARGV as well.
Fixes#3066.
Closes#537.
Signed-off-by: Xu Cheng <xucheng@me.com>
Substitue each Version.new and HeadVersion.new with Version.create
to unify Version and HeadVersion instantiation among core code.
Note that this does not relate to Mac::OS::Version class.
Move some stuff formerly in `Library/ENV` around:
- Move `Library/ENV/$XCODE_VERSION` to `Library/Homebrew/env/super` as they are
all superenv wrappers and all symlinks to the same version. We never needed
the "separate shims for separate versions" functionality and it just adds
confusion.
- Move `Library/ENV/pkgconfig` to `Library/Homebrew/env/pkgconfig` to get more
things under `Library/Homebrew`
- Move `Library/ENV/scm` to `Library/scm` as these wrappers are not actually
used by or related to superenv (or stdenv) in any way.
Regex is way slower than normal String#include? and String#start_with?.
Also, we often forget to proper escape them. So avoid using them if it
is not necessary.
Closes#503.
Signed-off-by: Xu Cheng <xucheng@me.com>
Changes to our style configuration:
- Consolidate all rules related to Ruby 1.8 compatibility in one place.
- Codify our de-facto preference for `alias_method` over `alias` (drops
offense count by 54 after turning this on).
- Drop `Style/SignalException` as `only_raise` has been the new default
for quite a while (since RuboCop 0.37.0).