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
def git(url,dest)
sh "git clone #{url} #{dest}" unless File.exists?(dest)
sh "git clone #{url} #{dest}" unless Dir.exists?(dest)
end
def github(repo,dest)

View file

@ -38,26 +38,34 @@ module Homebrew
end
def self.has_keg?(keg)
system("#{BIN} search #{keg}")
`#{BIN} search #{keg}`
end
def self.is_keg_installed?(keg)
system("#{BIN} list | grep -w '#{keg}'")
`#{BIN} list | grep -w '#{keg}'`
end
def self.is_cask_installed?(cask)
system("#{BIN} cask list | grep -w '#{cask}'")
`#{BIN} cask list | grep -w '#{cask}'`
end
def self.is_tapped?(tap)
system("#{BIN} tap | grep -w '#{tap}'")
`#{BIN} tap | grep -w '#{tap}'`
end
def self.is_installed?
File.exists?("usr/local/bin/brew")
File.exists?("/usr/local/bin/brew")
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"
end
end
end

View file

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