lhj-tools 0.1.56 → 0.1.57

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: 0466ef4a511c15e68582056fcee41d1b1453d68eb79bc68610277314ed54fc8a
4
- data.tar.gz: caebb0fb1dcd50bbc8f5e841918e4ccf14d32ec8fb5261da7f7c0db546941c71
3
+ metadata.gz: bf0d16f649032902e604fa473c87bb216331af98a1b2ac6bc5789f4d071d2e06
4
+ data.tar.gz: 29092ea4c0149f8444745c4d739bf4ed14b2109252c575a2b297ed26e5af66dc
5
5
  SHA512:
6
- metadata.gz: 7ad62cffb4efe791a82c5f9385f6150acc3e819e7f53e1d884a20300b2c640f2a0944f6a3e21be4fc98fd38850b59ea5f4b0e54cf80b681cab595269e938e15f
7
- data.tar.gz: c1d31f95c7ca01eb66057d5ab40b22a7eab50e47ec498d64c476fd5729e3118be0cf566ff3a4bed935e6405ed4bf57bb1ca21103becfa1a9b6d71661aa9984f4
6
+ metadata.gz: a7a1b7631c050c2c06f250476db7126dbac04da145b8463f1790e1f94d08ead4128f238979c39fba0376467da02346c7dcd5f1488bd90e12514d5957f5d2322c
7
+ data.tar.gz: 46dbc87040a631fb6b2a031ded28bcb3a4826159f07162637ba1408a538465a20b127b000eae42592438df2d85a0e309fab7890c35e68b29aa14965a77cf141d
@@ -10,6 +10,9 @@ module Lhj
10
10
  @env = env
11
11
  @build_number = build_number
12
12
  @work_path = work_path
13
+
14
+ version_var_name = 'MARKETING_VERSION'
15
+ @version_regex = /^(?<begin>[^#]*#{version_var_name}\s*=\s*)(?<value>(?<major>[0-9]+)(\.(?<minor>[0-9]+))?(\.(?<patch>[0-9]+))?(?<appendix>(\.[0-9]+)*)?(-(?<prerelease>(.+)))?)(?<end>)/i
13
16
  setup_config
14
17
  end
15
18
 
@@ -31,13 +34,26 @@ module Lhj
31
34
  vers = []
32
35
  Dir.glob("#{@work_path}/*.xcodeproj/*.pbxproj").each do |file|
33
36
  File.readlines(file).each do |l|
34
- if /MARKETING_VERSION.*(\d+\.\d+\.\d+)/ =~ l
35
- ma = l.match(/(\d+\.\d+\.\d+)/)
36
- vers << ma[0]
37
- end
37
+ next unless /MARKETING_VERSION/ =~ l
38
+
39
+ version_match = @version_regex.match(l)
40
+ major = version_match[:major].to_i
41
+ minor = version_match[:minor].to_i || 0
42
+ patch = version_match[:patch].to_i || 0
43
+ vers << { value: version_match[:value], major: major, minor: minor, patch: patch }
38
44
  end
39
45
  end
40
- vers[0]
46
+ list = max_version(vers)
47
+ list.last[:value]
48
+ end
49
+
50
+ def max_version(list)
51
+ list.sort do |a, b|
52
+ ma = a[:major] <=> b[:major]
53
+ ma = a[:minor] <=> b[:minor] if ma.zero?
54
+ ma = a[:patch] <=> b[:patch] if ma.zero?
55
+ ma
56
+ end
41
57
  end
42
58
 
43
59
  def build_app_version_no
@@ -24,6 +24,8 @@ module Lhj
24
24
  config['gray_api_key']
25
25
  when :uat
26
26
  config['uat_api_key']
27
+ when :test
28
+ config['uat_api_key']
27
29
  else
28
30
  config['api_key']
29
31
  end
@@ -37,6 +39,8 @@ module Lhj
37
39
  config['gray_user_key']
38
40
  when :uat
39
41
  config['uat_user_key']
42
+ when :test
43
+ config['uat_user_key']
40
44
  else
41
45
  config['user_key']
42
46
  end
@@ -50,6 +54,8 @@ module Lhj
50
54
  config['gray_shortcut_url']
51
55
  when :uat
52
56
  config['uat_shortcut_url']
57
+ when :test
58
+ config['uat_shortcut_url']
53
59
  else
54
60
  config['shortcut_url']
55
61
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lhj
4
4
  module Tools
5
- VERSION = "0.1.56"
5
+ VERSION = "0.1.57"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhj-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.56
4
+ version: 0.1.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-18 00:00:00.000000000 Z
11
+ date: 2022-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide