Skip to content

Commit

Permalink
Fix brew services.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Oct 5, 2023
1 parent 64e9f8d commit e7430a8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/tasks/brew.rake
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,14 @@ namespace :brew do

task :services => :'brew:casks_and_formulae' do
wanted_services = ['asimov']
services = capture(sudo, 'brew', 'services', 'list')
.each_line
.to_h { |l| l.strip.split(/\s+/, 2) }

wanted_services.each do |service|
capture sudo, 'brew', 'services', 'start', service if services.fetch(service) == 'stopped'
services = JSON.parse(capture(sudo, 'brew', 'services', 'list', '--json'))
.to_h { |service| [service.fetch('name'), service] }

services.values_at(*wanted_services).each do |service|
next if ['started', 'scheduled'].include?(service.fetch('status'))

capture sudo, 'brew', 'services', 'start', service.fetch('name')
end
end
end

0 comments on commit e7430a8

Please sign in to comment.