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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 747b9e284b653c5ec060ef2f97cd7cd868f2561334557eff4d847f669f1f8851
4
- data.tar.gz: f3475aed8b8f13c8b06572d67b2914f7828fde78cf58240981bb88e3cee8d623
3
+ metadata.gz: 98405f323d3016566581224e870b8ea1d1056d60087152b5006057c80a27887d
4
+ data.tar.gz: c8671f124d402c4b8ecae516e993d34f3e0ab7a1e8085cd1144671ff83ef2211
5
5
  SHA512:
6
- metadata.gz: a75a9a8ad205ae3c8f9e6ecbbeff41acc8cbcde4bbbf8fde457c8eb2139993240964e06c94d756444e4398758c750d9ee4ade74138d66b44d4567724cbc17590
7
- data.tar.gz: 19cfccb0159c8587c49ee8158e965142b48ce7ae94fcdf970dc811d0a7a4d088cb969d3b896d5f54b0cdb1035d854cfd28a0df3a9356b5ba7207824a69976187
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
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.1.152.1'.freeze
2
+ VERSION = '0.1.152.2'.freeze
3
3
  end
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.1
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-05-19 00:00:00.000000000 Z
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