lib/rconf/support/package_installer.rb in rconf-1.0.1 vs lib/rconf/support/package_installer.rb in rconf-1.0.3
- old
+ new
@@ -84,14 +84,19 @@
# === Return
# true:: Always return true
def install_darwin(packages, opts)
return if packages.nil?
BrewInstaller.check_and_install
+ res = Command.execute('brew', 'list')
+ all_installed = res.success? ? res.output.gsub("\t", "\n") : ''
packages.each do |p|
args = [ p ]
args << opts if opts
+ formula = p.split('/').last.split('.rb').first
+ already_installed = all_installed =~ /^#{formula}$/
+ next if already_installed
res = Command.execute('brew', 'install', *args)
- installed = res.success? && res.output !~ /Formula already installed/
+ installed = res.success? && res.output !~ /already installed/
Command.sudo('brew', 'link', p) if installed
end
end
# Install Windows software