Created
November 5, 2011 21:47
-
-
Save tjhanley/1342064 to your computer and use it in GitHub Desktop.
Capistrano task for creating a change log file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Create about and revision files." | |
task :rev_deployment, :roles => [:app, :web] do | |
require 'grit' | |
require 'chronic' | |
# include Grit | |
work_dir = File.join(File.dirname(__FILE__), '../../') | |
g = Grit::Repo.new(work_dir) | |
since = Chronic.parse('last week friday') | |
msg = "\n" | |
rev_file = File.join(File.dirname(__FILE__), '../../','tmp/revision.txt') | |
File.new(rev_file,"w+") unless File.exists?(rev_file) | |
File.open(rev_file,"w") do |f| | |
f.puts "Version Info" | |
f.puts "=================================================" | |
f.puts "Version: #{real_revision}" | |
f.puts "Deploy Date: #{Time.now}" | |
f.puts "Branch: #{exists?(:branch) ? branch : 'local'}" | |
if ENV != 'production' | |
f.puts "Changes: Last #{since}" | |
f.puts "=================================================" | |
g.commits_since(branch,since).each do |commit| | |
# commit = g.gcommit(c) | |
f.puts "[#{commit.committed_date.strftime("%m-%d-%y %I:%M%p")}] #{commit.committer} - #{commit.committer.email}" | |
f.puts "#{commit.message}" | |
f.puts "" | |
end | |
end | |
end | |
upload(rev_file,"#{release_path}/public/revision.txt") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment