Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
561331b263 | ||
|
|
57efd74341 | ||
|
|
5d31bd7df6 | ||
|
|
1a8635a98b | ||
|
|
1cff76230d | ||
|
|
eeb75048ba | ||
|
|
1ac8d2f9c4 | ||
|
|
36f2405a31 | ||
|
|
e9ba5e715c | ||
|
|
11eabe5b7c | ||
|
|
7eaf0a83f8 | ||
|
|
95b1cc15b9 | ||
|
|
9f9a0c3d6a | ||
|
|
536214fd03 | ||
|
|
964c57d21f | ||
|
|
675361e5d9 |
@@ -39,7 +39,7 @@ to the `development` group of your Gemfile with `require: false`:
|
||||
|
||||
```ruby
|
||||
# Gemfile
|
||||
group :deployment do
|
||||
group :development do
|
||||
gem 'capistrano-deploytags', '~> 1.0.0', require: false
|
||||
end
|
||||
```
|
||||
@@ -109,6 +109,12 @@ You may override the time format in `deploy.rb` or your stage:
|
||||
set :deploytag_time_format, "%Y.%m.%d-%H%M%S-utc"
|
||||
```
|
||||
|
||||
To use your local time and not UTC (so that ```Time.now``` and not ```Time.now.utc``` is used internally):
|
||||
|
||||
```ruby
|
||||
set :deploytag_utc, false
|
||||
```
|
||||
|
||||
### Customizing the Tag Commit Message
|
||||
|
||||
By default, Capistrano Deploytags will create a tag with a message that indicates
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
Gem::Specification.new do |s|
|
||||
s.name = 'capistrano-deploytags'
|
||||
s.version = '1.0.0'
|
||||
s.date = '2014-06-14'
|
||||
s.license = 'BSD-2-Clause'
|
||||
s.version = '1.0.4'
|
||||
s.date = '2015-10-18'
|
||||
s.summary = 'Add dated, environment-specific tags to your git repo at each deployment.'
|
||||
s.description = <<-EOS
|
||||
s.description = <<-EOS
|
||||
Capistrano Deploytags is a simple plugin to Capistrano 3 that works with your deployment framework to track your code releases. All you have to do is require capistrano-deploytags/capistrano and each deployment will add a new tag for that deployment, pointing to the latest commit. This lets you easily see which code is deployed on each environment, and allows you to figure out which code was running in an environment at any time in the past.
|
||||
EOS
|
||||
s.authors = ['Karl Matthias', 'Gavin Heavyside']
|
||||
|
||||
@@ -11,7 +11,13 @@ module CapistranoDeploytags
|
||||
end
|
||||
|
||||
def self.formatted_time
|
||||
Time.new.utc.strftime(fetch(:deploytag_time_format, "%Y.%m.%d-%H%M%S-utc"))
|
||||
now = if fetch(:deploytag_utc, true)
|
||||
Time.now.utc
|
||||
else
|
||||
Time.now
|
||||
end
|
||||
|
||||
now.strftime(fetch(:deploytag_time_format, "%Y.%m.%d-%H%M%S-#{now.zone.downcase}"))
|
||||
end
|
||||
|
||||
def self.commit_message(current_sha, stage)
|
||||
|
||||
@@ -35,12 +35,14 @@ namespace :deploy do
|
||||
if ENV['NO_DEPLOYTAGS'] || fetch(:no_deploytags, false)
|
||||
info "[deploytags] Skipping deploytags"
|
||||
else
|
||||
tag_name = CapistranoDeploytags::Helper.git_tag_for(fetch(:stage))
|
||||
tag_name = ENV['CUSTOM_DEPLOYTAG'] || fetch(:custom_deploytag) || CapistranoDeploytags::Helper.git_tag_for(fetch(:stage))
|
||||
latest_revision = fetch(:current_revision)
|
||||
commit_message = CapistranoDeploytags::Helper.commit_message(latest_revision, fetch(:stage))
|
||||
|
||||
strategy.git "tag -a #{tag_name} -m \"#{commit_message}\" #{latest_revision}"
|
||||
strategy.git "push #{fetch(:git_remote, 'origin')} #{tag_name}"
|
||||
unless fetch(:sshkit_backend) == SSHKit::Backend::Printer # unless --dry-run flag present
|
||||
strategy.git "tag -a #{tag_name} -m \"#{commit_message}\" #{latest_revision}"
|
||||
strategy.git "push #{fetch(:git_remote, 'origin')} #{tag_name}"
|
||||
end
|
||||
|
||||
info "[cap-deploy-tagger] Tagged #{latest_revision} with #{tag_name}"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user