Sha256: 92e63f4ccd635fc6acf5751ad721b49689ce92b580c0e5cd6f8877c6062ec907
Contents?: true
Size: 1.63 KB
Versions: 3
Compression:
Stored size: 1.63 KB
Contents
require 'rexml/document' module BuildMaster class SvnInfo attr_reader :path, :repository_root def initialize(path) @path = path analyze_entry_file(File.join(path, ".svn", "entries")) end def analyze_entry_file(file) xml = REXML::Document.new(File.open(file)) xml.root.each_element_with_attribute('name', '', 1) do |element| @repository_root = element.attributes['repos'] end end end class SvnDriver include Shell def SvnDriver::from_path(directory) return SvnDriver.new(SvnInfo.new(directory)) end def initialize(svn_info, &command_runner) @svn_info = svn_info if (command_runner) @command_runner = command_runner else @command_runner = Proc.new {|command| run(command)} end end def status command_for_path('status') end def update command_for_path('update') end def commit(comment) command_for_path('commit', " -m \"#{comment}\"") end def tag(tag_name) run_command("svn copy #{@svn_info.repository_root}/trunk #{@svn_info.repository_root}/tags/#{tag_name} -m \"ruby buildmaster\"") end def checkout(output) run_command("svn checkout #{@svn_info.repository_root}/trunk #{output}") end def command(command) command_for_path(command) end private def command_for_path(svn_command, argument='') run_command("svn #{svn_command} #{@svn_info.path}#{argument}") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
BuildMaster-0.5.0 | lib/buildmaster/svn_driver.rb |
BuildMaster-0.7.0 | lib/buildmaster/svn_driver.rb |
BuildMaster-0.6.0 | lib/buildmaster/svn_driver.rb |