21 Commits

Author SHA1 Message Date
Gavin Heavyside
6ef8f3ec46 Merge pull request #33 from vitalied/master
Update for Cap 3.7
2017-02-07 18:45:20 +00:00
Vitalie D
63b13affee Update for Cap 3.7 2017-02-07 18:48:48 +02:00
Gavin Heavyside
7ee61ce716 Bump version and date, pushed to rubygems 2017-01-06 09:04:38 +00:00
Karl Matthias
6156bbe4e5 Merge pull request #31 from simon-soak/patch-1
Undefined variable fix.
2016-08-04 13:08:21 +01:00
Simon hughes
4a3560b753 Undefined variable fix.
Missing fetch(: ).
2016-08-04 13:03:47 +01:00
Karl Matthias
561331b263 Merge pull request #30 from subodhkhanduri1/master
Bump patch version and date
2015-10-18 09:14:45 -07:00
Subodh Khanduri
57efd74341 Bump version and date 2015-10-18 20:48:37 +05:30
Gavin Heavyside
5d31bd7df6 Merge pull request #29 from subodhkhanduri1/master
Add support for custom tag name
2015-10-16 14:18:05 +01:00
Subodh Khanduri
1a8635a98b Add support for custom tag name 2015-10-16 17:58:29 +05:30
Gavin Heavyside
1cff76230d Merge pull request #28 from lacco/master
Update README
2015-08-04 10:24:28 +01:00
Kai Schlichting
eeb75048ba Use correct Gemfile group in README 2015-08-04 11:23:17 +02:00
Kai Schlichting
1ac8d2f9c4 Documentation for deploytag_utc 2015-08-04 11:23:17 +02:00
Gavin Heavyside
36f2405a31 Bump date 2015-05-11 14:45:22 +01:00
Gavin Heavyside
e9ba5e715c Bump version 2015-05-11 14:45:00 +01:00
Gavin Heavyside
11eabe5b7c Merge pull request #27 from dicksonlabs/respect_dry_run
don't create and push the tag when sshkit backend is SSHKit::Backend:::Printer
2015-05-11 14:44:03 +01:00
Ed Slocomb
7eaf0a83f8 don't create and push the tag when sshkit backend is SSHKit::Backend::Printer 2015-05-08 13:25:14 -07:00
Gavin Heavyside
95b1cc15b9 Update date of latest version... 2015-01-22 15:11:40 +00:00
Gavin Heavyside
9f9a0c3d6a Add license to gemspec 2015-01-22 15:09:00 +00:00
Gavin Heavyside
536214fd03 Bump patch version 2015-01-22 15:05:44 +00:00
Gavin Heavyside
964c57d21f Merge pull request #25 from matiaskorhonen/localtime
Make UTC optional
2014-10-23 12:34:04 +01:00
Matias Korhonen
675361e5d9 Makes UTC optional 2014-10-23 13:19:17 +03:00
4 changed files with 34 additions and 16 deletions

View File

@@ -8,10 +8,13 @@ but as Capistrano 3 is multistage by default (unlike Cap 2) :stage should
already be set, but you can override the variable if you want to change the
name of the tag.
### Requires Capistrano 3
### Requires Capistrano 3.7
As of version 1.0.0, this plugin requires Cap 3. If you need a Capistrano
2 compatible version, then use `gem 'capistrano-deploytags', '~> 0.9.2'`
As of version 1.0.7, this plugin requires Cap 3.7.
If you need a Capistrano < 3.7 compatible version, then use `gem 'capistrano-deploytags', '1.0.6'`
If you need a Capistrano 2 compatible version, then use `gem 'capistrano-deploytags', '~> 0.9.2'`
### What It Does
@@ -39,7 +42,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 +112,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

View File

@@ -1,16 +1,17 @@
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.7'
s.date = '2017-02-07'
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']
s.email = ['relistan@gmail.com', 'gavin.heavyside@mydrivesolutions.com']
s.files = `git ls-files lib`.split(/\n/) + %w{ README.md LICENSE }
s.homepage = 'http://github.com/mydrive/capistrano-deploytags'
s.add_dependency 'capistrano', '>= 3.2.0'
s.add_dependency 'capistrano', '>= 3.7.0'
# s.add_development_dependency 'capistrano-spec'
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec', '~> 3.0.0'

View File

@@ -11,12 +11,18 @@ 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)
if fetch(:deploytag_commit_message, false)
deploytag_commit_message
fetch(:deploytag_commit_message)
else
tag_user = (ENV['USER'] || ENV['USERNAME'] || 'deployer').strip
"#{tag_user} deployed #{current_sha} to #{stage}"

View File

@@ -13,7 +13,7 @@ namespace :deploy do
raise 'define :branch and :stage'
end
strategy.git "fetch #{fetch(:git_remote, 'origin')}"
execute :git, "fetch #{fetch(:git_remote, 'origin')}"
diff_output = capture :git, "diff #{branch} --shortstat"
@@ -22,9 +22,9 @@ namespace :deploy do
raise 'Dirty git tree'
end
strategy.git "checkout #{branch}"
execute :git, "checkout #{branch}"
info "Pulling from #{branch}"
strategy.git "pull #{fetch(:git_remote, 'origin')} #{branch}"
execute :git, "pull #{fetch(:git_remote, 'origin')} #{branch}"
end
end
end
@@ -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
execute :git, "tag -a #{tag_name} -m \"#{commit_message}\" #{latest_revision}"
execute :git, "push #{fetch(:git_remote, 'origin')} #{tag_name}"
end
info "[cap-deploy-tagger] Tagged #{latest_revision} with #{tag_name}"
end