capistrano-deploy-tagger 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/capistrano/deploy/tagger.rb +27 -22
  2. metadata +4 -4
@@ -15,9 +15,12 @@ Capistrano::Configuration.instance(:must_exist).load do
15
15
  desc "Manage git tags to indicate current deployed codebase, and keep a history of the most recent deploys."
16
16
 
17
17
  task :tag do
18
-
19
- update_tag = fetch(:update_deploy_tags) rescue true
20
- tag_name = fetch(:latest_deploy_tag) rescue "inproduction"
18
+ update_tag = fetch(:update_deploy_tags) rescue true
19
+ update_timestamp = fetch(:update_deploy_timestamp_tags) rescue true
20
+
21
+ tag_name = fetch(:latest_deploy_tag) rescue "inproduction"
22
+ deploy_timestamp_tag_prefix = fetch(:latest_deploy_timestamp_tag_prefix) rescue "deploy"
23
+
21
24
  # keep_deploy_tags = fetch(:keep_deploy_tags) rescue 10
22
25
  current_branch = fetch(:branch)
23
26
 
@@ -32,25 +35,27 @@ Capistrano::Configuration.instance(:must_exist).load do
32
35
 
33
36
  git "fetch --tags", {:output => true}
34
37
 
35
- # Remove any existing deploy-branch-date tags first - this is in case of multiple deploys of the same revision,
36
- # we don't want multiple copies of those tags to start stacking up on the same revision.
37
- # git("tag -l --contains #{revision} deploy-#{current_branch}-*", {:output => true}).to_a.each do |tag|
38
- # git "tag -d #{tag}"
39
- # git "push origin :#{tag}"
40
- # end
41
-
42
- # Create a tag for the current deploy with time and date, we'll keep a few of these for history.
43
- deploy_tag_string = Time.now.strftime("deploy-%Y%m%d-%H%M-%S")
44
- git "tag #{deploy_tag_string} #{revision} -m \"Deployment by #{user} <#{email}>.\""
45
-
46
- # Remove older deploy tags, ensuring we keep at least ':keep_deploy_tags' of the more recent deploy tags.
47
- # expired_deploy_tags = git("tag -l deploy-#{current_branch}-*", {:output => true}).to_a
48
- # expired_deploy_tags.pop(keep_deploy_tags)
49
-
50
- # expired_deploy_tags.each do |tag|
51
- # git "tag -d #{tag}"
52
- # git "push origin :#{tag}"
53
- # end
38
+ if update_timestamp
39
+ # Remove any existing deploy-branch-date tags first - this is in case of multiple deploys of the same revision,
40
+ # we don't want multiple copies of those tags to start stacking up on the same revision.
41
+ # git("tag -l --contains #{revision} deploy-#{current_branch}-*", {:output => true}).to_a.each do |tag|
42
+ # git "tag -d #{tag}"
43
+ # git "push origin :#{tag}"
44
+ # end
45
+
46
+ # Create a tag for the current deploy with time and date, we'll keep a few of these for history.
47
+ deploy_tag_string = "#{deploy_timestamp_tag_prefix}-#{Time.now.strftime("%Y%m%d-%H%M-%S")}"
48
+ git "tag #{deploy_tag_string} #{revision} -m \"Deployment by #{user} <#{email}>.\""
49
+
50
+ # Remove older deploy tags, ensuring we keep at least ':keep_deploy_tags' of the more recent deploy tags.
51
+ # expired_deploy_tags = git("tag -l deploy-#{current_branch}-*", {:output => true}).to_a
52
+ # expired_deploy_tags.pop(keep_deploy_tags)
53
+
54
+ # expired_deploy_tags.each do |tag|
55
+ # git "tag -d #{tag}"
56
+ # git "push origin :#{tag}"
57
+ # end
58
+ end
54
59
 
55
60
  # Remove an existing 'latest_deploy_tag' tag, then recreate it at the current revision.
56
61
  if git("tag -l #{tag_name}", {:output => true}) == tag_name
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-deploy-tagger
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
+ - 1
8
9
  - 0
9
- - 3
10
- version: 2.0.3
10
+ version: 2.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Conway
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-09-05 00:00:00 Z
18
+ date: 2013-09-16 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: capistrano