#!/usr/bin/env ruby # load necessary modules require 'tempfile' # log path LOG_PATH = ARGV[0] || 'ChangeLog' # confirm commit? CONFIRM = false # open the ChangeLog File::open(LOG_PATH) { |log| # load and parse the changelog entries = log.readlines.join('').split(/^\*/) # get last message msg = '*' << entries[-1] # save message to temp file temp = Tempfile.new 'commit_message' temp.puts msg temp.close # confirm commit if CONFIRM puts msg puts 'Commit with the entry above? [Y/n]' exit -1 unless (gets =~ /y/i) end # commit changes system "cvs com -F #{temp.path}" }