Update rakefile libs

This commit is contained in:
Henrik Lissner 2014-04-13 11:45:53 -04:00
parent cf0e299aec
commit 2883f5bd29
3 changed files with 21 additions and 9 deletions

View file

@ -1,7 +1,7 @@
include Rake::DSL include Rake::DSL
def git(url,dest) def git(url,dest)
sh "git clone #{url} #{dest}" unless File.exists?(dest) sh "git clone #{url} #{dest}" unless Dir.exists?(dest)
end end
def github(repo,dest) def github(repo,dest)

View file

@ -38,26 +38,34 @@ module Homebrew
end end
def self.has_keg?(keg) def self.has_keg?(keg)
system("#{BIN} search #{keg}") `#{BIN} search #{keg}`
end end
def self.is_keg_installed?(keg) def self.is_keg_installed?(keg)
system("#{BIN} list | grep -w '#{keg}'") `#{BIN} list | grep -w '#{keg}'`
end end
def self.is_cask_installed?(cask) def self.is_cask_installed?(cask)
system("#{BIN} cask list | grep -w '#{cask}'") `#{BIN} cask list | grep -w '#{cask}'`
end end
def self.is_tapped?(tap) def self.is_tapped?(tap)
system("#{BIN} tap | grep -w '#{tap}'") `#{BIN} tap | grep -w '#{tap}'`
end end
def self.is_installed? def self.is_installed?
File.exists?("usr/local/bin/brew") File.exists?("/usr/local/bin/brew")
end end
def self.update() def self.prefix(keg)
`#{BIN} --prefix #{keg}`.strip
end
def self.update(*args)
if args.length > 0
sh "#{BIN} upgrade #{args.join(' ')}"
else
sh "#{BIN} update && #{BIN} upgrade" sh "#{BIN} update && #{BIN} upgrade"
end end
end end
end

View file

@ -3,3 +3,7 @@ require 'colorize'
def echo(msg) def echo(msg)
puts "=> #{msg}".bold.green puts "=> #{msg}".bold.green
end end
def echoerr(msg)
puts "=> #{msg}".bold.red
end