capistrano-gitflow 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capistrano/gitflow/helpers/helper.rb +35 -27
- data/lib/capistrano/gitflow/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c54fba5ef0673153cfe0d7a6b5790340778aadcd
|
4
|
+
data.tar.gz: 38f43657a1748f1cc69fea51f7c9a408fb7d39c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f300ac8b6159ba4adbffa4070b67abc543a587b5f42967a4d3155512a158fb68108c9c30be0b2f066e97c38609bab6b90704179adecf7799f66564767655ae63
|
7
|
+
data.tar.gz: 2d6b81e3005e90c2c76e668652e24f6831fed33adf88ebd06a5092bd5d473fbdf8ed7180e7820c818ec71cd1c3b1b5410cade8ba685264f1cf1b36819d43547a
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module CapistranoGitFlow
|
2
2
|
module Helper
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
|
5
5
|
def gitflow_stage
|
6
6
|
original_stage = fetch(:stage)
|
7
7
|
original_stage.to_s.include?(":") ? original_stage.split(':').reverse[0] : original_stage
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def gitflow_using_cap3?
|
11
11
|
defined?(Capistrano::VERSION) && Capistrano::VERSION.to_s.split('.').first.to_i >= 3
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def gitflow_callbacks
|
15
15
|
if gitflow_using_cap3?
|
16
16
|
before "deploy", "gitflow:verify_up_to_date"
|
@@ -19,21 +19,27 @@ module CapistranoGitFlow
|
|
19
19
|
end
|
20
20
|
after "gitflow:verify_up_to_date", "gitflow:calculate_tag"
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def gitflow_find_task(name)
|
24
|
-
|
25
|
-
|
24
|
+
if defined?(::Rake)
|
25
|
+
puts "rake"
|
26
|
+
::Rake::Task[name]
|
27
|
+
else
|
28
|
+
puts "rake old"
|
29
|
+
exists?(name)
|
30
|
+
end
|
31
|
+
rescue
|
26
32
|
nil
|
27
33
|
end
|
28
|
-
|
34
|
+
|
29
35
|
def gitflow_execute_task(name)
|
30
36
|
defined?(::Rake) ? gitflow_find_task(name).invoke : find_and_execute_task(name)
|
31
37
|
end
|
32
|
-
|
38
|
+
|
33
39
|
def gitflow_capistrano_tag
|
34
40
|
defined?(capistrano_configuration) ? capistrano_configuration[:tag] : ENV['TAG']
|
35
41
|
end
|
36
|
-
|
42
|
+
|
37
43
|
def gitflow_last_tag_matching(pattern)
|
38
44
|
# search for most recent (chronologically) tag matching the passed pattern, then get the name of that tag.
|
39
45
|
last_tag = `git describe --exact-match --tags --match='#{pattern}' $(git log --tags='#{pattern}*' -n1 --pretty='%h')`.chomp
|
@@ -52,14 +58,14 @@ module CapistranoGitFlow
|
|
52
58
|
Capistrano::CLI.ui.ask("#{message}")
|
53
59
|
end
|
54
60
|
end
|
55
|
-
|
61
|
+
|
56
62
|
def gitflow_next_staging_tag
|
57
63
|
hwhen = Date.today.to_s
|
58
64
|
who = `whoami`.chomp.to_url
|
59
65
|
what = gitflow_ask_confirm("What does this release introduce? (this will be normalized and used in the tag for this release) ")
|
60
|
-
|
66
|
+
|
61
67
|
abort "No tag has been provided: #{what.inspect}" if what == ''
|
62
|
-
|
68
|
+
|
63
69
|
last_staging_tag = gitflow_last_tag_matching("staging-#{hwhen}-*")
|
64
70
|
new_tag_serial = if last_staging_tag && last_staging_tag =~ /staging-[0-9]{4}-[0-9]{2}-[0-9]{2}\-([0-9]*)/
|
65
71
|
$1.to_i + 1
|
@@ -77,8 +83,8 @@ module CapistranoGitFlow
|
|
77
83
|
def gitflow_using_git?
|
78
84
|
fetch(:scm, :git).to_sym == :git
|
79
85
|
end
|
80
|
-
|
81
|
-
|
86
|
+
|
87
|
+
|
82
88
|
def gitflow_verify_up_to_date
|
83
89
|
if gitflow_using_git?
|
84
90
|
set :local_branch, `git branch --no-color 2> /dev/null | sed -e '/^[^*]/d'`.gsub(/\* /, '').chomp
|
@@ -97,17 +103,19 @@ git push origin #{fetch(:local_branch)}
|
|
97
103
|
end
|
98
104
|
end
|
99
105
|
end
|
100
|
-
|
101
|
-
|
102
|
-
|
106
|
+
|
107
|
+
|
108
|
+
|
103
109
|
def gitflow_calculate_tag
|
104
110
|
if gitflow_using_git?
|
105
111
|
# make sure we have any other deployment tags that have been pushed by others so our auto-increment code doesn't create conflicting tags
|
106
112
|
`git fetch`
|
107
113
|
rake_task_name = "gitflow:tag_#{gitflow_stage}"
|
108
|
-
|
114
|
+
task_exists = gitflow_find_task(rake_task_name)
|
115
|
+
if !task_exists.nil? && task_exists!= false
|
116
|
+
|
109
117
|
gitflow_execute_task(rake_task_name)
|
110
|
-
|
118
|
+
|
111
119
|
system "git push --tags origin #{fetch(:local_branch)}"
|
112
120
|
if $? != 0
|
113
121
|
abort "git push failed"
|
@@ -118,7 +126,7 @@ git push origin #{fetch(:local_branch)}
|
|
118
126
|
end
|
119
127
|
end
|
120
128
|
end
|
121
|
-
|
129
|
+
|
122
130
|
def gitflow_commit_log
|
123
131
|
from_tag = if gitflow_stage.to_s == 'production'
|
124
132
|
gitflow_last_production_tag
|
@@ -140,7 +148,7 @@ git push origin #{fetch(:local_branch)}
|
|
140
148
|
abort "Unsupported stage #{gitflow_stage}"
|
141
149
|
end
|
142
150
|
end
|
143
|
-
|
151
|
+
|
144
152
|
|
145
153
|
|
146
154
|
# use custom compare command if set
|
@@ -160,8 +168,8 @@ git push origin #{fetch(:local_branch)}
|
|
160
168
|
|
161
169
|
puts ""
|
162
170
|
end
|
163
|
-
|
164
|
-
|
171
|
+
|
172
|
+
|
165
173
|
def gitflow_tag_staging
|
166
174
|
current_sha = `git log --pretty=format:%H HEAD -1`
|
167
175
|
last_staging_tag_sha = if gitflow_last_staging_tag
|
@@ -179,8 +187,8 @@ git push origin #{fetch(:local_branch)}
|
|
179
187
|
|
180
188
|
set :branch, new_staging_tag
|
181
189
|
end
|
182
|
-
|
183
|
-
|
190
|
+
|
191
|
+
|
184
192
|
def gitflow_tag_production
|
185
193
|
promote_to_production_tag = gitflow_capistrano_tag || gitflow_last_staging_tag
|
186
194
|
|
@@ -213,6 +221,6 @@ git push origin #{fetch(:local_branch)}
|
|
213
221
|
|
214
222
|
set :branch, new_production_tag
|
215
223
|
end
|
216
|
-
|
224
|
+
|
217
225
|
end
|
218
226
|
end
|