The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Ruby: rake commit

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jay Fields

Posts: 765
Nickname: jayfields
Registered: Sep, 2006

Jay Fields is a software developer for ThoughtWorks
Ruby: rake commit Posted: Dec 21, 2006 5:08 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Jay Fields.
Original Post: Ruby: rake commit
Feed Title: Jay Fields Thoughts
Feed URL: http://blog.jayfields.com/rss.xml
Feed Description: Thoughts on Software Development
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Jay Fields
Latest Posts From Jay Fields Thoughts

Advertisement
I wrote in the past about rake pc, the task that I run before checking in. The rake pc task is good, but it stops one step short: actually checking in.

The first implementation of this task used a task with parameters; however, the final implementation uses STDIN.gets and a data file.

The rake commit task also allows you specify a pair if you are working on multiple pairing stations.

desc "Run to check in"
task :commit => :pc do
commit_pair = retrieve_saved_data "pair"
commit_message = retrieve_saved_data "message"
command = %[svn ci -m "#{commit_pair.chomp} - #{commit_message.chomp}"]
puts command
puts %x[#{command}]
end

def retrieve_saved_data attribute
data_path = File.expand_path(File.dirname(__FILE__) + "/#{attribute}.data")
`touch #{data_path}` unless File.exist? data_path
saved_data = File.read(data_path)

puts "last #{attribute}: " + saved_data unless saved_data.chomp.empty?
print "#{attribute}: "

input = STDIN.gets
while (saved_data.chomp.empty? && (input.chomp.empty?))
print "#{attribute}: "
input = STDIN.gets
end
if input.chomp.any?
File.open(data_path, "w") { |file| file << input }
else
puts "using: " + saved_data.chomp
end
input.chomp.any? ? input : saved_data
end

Read: Ruby: rake commit

Topic: Rewriting a (large) PHP application in Rails, part 2 Previous Topic   Next Topic Topic: Ruby on Rails and Ajax won't make it in 2007?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use