Created
March 6, 2010 02:43
-
-
Save joeybeninghove/323455 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def empty? | |
count == 0 | |
end | |
end | |
class Subversion | |
def initialize | |
svn_dirs = ENV['PATH'].split(';').select do |path| | |
Dir.new(path).entries.include? 'svn.exe' if File.directory? path | |
end | |
raise StandardError.new 'svn.exe was not found in your path' if svn_dirs.empty? | |
@svn = Pathname.new svn_dirs.first + '/svn.exe' | |
end | |
def info(*args) | |
open("|#{@svn} info #{args.join ' '}").read | |
end | |
end | |
task : do | |
svn_info = Subversion.new.info('--xml') | |
doc = Hpricot.XML(svn_info) | |
puts (doc/:info/:entry/:url).inner_html | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment