capistrano-gitflow 1.5.5 → 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rdoc +13 -4
- data/lib/capistrano/gitflow/helpers/helper.rb +28 -7
- data/lib/capistrano/gitflow/version.rb +1 -1
- data/lib/capistrano/tasks/gitflow.rb +6 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4efd39dbc0cd6f84c60395a3f4aadd68e0e12fc
|
4
|
+
data.tar.gz: 780070274eda305cd847d7ff2c477910ad55955f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bb3b196c77f41f94c655c982d1fea1da8c55971496f635486fb57fbec4db91872b64a48f30506985b42acb3d09305b011ff4c86ec69152fa1f4b0b03ec7cd18
|
7
|
+
data.tar.gz: f70dfa30100aa35a6b692dac8de52038d7ff06d5f0321552c288eb5fbf317d6bf239d7eac9bf589ada4589985bdff6d2f8ececc4ae6458e427f25401edd85806
|
data/README.rdoc
CHANGED
@@ -8,7 +8,7 @@ Gitflow simply adds some tagging/logging/workflow magic.
|
|
8
8
|
$ cap production deploy # 'master' goes to production
|
9
9
|
|
10
10
|
# AFTER
|
11
|
-
$ cap deploy
|
11
|
+
$ cap deploy
|
12
12
|
# 'master' goes to staging; tag staging-YYYY-MM-DD.X created
|
13
13
|
|
14
14
|
$ cap production deploy
|
@@ -18,10 +18,10 @@ Gitflow simply adds some tagging/logging/workflow magic.
|
|
18
18
|
# tag 'production-YYYY-MM-DD-X' created; points to staging-YYYY-MM-DD-X
|
19
19
|
|
20
20
|
# BONUS
|
21
|
-
$ cap gitflow:commit_log
|
21
|
+
$ cap gitflow:commit_log
|
22
22
|
# displays a commit log pushed to staging
|
23
|
-
|
24
|
-
$ cap production gitflow:commit_log
|
23
|
+
|
24
|
+
$ cap production gitflow:commit_log
|
25
25
|
# displays a commit log of what will be pushed to production
|
26
26
|
|
27
27
|
== INSTALLATION
|
@@ -73,6 +73,15 @@ gitflow will automatically:
|
|
73
73
|
* push the code and tags to the remote "origin"
|
74
74
|
* and run the normal deploy task for the production stage.
|
75
75
|
|
76
|
+
=== CLEANING OLD TAGS:
|
77
|
+
Whenever you want to clean the old tags generated by this gem you can simply run this command.
|
78
|
+
|
79
|
+
cap <stage_name> gitflow:cleanup_tags
|
80
|
+
|
81
|
+
This will delete all tags that have this pattern [staging|production]{1}-[0-9]{4}-[0-9]{2}-[0-9]{2}\-([0-9]*)
|
82
|
+
The task will delete first the local tasks and then the remote tasks from your git repository.
|
83
|
+
For more details you can check here: https://github.com/technicalpickles/capistrano-gitflow/blob/master/lib/capistrano/gitflow/helpers/helper.rb#L219
|
84
|
+
|
76
85
|
=== NOTES:
|
77
86
|
|
78
87
|
* you may need to wipe out the cached-copy on the remote server that cap uses when switching to this workflow; I have seen situations where the cached copy cannot cleanly checkout to the new branch/tag. it's safe to try without wiping it out first, it will fail gracefully.
|
@@ -31,7 +31,7 @@ module CapistranoGitFlow
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def gitflow_capistrano_tag
|
34
|
-
|
34
|
+
defined?(capistrano_configuration) ? capistrano_configuration[:tag] : ENV['TAG']
|
35
35
|
end
|
36
36
|
|
37
37
|
def gitflow_last_tag_matching(pattern)
|
@@ -86,12 +86,12 @@ module CapistranoGitFlow
|
|
86
86
|
set :origin_sha, `git log --pretty=format:%H #{fetch(:local_branch)} -1`
|
87
87
|
unless fetch(:local_sha) == fetch(:origin_sha)
|
88
88
|
abort """
|
89
|
-
Your #{fetch(:local_branch)} branch is not up to date with origin/#{fetch(:local_branch)}.
|
90
|
-
Please make sure you have pulled and pushed all code before deploying:
|
89
|
+
Your #{fetch(:local_branch)} branch is not up to date with origin/#{fetch(:local_branch)}.
|
90
|
+
Please make sure you have pulled and pushed all code before deploying:
|
91
91
|
|
92
|
-
git pull origin #{fetch(:local_branch)}
|
93
|
-
# run tests, etc
|
94
|
-
git push origin #{fetch(:local_branch)}
|
92
|
+
git pull origin #{fetch(:local_branch)}
|
93
|
+
# run tests, etc
|
94
|
+
git push origin #{fetch(:local_branch)}
|
95
95
|
|
96
96
|
"""
|
97
97
|
end
|
@@ -108,7 +108,7 @@ git push origin #{fetch(:local_branch)}
|
|
108
108
|
task_exists = gitflow_find_task(rake_task_name)
|
109
109
|
if !task_exists.nil? && task_exists!= false
|
110
110
|
|
111
|
-
|
111
|
+
gitflow_execute_task(rake_task_name)
|
112
112
|
|
113
113
|
system "git push --tags origin #{fetch(:local_branch)}"
|
114
114
|
if $? != 0
|
@@ -216,5 +216,26 @@ git push origin #{fetch(:local_branch)}
|
|
216
216
|
set :branch, new_production_tag
|
217
217
|
end
|
218
218
|
|
219
|
+
def gitflow_cleanup_tags
|
220
|
+
return if fetch(:gitflow_keep_tags).nil?
|
221
|
+
tags = `git log --tags --pretty="format:%at %D" | grep 'tag:' |sort -n | awk '{$1=""; print $0}' | tr "," "\n"| sed 's/tag:*//' | sed -e 's/^[ \t]*//'`
|
222
|
+
tags = tags.split.reject{|tag| tag.blank? }
|
223
|
+
tags = tags.select { |tag| tag =~ /^(staging|production){1}-[0-9]{4}-[0-9]{2}-[0-9]{2}\-([0-9]*)/ }
|
224
|
+
if tags.count >= fetch(:gitflow_keep_tags)
|
225
|
+
puts "Keeping #{fetch(:gitflow_keep_tags)} Tags from total #{tags.count}"
|
226
|
+
tags_to_delete = (tags - tags.last(fetch(:gitflow_keep_tags)))
|
227
|
+
if tags_to_delete.any?
|
228
|
+
system "git tag -d #{tags_to_delete.join(' ')}"
|
229
|
+
tags_with_dots = tags_to_delete.map{ |tag| tag.prepend(':refs/tags/') }.join(' ')
|
230
|
+
system "git push origin #{tags_with_dots}"
|
231
|
+
else
|
232
|
+
puts "No tags to delete"
|
233
|
+
end
|
234
|
+
else
|
235
|
+
puts "No tags to delete"
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|
239
|
+
|
219
240
|
end
|
220
241
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
namespace :gitflow do
|
3
|
-
|
3
|
+
|
4
4
|
task :verify_up_to_date do
|
5
5
|
gitflow_verify_up_to_date
|
6
6
|
end
|
@@ -25,7 +25,11 @@ namespace :gitflow do
|
|
25
25
|
gitflow_tag_production
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
task :cleanup_tags do
|
29
|
+
gitflow_cleanup_tags
|
30
|
+
end
|
31
|
+
|
32
|
+
gitflow_callbacks
|
29
33
|
end
|
30
34
|
|
31
35
|
namespace :deploy do
|
@@ -35,4 +39,3 @@ namespace :deploy do
|
|
35
39
|
end
|
36
40
|
end
|
37
41
|
end
|
38
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-gitflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Nichols
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.6.3
|
97
97
|
signing_key:
|
98
98
|
specification_version: 3
|
99
99
|
summary: Capistrano recipe for a deployment workflow based on git tags
|