istox 0.1.152.1 → 0.1.152.2
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/bulk-update-version.py +93 -0
- data/lib/istox/helpers/publisher.rb +13 -1
- data/lib/istox/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98405f323d3016566581224e870b8ea1d1056d60087152b5006057c80a27887d
|
4
|
+
data.tar.gz: c8671f124d402c4b8ecae516e993d34f3e0ab7a1e8085cd1144671ff83ef2211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a481fab47d1c5a40edd99f43eda4a4273b02c92f1908338a5e8c81e00cc9e3ea39df4b8213b6a896dc60d69f961ad38f2cdb54ab89efbfb3260d7cc9bdc85e11
|
7
|
+
data.tar.gz: c5fbb241ab645cd2e7ca70ff9ba8a12e2a6c27166ec192c5d15b1be513f59d7d0111e1cd5744470825746dc25de7cbde15f90bb65de2eb44a12c5e203bbdd9e3
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import sys
|
2
|
+
import re
|
3
|
+
from tempfile import mkstemp
|
4
|
+
from shutil import move, copymode
|
5
|
+
from os import fdopen, remove
|
6
|
+
import os
|
7
|
+
|
8
|
+
# HOW TO RUN: python bulk-update-version.py <version updating to, eg. 0.1.150.2>
|
9
|
+
|
10
|
+
SERVICES = ["client-api", "admin-api", "message-api", "auth", "admin-auth"]
|
11
|
+
|
12
|
+
|
13
|
+
def replace(file_path, pattern, subst):
|
14
|
+
# Create temp file
|
15
|
+
fh, abs_path = mkstemp()
|
16
|
+
with fdopen(fh, 'w') as new_file:
|
17
|
+
dirname = os.path.dirname(__file__)
|
18
|
+
file_path = os.path.join(dirname, file_path)
|
19
|
+
if os.path.exists(file_path) == False:
|
20
|
+
return
|
21
|
+
with open(file_path) as old_file:
|
22
|
+
for line in old_file:
|
23
|
+
new_file.write(re.sub(pattern, subst, line))
|
24
|
+
# Copy the file permissions from the old file to the new file
|
25
|
+
copymode(file_path, abs_path)
|
26
|
+
# Remove original file
|
27
|
+
remove(file_path)
|
28
|
+
# Move new file
|
29
|
+
move(abs_path, file_path)
|
30
|
+
|
31
|
+
|
32
|
+
def push_service(file_path, version, hotfix):
|
33
|
+
dirname = os.path.dirname(__file__)
|
34
|
+
file_path = os.path.join(dirname, file_path)
|
35
|
+
|
36
|
+
if os.path.exists(file_path) == False:
|
37
|
+
return
|
38
|
+
|
39
|
+
if hotfix == True:
|
40
|
+
branch_name = "hotfix"
|
41
|
+
else:
|
42
|
+
branch_name = "FIX/update-istox-gem-" + version
|
43
|
+
|
44
|
+
os.chdir(file_path)
|
45
|
+
os.system(
|
46
|
+
"git branch -D %s &>/dev/null" % (branch_name))
|
47
|
+
os.system("echo 'Deleted local branch'")
|
48
|
+
os.system(
|
49
|
+
"git push origin --delete %s &>/dev/null" % (branch_name))
|
50
|
+
os.system("echo 'Deleted remote branch'")
|
51
|
+
os.system("git fetch -a")
|
52
|
+
os.system("git checkout -b %s" % (branch_name))
|
53
|
+
os.system("git add Gemfile")
|
54
|
+
os.system("git commit -m 'Update istox-gem version to %s'" % (version))
|
55
|
+
os.system("git push --set-upstream origin %s" % (branch_name))
|
56
|
+
# os.system("cd " + file_path + " && git branch -D " +
|
57
|
+
# branch_name + " &>/dev/null || echo 'Deleted local branch' || git push origin --delete hotfix &>/dev/null || echo 'Deleted remote branch' || git fetch -a || git checkout -b " +
|
58
|
+
# branch_name + " && git add Gemfile && git commit -m 'Update istox-gem version to "
|
59
|
+
# + version + "' && git push --set-upstream origin " + branch_name)
|
60
|
+
|
61
|
+
|
62
|
+
arguments = sys.argv
|
63
|
+
arguments.pop(0)
|
64
|
+
|
65
|
+
new_version = arguments[0]
|
66
|
+
|
67
|
+
hotfix = False
|
68
|
+
|
69
|
+
while True:
|
70
|
+
result = raw_input("Is this a hotix? Y/N \n")
|
71
|
+
|
72
|
+
if result.lower() == 'y':
|
73
|
+
hotfix = True
|
74
|
+
break
|
75
|
+
elif result.lower() == 'n':
|
76
|
+
hotfix = False
|
77
|
+
break
|
78
|
+
else:
|
79
|
+
print("Please input only Y or N.")
|
80
|
+
|
81
|
+
|
82
|
+
print("Updating services " + str(SERVICES) +
|
83
|
+
" to istox-gem version " + new_version)
|
84
|
+
|
85
|
+
for service in SERVICES:
|
86
|
+
replace("../" + service + "/Gemfile", r"gem 'istox'.+",
|
87
|
+
"gem 'istox', '" + new_version + "'")
|
88
|
+
|
89
|
+
for service in SERVICES:
|
90
|
+
push_service("../" + service, new_version, hotfix)
|
91
|
+
|
92
|
+
print("Services " + str(SERVICES) +
|
93
|
+
" has been updated to istox-gem version " + new_version)
|
@@ -78,6 +78,9 @@ module Istox
|
|
78
78
|
@channel[t]['confirm-1'].close
|
79
79
|
@channel[t]['noconfirm'].close
|
80
80
|
@channel.delete t
|
81
|
+
|
82
|
+
# Remove exchange from @exchange
|
83
|
+
@exchanges.delete t
|
81
84
|
end
|
82
85
|
end
|
83
86
|
end.join
|
@@ -233,7 +236,16 @@ module Istox
|
|
233
236
|
sleep 1
|
234
237
|
do_publish(ex,options,message)
|
235
238
|
rescue => e
|
236
|
-
log.debug "Error happens: #{e}"
|
239
|
+
log.debug "Error happens: #{e.message}"
|
240
|
+
|
241
|
+
# If the error indicates that the channel is already closed
|
242
|
+
# then clear hash @channel and @exchange
|
243
|
+
if e.message.include? "cannot use a closed channel"
|
244
|
+
@channel.delete Thread.current.object_id
|
245
|
+
@exchanges.delete Thread.current.object_id
|
246
|
+
ex = exchange(eid)
|
247
|
+
do_publish(ex, options, message)
|
248
|
+
end
|
237
249
|
end
|
238
250
|
end
|
239
251
|
end
|
data/lib/istox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: istox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.152.
|
4
|
+
version: 0.1.152.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Siong Leng
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -427,6 +427,7 @@ files:
|
|
427
427
|
- Rakefile
|
428
428
|
- bin/console
|
429
429
|
- bin/setup
|
430
|
+
- bulk-update-version.py
|
430
431
|
- istox.gemspec
|
431
432
|
- lib/istox.rb
|
432
433
|
- lib/istox/constants/error.rb
|