diff --git a/README.md b/README.md index f76822a..72d531c 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Disabling Tagging for a Stage ----------------------------- Sometimes you do not want to enable deployment tagging for a particular stage. In that event, you can simply disable tagging by setting `no_deploytags` -lik so: +like so: ```ruby set :no_deploytags, true @@ -86,6 +86,15 @@ are hooked to the Capistrano Deploytags tasks will also still run, but they may find their expectations are not met with regards to the cleanliness of the git tree. +Customizing the Tag Format +-------------------------- +You may override the time format in `config/deploy.rb`: + +```ruby +set :deploytag_time_format, "%Y.%m.%d-%H%M%S-utc" +``` + + Viewing Deployment History -------------------------- It's trivial to view the deployment history for a repo. From a checkout diff --git a/lib/capistrano/deploy_tags.rb b/lib/capistrano/deploy_tags.rb index 515fdc4..0febdca 100644 --- a/lib/capistrano/deploy_tags.rb +++ b/lib/capistrano/deploy_tags.rb @@ -9,7 +9,11 @@ module Capistrano end def git_tag_for(stage) - "#{stage}-#{Time.new.utc.strftime('%Y.%m.%d-%H%M%S-utc')}" + "#{stage}-#{formatted_time}" + end + + def formatted_time + Time.new.utc.strftime(fetch(:deploytag_time_format, "%Y.%m.%d-%H%M%S-utc")) end def safe_run(*args)