Skip to content

Instantly share code, notes, and snippets.

@joeybeninghove
Created March 6, 2010 02:43
Show Gist options
  • Save joeybeninghove/323455 to your computer and use it in GitHub Desktop.
Save joeybeninghove/323455 to your computer and use it in GitHub Desktop.
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