Skip to content

Commit

Permalink
Expose BrewServices.start to fix #1115
Browse files Browse the repository at this point in the history
Missed this addition in #1115, actually implementing BrewServices.start!
  • Loading branch information
jeremy committed Oct 3, 2022
1 parent 3b4d678 commit fb15302
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/bundle/brew_services.rb
Expand Up @@ -17,6 +17,13 @@ def stop(name, verbose: false)
true
end

def start(name, verbose: false)
return unless Bundle.system HOMEBREW_BREW_FILE, "services", "start", name, verbose: verbose

started_services << name
true
end

def restart(name, verbose: false)
return unless Bundle.system HOMEBREW_BREW_FILE, "services", "restart", name, verbose: verbose

Expand Down
8 changes: 8 additions & 0 deletions spec/bundle/brew_services_spec.rb
Expand Up @@ -42,6 +42,14 @@
end
end

it "starts the service" do
allow(described_class).to receive(:started_services).and_return([])
expect(Bundle).to receive(:system).with(HOMEBREW_BREW_FILE, "services", "start", "nginx",
verbose: false).and_return(true)
expect(described_class.start("nginx")).to be(true)
expect(described_class.started_services).to include("nginx")
end

it "restarts the service" do
allow(described_class).to receive(:started_services).and_return([])
expect(Bundle).to receive(:system).with(HOMEBREW_BREW_FILE, "services", "restart", "nginx",
Expand Down

0 comments on commit fb15302

Please sign in to comment.