From: Marcin Raczkowski Date: 2007-04-11T17:27:20+09:00 Subject: Re: Subversion wrapper in Ruby --Boundary-00=_hwJHGaM/p7PUXYi Content-Type: Multipart/Mixed; boundary="Boundary-00=_hwJHGaM/p7PUXYi" --Boundary-00=_hwJHGaM/p7PUXYi Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tuesday 03 April 2007 20:26, Daniel Schierbeck wrote: > I've begun developing a small library that wraps the command-line > Subversion commands, so that you can call SVN.copy(src, dest, :message > => 'chunky bacon') etc. These will only cover the methods Subversion > directly supports. > > The reason I'm making this library is actually that I want to have Rake > tasks that automate tagging, branching, etc. of my repository. > Currently, the most advanced thing I have is this: > > SVN::TagReleaseTask.new do |t| > t.repository = 'svn://svn.example.org/bacon' > t.version = '1.2.3' > end > > Calling `rake svn:tag:release' will then issue the following to the > command line: > > svn copy svn://svn.example.org/bacon/trunk > svn://svn.example.org/bacon/tags/release-1.2.3 --message "tagging > release 1.2.3" > > Do you have any special wishes? As soon as the Rubyforge submission goes > through I'll make an alpha gem for those wanting to get their hands > dirty :) > > > Cheers, > Daniel well i can only wish you good luck - svn support is much needed - from me i can paste code that i found on wiki somewhere and modified a little - it adds/deletes all changed files in directory to SVN. --Boundary-00=_hwJHGaM/p7PUXYi Content-Type: application/x-ruby; name="update.rb" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="update.rb" #!/usr/bin/env ruby # my take on a easy commit script for rails... # it is far from prefect, so: # please feed back the modifications you made to it! # # by Cies Breijs -- cies.breijsATgmailDOTcom # based on a bash script by Anonymous Gentleman # found here: http://wiki.rubyonrails.org/rails/pages/HowtoUseRailsWithSubversion to_add = [] to_remove = [] to_checkin = [] `svn status`.each_line do |l| action_char, path = l.split(' ', 2) path.strip! case action_char when '?' to_add << path when '!' to_remove << path when 'M' to_checkin << path end end puts "\nyou are about to..." def print_list(array, str) puts "\n#{str}:" array.each { |i| puts "\t"+i } puts "\t" if array.length == 0 end print_list(to_add, 'add') print_list(to_remove, 'remove') print_list(to_checkin, 'checkin') puts "\nplease write something for the commit log adn hit enter..." puts "(hitting enter on an empty line will cancel this commit)\n\n" log = gets.strip if log.empty? puts "commit cancelled!\n" exit end puts "\ncontacting repository...\n" `svn add #{to_add.join(' ')}` unless to_add.empty? `svn remove #{to_remove.join(' ')}` unless to_remove.empty? puts "\n" + `svn commit -m "#{log.gsub('"', '\"')}"` + "\n" puts "running 'svn update' to be shure we are up-to-date..." puts `svn update` puts "\nfinished.\n" --Boundary-00=_hwJHGaM/p7PUXYi-- --Boundary-00=_hwJHGaM/p7PUXYi--