alpha_omega 0.0.142 → 0.0.150
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/libexec/activate +150 -49
- data/libexec/build +150 -49
- data/libexec/bump +150 -49
- data/libexec/check +150 -49
- data/libexec/compare +150 -49
- data/libexec/config +150 -49
- data/libexec/debug +150 -49
- data/libexec/deploy +150 -49
- data/libexec/dist +150 -49
- data/libexec/dna +150 -49
- data/libexec/hosts +150 -49
- data/libexec/invoke +150 -49
- data/libexec/lock +150 -49
- data/libexec/migrate +150 -49
- data/libexec/plan +150 -49
- data/libexec/release +150 -49
- data/libexec/restart +150 -49
- data/libexec/rollback +150 -49
- data/libexec/shell +150 -49
- data/libexec/stage +150 -49
- data/libexec/unlock +150 -49
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.150
|
data/libexec/activate
CHANGED
@@ -1,5 +1,117 @@
|
|
1
1
|
#!/bin/bash -e
|
2
2
|
|
3
|
+
function bump_version {
|
4
|
+
ensure_clean_git_status
|
5
|
+
|
6
|
+
local_file=
|
7
|
+
if [[ -f VERSION || -L VERSION ]]; then
|
8
|
+
local_file=1
|
9
|
+
if [[ ! -e VERSION ]]; then
|
10
|
+
echo "ERROR: cannot write to VERSION file" 1>&2
|
11
|
+
exit 1
|
12
|
+
fi
|
13
|
+
fi
|
14
|
+
|
15
|
+
tmp_version=$(mktemp -t XXXXXXXXX)
|
16
|
+
if [[ -n $local_file ]]; then
|
17
|
+
cp VERSION $tmp_version
|
18
|
+
else
|
19
|
+
git tag | perl -ne 'm{^v(\d+)\.(\d+)\.(\d+)$} && printf("v%03d.%03d.%03d v%d.%d.%d\n",$1,$2,$3,$1,$2,$3)' | sort -r | head -1 | awk '{print $2}' > $tmp_version
|
20
|
+
fi
|
21
|
+
|
22
|
+
case "$1" in
|
23
|
+
patch|minor|major)
|
24
|
+
bump=$1; shift
|
25
|
+
set $(cat $tmp_version | sed 's#\.# #g')
|
26
|
+
case "$bump" in
|
27
|
+
patch)
|
28
|
+
echo "$1.$2.$(($3 + 1))"
|
29
|
+
;;
|
30
|
+
minor)
|
31
|
+
echo "$1.$(($2 + 1)).0"
|
32
|
+
;;
|
33
|
+
major)
|
34
|
+
echo "$(($1 + 1)).0.0"
|
35
|
+
;;
|
36
|
+
esac > $tmp_version
|
37
|
+
;;
|
38
|
+
*)
|
39
|
+
ver_new=$1; shift
|
40
|
+
set $(echo "$ver_new" | sed 's#\.# #g') 0
|
41
|
+
M=$1; shift
|
42
|
+
m=$1; shift
|
43
|
+
p=$1; shift
|
44
|
+
|
45
|
+
(echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
|
46
|
+
ver_new_same=$(cat $tmp_version)
|
47
|
+
|
48
|
+
if [[ $ver_new != $ver_new_same ]]; then
|
49
|
+
echo "ERROR: invalid version: $ver_new" 1>&2
|
50
|
+
exit 1
|
51
|
+
fi
|
52
|
+
;;
|
53
|
+
esac
|
54
|
+
|
55
|
+
ver_bumped=$(cat $tmp_version)
|
56
|
+
rm -f $tmp_version
|
57
|
+
ensure_git_tag_available "v$ver_bumped"
|
58
|
+
|
59
|
+
if [[ -n $local_file ]]; then
|
60
|
+
echo $ver_bumped > VERSION
|
61
|
+
git add VERSION
|
62
|
+
if [[ -f Gemfile ]]; then
|
63
|
+
bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
|
64
|
+
git add Gemfile.lock
|
65
|
+
fi
|
66
|
+
|
67
|
+
git commit -m "bump: $ver_bumped"
|
68
|
+
git push
|
69
|
+
fi
|
70
|
+
|
71
|
+
git_tag "v$ver_bumped"
|
72
|
+
echo $ver_bumped
|
73
|
+
}
|
74
|
+
|
75
|
+
function ensure_git_tag_available {
|
76
|
+
version=$1; shift
|
77
|
+
git fetch --tags
|
78
|
+
remote_sha=$(git ls-remote origin $version | awk '{print $1}')
|
79
|
+
if [[ -n $remote_sha ]]; then
|
80
|
+
echo "ERROR: already a remote tag $version, bump again" 1>&2
|
81
|
+
exit 1
|
82
|
+
fi
|
83
|
+
|
84
|
+
local_sha=$(git show-ref $version | awk '{print $1}')
|
85
|
+
if [[ -n $local_sha ]]; then
|
86
|
+
echo "ERROR: already a local tag $version" 1>&2
|
87
|
+
exit 1
|
88
|
+
fi
|
89
|
+
}
|
90
|
+
|
91
|
+
function git_tag {
|
92
|
+
local version=$1; shift
|
93
|
+
|
94
|
+
ensure_git_tag_available "$version"
|
95
|
+
|
96
|
+
git tag $version
|
97
|
+
git push origin tag $version
|
98
|
+
remote_sha=$(git ls-remote origin $version | awk '{print $1}')
|
99
|
+
local_sha=$(git show-ref $version | awk '{print $1}')
|
100
|
+
if [[ $remote_sha != $local_sha ]]; then
|
101
|
+
echo "ERROR: remote tag $version does not match local SHA" 1>&2
|
102
|
+
exit 1
|
103
|
+
fi
|
104
|
+
}
|
105
|
+
|
106
|
+
function ensure_clean_git_status {
|
107
|
+
local lines=$(git status -s -uno | wc -l | awk '{print $1}')
|
108
|
+
if [[ $lines != "0" ]]; then
|
109
|
+
echo "ERROR: git status is not clean, cannot tag" 1>&2
|
110
|
+
git status -s -uno
|
111
|
+
exit 1
|
112
|
+
fi
|
113
|
+
}
|
114
|
+
|
3
115
|
case "$(basename $0)" in
|
4
116
|
bump)
|
5
117
|
true
|
@@ -73,54 +185,7 @@ case "$(basename $0)" in
|
|
73
185
|
;;
|
74
186
|
|
75
187
|
bump)
|
76
|
-
|
77
|
-
patch|minor|major)
|
78
|
-
bump=$1; shift
|
79
|
-
set $(cat VERSION | sed 's#\.# #g')
|
80
|
-
case "$bump" in
|
81
|
-
patch)
|
82
|
-
echo "$1.$2.$(($3 + 1))"
|
83
|
-
;;
|
84
|
-
minor)
|
85
|
-
echo "$1.$(($2 + 1)).0"
|
86
|
-
;;
|
87
|
-
major)
|
88
|
-
echo "$(($1 + 1)).0.0"
|
89
|
-
;;
|
90
|
-
esac > VERSION
|
91
|
-
;;
|
92
|
-
*)
|
93
|
-
ver_new=$1; shift
|
94
|
-
set $(echo "$ver_new" | sed 's#\.# #g') 0
|
95
|
-
M=$1; shift
|
96
|
-
m=$1; shift
|
97
|
-
p=$1; shift
|
98
|
-
|
99
|
-
tmp_version=$(mktemp -t XXXXXXXXX)
|
100
|
-
(echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
|
101
|
-
ver_new_same=$(cat $tmp_version)
|
102
|
-
rm -f $tmp_version
|
103
|
-
|
104
|
-
if [[ $ver_new = $ver_new_same ]]; then
|
105
|
-
echo "$ver_new" > VERSION
|
106
|
-
else
|
107
|
-
echo "ERROR: invalid version: $ver_new" 1>&2
|
108
|
-
exit 1
|
109
|
-
fi
|
110
|
-
;;
|
111
|
-
esac
|
112
|
-
|
113
|
-
if [[ -f Gemfile ]]; then
|
114
|
-
bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
|
115
|
-
git add Gemfile.lock
|
116
|
-
fi
|
117
|
-
|
118
|
-
git add VERSION
|
119
|
-
|
120
|
-
ver_bumped=$(cat VERSION)
|
121
|
-
git commit -m "bump: $ver_bumped"
|
122
|
-
git tag "v$ver_bumped"
|
123
|
-
echo $ver_bumped
|
188
|
+
bump_version "$@"
|
124
189
|
;;
|
125
190
|
|
126
191
|
*)
|
@@ -190,7 +255,43 @@ case "$(basename $0)" in
|
|
190
255
|
;;
|
191
256
|
|
192
257
|
migrate)
|
193
|
-
|
258
|
+
want_list=
|
259
|
+
if [[ $1 = "list" ]]; then
|
260
|
+
want_list=1; shift
|
261
|
+
fi
|
262
|
+
|
263
|
+
change_group=
|
264
|
+
migration=
|
265
|
+
case $1 in
|
266
|
+
data)
|
267
|
+
change_group=$1; shift
|
268
|
+
;;
|
269
|
+
pre)
|
270
|
+
change_group=$1; shift
|
271
|
+
;;
|
272
|
+
during)
|
273
|
+
change_group=$1; shift
|
274
|
+
;;
|
275
|
+
post)
|
276
|
+
change_group=$1; shift
|
277
|
+
;;
|
278
|
+
[0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789])
|
279
|
+
migration=$1; shift
|
280
|
+
;;
|
281
|
+
esac
|
282
|
+
|
283
|
+
if [[ -n $change_group ]]; then
|
284
|
+
if [[ -n $want_list ]]; then
|
285
|
+
echo "listing change group $change_group"
|
286
|
+
else
|
287
|
+
echo "running change group $change_group"
|
288
|
+
fi
|
289
|
+
elif [[ -n $migration ]]; then
|
290
|
+
echo "running migration $migratio"
|
291
|
+
elif [[ -n $want_list ]]; then
|
292
|
+
echo "listing migrations"
|
293
|
+
fi
|
294
|
+
#bundle exec cap "$@" deploy:migrate
|
194
295
|
;;
|
195
296
|
|
196
297
|
*)
|
data/libexec/build
CHANGED
@@ -1,5 +1,117 @@
|
|
1
1
|
#!/bin/bash -e
|
2
2
|
|
3
|
+
function bump_version {
|
4
|
+
ensure_clean_git_status
|
5
|
+
|
6
|
+
local_file=
|
7
|
+
if [[ -f VERSION || -L VERSION ]]; then
|
8
|
+
local_file=1
|
9
|
+
if [[ ! -e VERSION ]]; then
|
10
|
+
echo "ERROR: cannot write to VERSION file" 1>&2
|
11
|
+
exit 1
|
12
|
+
fi
|
13
|
+
fi
|
14
|
+
|
15
|
+
tmp_version=$(mktemp -t XXXXXXXXX)
|
16
|
+
if [[ -n $local_file ]]; then
|
17
|
+
cp VERSION $tmp_version
|
18
|
+
else
|
19
|
+
git tag | perl -ne 'm{^v(\d+)\.(\d+)\.(\d+)$} && printf("v%03d.%03d.%03d v%d.%d.%d\n",$1,$2,$3,$1,$2,$3)' | sort -r | head -1 | awk '{print $2}' > $tmp_version
|
20
|
+
fi
|
21
|
+
|
22
|
+
case "$1" in
|
23
|
+
patch|minor|major)
|
24
|
+
bump=$1; shift
|
25
|
+
set $(cat $tmp_version | sed 's#\.# #g')
|
26
|
+
case "$bump" in
|
27
|
+
patch)
|
28
|
+
echo "$1.$2.$(($3 + 1))"
|
29
|
+
;;
|
30
|
+
minor)
|
31
|
+
echo "$1.$(($2 + 1)).0"
|
32
|
+
;;
|
33
|
+
major)
|
34
|
+
echo "$(($1 + 1)).0.0"
|
35
|
+
;;
|
36
|
+
esac > $tmp_version
|
37
|
+
;;
|
38
|
+
*)
|
39
|
+
ver_new=$1; shift
|
40
|
+
set $(echo "$ver_new" | sed 's#\.# #g') 0
|
41
|
+
M=$1; shift
|
42
|
+
m=$1; shift
|
43
|
+
p=$1; shift
|
44
|
+
|
45
|
+
(echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
|
46
|
+
ver_new_same=$(cat $tmp_version)
|
47
|
+
|
48
|
+
if [[ $ver_new != $ver_new_same ]]; then
|
49
|
+
echo "ERROR: invalid version: $ver_new" 1>&2
|
50
|
+
exit 1
|
51
|
+
fi
|
52
|
+
;;
|
53
|
+
esac
|
54
|
+
|
55
|
+
ver_bumped=$(cat $tmp_version)
|
56
|
+
rm -f $tmp_version
|
57
|
+
ensure_git_tag_available "v$ver_bumped"
|
58
|
+
|
59
|
+
if [[ -n $local_file ]]; then
|
60
|
+
echo $ver_bumped > VERSION
|
61
|
+
git add VERSION
|
62
|
+
if [[ -f Gemfile ]]; then
|
63
|
+
bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
|
64
|
+
git add Gemfile.lock
|
65
|
+
fi
|
66
|
+
|
67
|
+
git commit -m "bump: $ver_bumped"
|
68
|
+
git push
|
69
|
+
fi
|
70
|
+
|
71
|
+
git_tag "v$ver_bumped"
|
72
|
+
echo $ver_bumped
|
73
|
+
}
|
74
|
+
|
75
|
+
function ensure_git_tag_available {
|
76
|
+
version=$1; shift
|
77
|
+
git fetch --tags
|
78
|
+
remote_sha=$(git ls-remote origin $version | awk '{print $1}')
|
79
|
+
if [[ -n $remote_sha ]]; then
|
80
|
+
echo "ERROR: already a remote tag $version, bump again" 1>&2
|
81
|
+
exit 1
|
82
|
+
fi
|
83
|
+
|
84
|
+
local_sha=$(git show-ref $version | awk '{print $1}')
|
85
|
+
if [[ -n $local_sha ]]; then
|
86
|
+
echo "ERROR: already a local tag $version" 1>&2
|
87
|
+
exit 1
|
88
|
+
fi
|
89
|
+
}
|
90
|
+
|
91
|
+
function git_tag {
|
92
|
+
local version=$1; shift
|
93
|
+
|
94
|
+
ensure_git_tag_available "$version"
|
95
|
+
|
96
|
+
git tag $version
|
97
|
+
git push origin tag $version
|
98
|
+
remote_sha=$(git ls-remote origin $version | awk '{print $1}')
|
99
|
+
local_sha=$(git show-ref $version | awk '{print $1}')
|
100
|
+
if [[ $remote_sha != $local_sha ]]; then
|
101
|
+
echo "ERROR: remote tag $version does not match local SHA" 1>&2
|
102
|
+
exit 1
|
103
|
+
fi
|
104
|
+
}
|
105
|
+
|
106
|
+
function ensure_clean_git_status {
|
107
|
+
local lines=$(git status -s -uno | wc -l | awk '{print $1}')
|
108
|
+
if [[ $lines != "0" ]]; then
|
109
|
+
echo "ERROR: git status is not clean, cannot tag" 1>&2
|
110
|
+
git status -s -uno
|
111
|
+
exit 1
|
112
|
+
fi
|
113
|
+
}
|
114
|
+
|
3
115
|
case "$(basename $0)" in
|
4
116
|
bump)
|
5
117
|
true
|
@@ -73,54 +185,7 @@ case "$(basename $0)" in
|
|
73
185
|
;;
|
74
186
|
|
75
187
|
bump)
|
76
|
-
|
77
|
-
patch|minor|major)
|
78
|
-
bump=$1; shift
|
79
|
-
set $(cat VERSION | sed 's#\.# #g')
|
80
|
-
case "$bump" in
|
81
|
-
patch)
|
82
|
-
echo "$1.$2.$(($3 + 1))"
|
83
|
-
;;
|
84
|
-
minor)
|
85
|
-
echo "$1.$(($2 + 1)).0"
|
86
|
-
;;
|
87
|
-
major)
|
88
|
-
echo "$(($1 + 1)).0.0"
|
89
|
-
;;
|
90
|
-
esac > VERSION
|
91
|
-
;;
|
92
|
-
*)
|
93
|
-
ver_new=$1; shift
|
94
|
-
set $(echo "$ver_new" | sed 's#\.# #g') 0
|
95
|
-
M=$1; shift
|
96
|
-
m=$1; shift
|
97
|
-
p=$1; shift
|
98
|
-
|
99
|
-
tmp_version=$(mktemp -t XXXXXXXXX)
|
100
|
-
(echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
|
101
|
-
ver_new_same=$(cat $tmp_version)
|
102
|
-
rm -f $tmp_version
|
103
|
-
|
104
|
-
if [[ $ver_new = $ver_new_same ]]; then
|
105
|
-
echo "$ver_new" > VERSION
|
106
|
-
else
|
107
|
-
echo "ERROR: invalid version: $ver_new" 1>&2
|
108
|
-
exit 1
|
109
|
-
fi
|
110
|
-
;;
|
111
|
-
esac
|
112
|
-
|
113
|
-
if [[ -f Gemfile ]]; then
|
114
|
-
bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
|
115
|
-
git add Gemfile.lock
|
116
|
-
fi
|
117
|
-
|
118
|
-
git add VERSION
|
119
|
-
|
120
|
-
ver_bumped=$(cat VERSION)
|
121
|
-
git commit -m "bump: $ver_bumped"
|
122
|
-
git tag "v$ver_bumped"
|
123
|
-
echo $ver_bumped
|
188
|
+
bump_version "$@"
|
124
189
|
;;
|
125
190
|
|
126
191
|
*)
|
@@ -190,7 +255,43 @@ case "$(basename $0)" in
|
|
190
255
|
;;
|
191
256
|
|
192
257
|
migrate)
|
193
|
-
|
258
|
+
want_list=
|
259
|
+
if [[ $1 = "list" ]]; then
|
260
|
+
want_list=1; shift
|
261
|
+
fi
|
262
|
+
|
263
|
+
change_group=
|
264
|
+
migration=
|
265
|
+
case $1 in
|
266
|
+
data)
|
267
|
+
change_group=$1; shift
|
268
|
+
;;
|
269
|
+
pre)
|
270
|
+
change_group=$1; shift
|
271
|
+
;;
|
272
|
+
during)
|
273
|
+
change_group=$1; shift
|
274
|
+
;;
|
275
|
+
post)
|
276
|
+
change_group=$1; shift
|
277
|
+
;;
|
278
|
+
[0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789])
|
279
|
+
migration=$1; shift
|
280
|
+
;;
|
281
|
+
esac
|
282
|
+
|
283
|
+
if [[ -n $change_group ]]; then
|
284
|
+
if [[ -n $want_list ]]; then
|
285
|
+
echo "listing change group $change_group"
|
286
|
+
else
|
287
|
+
echo "running change group $change_group"
|
288
|
+
fi
|
289
|
+
elif [[ -n $migration ]]; then
|
290
|
+
echo "running migration $migratio"
|
291
|
+
elif [[ -n $want_list ]]; then
|
292
|
+
echo "listing migrations"
|
293
|
+
fi
|
294
|
+
#bundle exec cap "$@" deploy:migrate
|
194
295
|
;;
|
195
296
|
|
196
297
|
*)
|
data/libexec/bump
CHANGED
@@ -1,5 +1,117 @@
|
|
1
1
|
#!/bin/bash -e
|
2
2
|
|
3
|
+
function bump_version {
|
4
|
+
ensure_clean_git_status
|
5
|
+
|
6
|
+
local_file=
|
7
|
+
if [[ -f VERSION || -L VERSION ]]; then
|
8
|
+
local_file=1
|
9
|
+
if [[ ! -e VERSION ]]; then
|
10
|
+
echo "ERROR: cannot write to VERSION file" 1>&2
|
11
|
+
exit 1
|
12
|
+
fi
|
13
|
+
fi
|
14
|
+
|
15
|
+
tmp_version=$(mktemp -t XXXXXXXXX)
|
16
|
+
if [[ -n $local_file ]]; then
|
17
|
+
cp VERSION $tmp_version
|
18
|
+
else
|
19
|
+
git tag | perl -ne 'm{^v(\d+)\.(\d+)\.(\d+)$} && printf("v%03d.%03d.%03d v%d.%d.%d\n",$1,$2,$3,$1,$2,$3)' | sort -r | head -1 | awk '{print $2}' > $tmp_version
|
20
|
+
fi
|
21
|
+
|
22
|
+
case "$1" in
|
23
|
+
patch|minor|major)
|
24
|
+
bump=$1; shift
|
25
|
+
set $(cat $tmp_version | sed 's#\.# #g')
|
26
|
+
case "$bump" in
|
27
|
+
patch)
|
28
|
+
echo "$1.$2.$(($3 + 1))"
|
29
|
+
;;
|
30
|
+
minor)
|
31
|
+
echo "$1.$(($2 + 1)).0"
|
32
|
+
;;
|
33
|
+
major)
|
34
|
+
echo "$(($1 + 1)).0.0"
|
35
|
+
;;
|
36
|
+
esac > $tmp_version
|
37
|
+
;;
|
38
|
+
*)
|
39
|
+
ver_new=$1; shift
|
40
|
+
set $(echo "$ver_new" | sed 's#\.# #g') 0
|
41
|
+
M=$1; shift
|
42
|
+
m=$1; shift
|
43
|
+
p=$1; shift
|
44
|
+
|
45
|
+
(echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
|
46
|
+
ver_new_same=$(cat $tmp_version)
|
47
|
+
|
48
|
+
if [[ $ver_new != $ver_new_same ]]; then
|
49
|
+
echo "ERROR: invalid version: $ver_new" 1>&2
|
50
|
+
exit 1
|
51
|
+
fi
|
52
|
+
;;
|
53
|
+
esac
|
54
|
+
|
55
|
+
ver_bumped=$(cat $tmp_version)
|
56
|
+
rm -f $tmp_version
|
57
|
+
ensure_git_tag_available "v$ver_bumped"
|
58
|
+
|
59
|
+
if [[ -n $local_file ]]; then
|
60
|
+
echo $ver_bumped > VERSION
|
61
|
+
git add VERSION
|
62
|
+
if [[ -f Gemfile ]]; then
|
63
|
+
bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
|
64
|
+
git add Gemfile.lock
|
65
|
+
fi
|
66
|
+
|
67
|
+
git commit -m "bump: $ver_bumped"
|
68
|
+
git push
|
69
|
+
fi
|
70
|
+
|
71
|
+
git_tag "v$ver_bumped"
|
72
|
+
echo $ver_bumped
|
73
|
+
}
|
74
|
+
|
75
|
+
function ensure_git_tag_available {
|
76
|
+
version=$1; shift
|
77
|
+
git fetch --tags
|
78
|
+
remote_sha=$(git ls-remote origin $version | awk '{print $1}')
|
79
|
+
if [[ -n $remote_sha ]]; then
|
80
|
+
echo "ERROR: already a remote tag $version, bump again" 1>&2
|
81
|
+
exit 1
|
82
|
+
fi
|
83
|
+
|
84
|
+
local_sha=$(git show-ref $version | awk '{print $1}')
|
85
|
+
if [[ -n $local_sha ]]; then
|
86
|
+
echo "ERROR: already a local tag $version" 1>&2
|
87
|
+
exit 1
|
88
|
+
fi
|
89
|
+
}
|
90
|
+
|
91
|
+
function git_tag {
|
92
|
+
local version=$1; shift
|
93
|
+
|
94
|
+
ensure_git_tag_available "$version"
|
95
|
+
|
96
|
+
git tag $version
|
97
|
+
git push origin tag $version
|
98
|
+
remote_sha=$(git ls-remote origin $version | awk '{print $1}')
|
99
|
+
local_sha=$(git show-ref $version | awk '{print $1}')
|
100
|
+
if [[ $remote_sha != $local_sha ]]; then
|
101
|
+
echo "ERROR: remote tag $version does not match local SHA" 1>&2
|
102
|
+
exit 1
|
103
|
+
fi
|
104
|
+
}
|
105
|
+
|
106
|
+
function ensure_clean_git_status {
|
107
|
+
local lines=$(git status -s -uno | wc -l | awk '{print $1}')
|
108
|
+
if [[ $lines != "0" ]]; then
|
109
|
+
echo "ERROR: git status is not clean, cannot tag" 1>&2
|
110
|
+
git status -s -uno
|
111
|
+
exit 1
|
112
|
+
fi
|
113
|
+
}
|
114
|
+
|
3
115
|
case "$(basename $0)" in
|
4
116
|
bump)
|
5
117
|
true
|
@@ -73,54 +185,7 @@ case "$(basename $0)" in
|
|
73
185
|
;;
|
74
186
|
|
75
187
|
bump)
|
76
|
-
|
77
|
-
patch|minor|major)
|
78
|
-
bump=$1; shift
|
79
|
-
set $(cat VERSION | sed 's#\.# #g')
|
80
|
-
case "$bump" in
|
81
|
-
patch)
|
82
|
-
echo "$1.$2.$(($3 + 1))"
|
83
|
-
;;
|
84
|
-
minor)
|
85
|
-
echo "$1.$(($2 + 1)).0"
|
86
|
-
;;
|
87
|
-
major)
|
88
|
-
echo "$(($1 + 1)).0.0"
|
89
|
-
;;
|
90
|
-
esac > VERSION
|
91
|
-
;;
|
92
|
-
*)
|
93
|
-
ver_new=$1; shift
|
94
|
-
set $(echo "$ver_new" | sed 's#\.# #g') 0
|
95
|
-
M=$1; shift
|
96
|
-
m=$1; shift
|
97
|
-
p=$1; shift
|
98
|
-
|
99
|
-
tmp_version=$(mktemp -t XXXXXXXXX)
|
100
|
-
(echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
|
101
|
-
ver_new_same=$(cat $tmp_version)
|
102
|
-
rm -f $tmp_version
|
103
|
-
|
104
|
-
if [[ $ver_new = $ver_new_same ]]; then
|
105
|
-
echo "$ver_new" > VERSION
|
106
|
-
else
|
107
|
-
echo "ERROR: invalid version: $ver_new" 1>&2
|
108
|
-
exit 1
|
109
|
-
fi
|
110
|
-
;;
|
111
|
-
esac
|
112
|
-
|
113
|
-
if [[ -f Gemfile ]]; then
|
114
|
-
bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
|
115
|
-
git add Gemfile.lock
|
116
|
-
fi
|
117
|
-
|
118
|
-
git add VERSION
|
119
|
-
|
120
|
-
ver_bumped=$(cat VERSION)
|
121
|
-
git commit -m "bump: $ver_bumped"
|
122
|
-
git tag "v$ver_bumped"
|
123
|
-
echo $ver_bumped
|
188
|
+
bump_version "$@"
|
124
189
|
;;
|
125
190
|
|
126
191
|
*)
|
@@ -190,7 +255,43 @@ case "$(basename $0)" in
|
|
190
255
|
;;
|
191
256
|
|
192
257
|
migrate)
|
193
|
-
|
258
|
+
want_list=
|
259
|
+
if [[ $1 = "list" ]]; then
|
260
|
+
want_list=1; shift
|
261
|
+
fi
|
262
|
+
|
263
|
+
change_group=
|
264
|
+
migration=
|
265
|
+
case $1 in
|
266
|
+
data)
|
267
|
+
change_group=$1; shift
|
268
|
+
;;
|
269
|
+
pre)
|
270
|
+
change_group=$1; shift
|
271
|
+
;;
|
272
|
+
during)
|
273
|
+
change_group=$1; shift
|
274
|
+
;;
|
275
|
+
post)
|
276
|
+
change_group=$1; shift
|
277
|
+
;;
|
278
|
+
[0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789])
|
279
|
+
migration=$1; shift
|
280
|
+
;;
|
281
|
+
esac
|
282
|
+
|
283
|
+
if [[ -n $change_group ]]; then
|
284
|
+
if [[ -n $want_list ]]; then
|
285
|
+
echo "listing change group $change_group"
|
286
|
+
else
|
287
|
+
echo "running change group $change_group"
|
288
|
+
fi
|
289
|
+
elif [[ -n $migration ]]; then
|
290
|
+
echo "running migration $migratio"
|
291
|
+
elif [[ -n $want_list ]]; then
|
292
|
+
echo "listing migrations"
|
293
|
+
fi
|
294
|
+
#bundle exec cap "$@" deploy:migrate
|
194
295
|
;;
|
195
296
|
|
196
297
|
*)
|