Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use FormulaInstaller OS extensions #18275

Merged
merged 2 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1546,3 +1546,5 @@ def puts_requirement_messages
$stderr.puts @requirement_messages
end
end

require "extend/os/formula_installer"
carlocab marked this conversation as resolved.
Show resolved Hide resolved
25 changes: 25 additions & 0 deletions Library/Homebrew/test/os/linux/formula_installer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

require "formula_installer"
require "test/support/fixtures/testball"

RSpec.describe FormulaInstaller do
include FileUtils

subject(:keg) { described_class.new(keg_path) }

describe "#fresh_install" do
subject(:formula_installer) { described_class.new(Testball.new) }

it "is true by default" do
formula = Testball.new
expect(formula_installer.fresh_install?(formula)).to be true
end

it "is false in developer mode" do
formula = Testball.new
allow(Homebrew::EnvConfig).to receive_messages(developer?: true)
expect(formula_installer.fresh_install?(formula)).to be false
end
end
end
31 changes: 31 additions & 0 deletions Library/Homebrew/test/os/mac/formula_installer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frozen_string_literal: true

require "formula_installer"
require "test/support/fixtures/testball"

RSpec.describe FormulaInstaller do
include FileUtils

subject(:keg) { described_class.new(keg_path) }

describe "#fresh_install" do
subject(:formula_installer) { described_class.new(Testball.new) }

it "is true by default" do
formula = Testball.new
expect(formula_installer.fresh_install?(formula)).to be true
end

it "is false in developer mode" do
formula = Testball.new
allow(Homebrew::EnvConfig).to receive_messages(developer?: true)
expect(formula_installer.fresh_install?(formula)).to be false
end

it "is false on outdated releases" do
formula = Testball.new
allow(OS::Mac.version).to receive_messages(outdated_release?: true)
expect(formula_installer.fresh_install?(formula)).to be false
end
end
end