Tidy the cask-upgrade script further.
This commit is contained in:
parent
861c4985d7
commit
590da333d5
|
@ -31,10 +31,8 @@ if options[:package]
|
||||||
update = STDIN.gets.strip
|
update = STDIN.gets.strip
|
||||||
end
|
end
|
||||||
if update =~ /[yY]/
|
if update =~ /[yY]/
|
||||||
puts "Closing any open instances of #{app}"
|
puts "Upgrading #{app}"
|
||||||
system("osascript -e \'quit app \"#{app}\"\' && sleep 1")
|
system("brew cask uninstall #{app} --force && brew cask install #{app} --force")
|
||||||
puts "Upgrading #{app}".green
|
|
||||||
system("brew cask uninstall #{app} --force && sleep 1 && brew cask install #{app} --force")
|
|
||||||
else
|
else
|
||||||
puts 'Cancelling update...'
|
puts 'Cancelling update...'
|
||||||
end
|
end
|
||||||
|
@ -48,7 +46,7 @@ end
|
||||||
puts 'Updating homebrew cask, please wait...'
|
puts 'Updating homebrew cask, please wait...'
|
||||||
system('brew cask update')
|
system('brew cask update')
|
||||||
if $CHILD_STATUS == 1
|
if $CHILD_STATUS == 1
|
||||||
puts 'Cask update failed'.red
|
puts 'Cask update failed'
|
||||||
exit!
|
exit!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -82,7 +80,7 @@ IO.popen('brew cask list') do |apps|
|
||||||
puts 'Up-to-date'.rjust(column1length)
|
puts 'Up-to-date'.rjust(column1length)
|
||||||
elsif current != '(null)' && version != 'latest'
|
elsif current != '(null)' && version != 'latest'
|
||||||
puts 'Update available'.rjust(column1length)
|
puts 'Update available'.rjust(column1length)
|
||||||
print "Do you want to update #{app} to version #{version.green} (current #{current.green})? " + '[y/N] '
|
print "Do you want to update #{app} to version #{version} (current #{current})? " + '[y/N] '
|
||||||
if options[:auto]
|
if options[:auto]
|
||||||
update = 'y'
|
update = 'y'
|
||||||
else
|
else
|
||||||
|
@ -91,9 +89,7 @@ IO.popen('brew cask list') do |apps|
|
||||||
# UPDATE CURRENT APPLICAION
|
# UPDATE CURRENT APPLICAION
|
||||||
if update =~ /[yY]/
|
if update =~ /[yY]/
|
||||||
puts "Updating #{app} to version #{version}"
|
puts "Updating #{app} to version #{version}"
|
||||||
puts "Closing any open instances of #{app}"
|
system("brew cask uninstall #{app} --force && brew cask install #{app} --force")
|
||||||
system("osascript -e \'quit app \"#{app}\"\' && sleep 1")
|
|
||||||
system("brew cask uninstall #{app} --force && sleep 1 && brew cask install #{app} --force")
|
|
||||||
else
|
else
|
||||||
puts 'Cancelling update'
|
puts 'Cancelling update'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue