Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 21 lines (17 sloc) 0.685 kb
#!/usr/bin/env ruby
#
# Updates all text files in the project that mention the current version
# and/or date to match the first version and date from the HISTORY_FILE.
#
# Usage: project-version-update HISTORY_FILE
HISTORY_FILE = ARGV.shift or raise ArgumentError, 'HISTORY_FILE not given'
(new_version, new_date), (old_version, old_date) =
File.read(HISTORY_FILE, encoding: 'utf-8').
scan(/^## Version (\S+) \((\S+?)\)/).first(2)
`git grep -I -l "#{old_version}\\|#{old_date}"`.split(/\n/).each do |file|
next if file == HISTORY_FILE
body = File.read(file)
body.gsub! /\b#{old_version}\b/, new_version
body.gsub! /\b#{old_date}\b/, new_date
File.write file, body
end
Jump to Line
Something went wrong with that request. Please try again.