This provides a significant speedup:
$ hyperfine 'git checkout master; brew --repo homebrew/core' 'git checkout brew-repository-speedup; brew --repo homebrew/core'
Benchmark 1: git checkout master; brew --repo homebrew/core
Time (mean ± σ): 1.737 s ± 0.388 s [User: 0.743 s, System: 0.323 s]
Range (min … max): 1.336 s … 2.438 s 10 runs
Benchmark 2: git checkout brew-repository-speedup; brew --repo homebrew/core
Time (mean ± σ): 459.1 ms ± 91.9 ms [User: 100.5 ms, System: 142.1 ms]
Range (min … max): 366.5 ms … 594.0 ms 10 runs
Summary
git checkout brew-repository-speedup; brew --repo homebrew/core ran
3.78 ± 1.13 times faster than git checkout master; brew --repo homebrew/core
18 lines
574 B
Ruby
18 lines
574 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe "brew --repository", type: :system do
|
|
it "prints Homebrew's repository", :integration_test do
|
|
expect { brew_sh "--repository" }
|
|
.to output("#{ENV.fetch("HOMEBREW_REPOSITORY")}\n").to_stdout
|
|
.and not_to_output.to_stderr
|
|
.and be_a_success
|
|
end
|
|
|
|
it "prints a Tap's repository", :integration_test do
|
|
expect { brew_sh "--repository", "foo/bar" }
|
|
.to output("#{ENV.fetch("HOMEBREW_LIBRARY")}/Taps/foo/homebrew-bar\n").to_stdout
|
|
.and not_to_output.to_stderr
|
|
.and be_a_success
|
|
end
|
|
end
|