lhj-tools 0.1.54 → 0.1.57

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba3c81ae4e0b59daafc45266b2b3fea814b1a15547eb0501b3e2bba19b167240
4
- data.tar.gz: 5c818f2bffe07c9e3f5ef50544f82ecc4303f2b020099ba0064cf93f12575723
3
+ metadata.gz: bf0d16f649032902e604fa473c87bb216331af98a1b2ac6bc5789f4d071d2e06
4
+ data.tar.gz: 29092ea4c0149f8444745c4d739bf4ed14b2109252c575a2b297ed26e5af66dc
5
5
  SHA512:
6
- metadata.gz: a87a98b3150d9763a7e41f153a3af6ef8291e7ae1074c8c12fd6f51fafc4ed36557605bb484d13d2b3ae5e9a58b0ffac69b95af951f15023bc1a90e06ddd78a5
7
- data.tar.gz: 20d3838363aa11ce08db7e18f5ff5efb24abcb627e2b3ab1b8c15c72bbf0d0555eda8d8a8742ddd892fda9ecbef387904480616173faccc011d57808bfe05ef5
6
+ metadata.gz: a7a1b7631c050c2c06f250476db7126dbac04da145b8463f1790e1f94d08ead4128f238979c39fba0376467da02346c7dcd5f1488bd90e12514d5957f5d2322c
7
+ data.tar.gz: 46dbc87040a631fb6b2a031ded28bcb3a4826159f07162637ba1408a538465a20b127b000eae42592438df2d85a0e309fab7890c35e68b29aa14965a77cf141d
@@ -1,5 +1,6 @@
1
1
  require_relative 'log_helper'
2
2
  require_relative 'pgyer_shortcut_helper'
3
+ require_relative 'team_member_config'
3
4
 
4
5
  module Lhj
5
6
  # version info
@@ -9,6 +10,18 @@ module Lhj
9
10
  @env = env
10
11
  @build_number = build_number
11
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
16
+ setup_config
17
+ end
18
+
19
+ def setup_config
20
+ number = build_app_version_no
21
+ Dir.chdir(@work_path) do
22
+ command = %(xcrun agvtool new-version -all #{number})
23
+ Actions.sh(command, log: false)
24
+ end
12
25
  end
13
26
 
14
27
  # build_app_version (build_app_version_no) (build: build_version)
@@ -21,13 +34,26 @@ module Lhj
21
34
  vers = []
22
35
  Dir.glob("#{@work_path}/*.xcodeproj/*.pbxproj").each do |file|
23
36
  File.readlines(file).each do |l|
24
- if /MARKETING_VERSION.*(\d+\.\d+\.\d+)/ =~ l
25
- ma = l.match(/(\d+\.\d+\.\d+)/)
26
- vers << ma[0]
27
- 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 }
28
44
  end
29
45
  end
30
- 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
31
57
  end
32
58
 
33
59
  def build_app_version_no
@@ -58,8 +84,20 @@ module Lhj
58
84
 
59
85
  def update_log
60
86
  Dir.chdir(@work_path) do
61
- Lhj::Actions.git_log_last_commits(' %an %ar - %s;', 3, :exclude_merges, 'short', false)
87
+ message = Lhj::Actions.git_log_last_commits(' %an %ar - %s;', 5, :exclude_merges, 'short', false)
88
+ handle_message(message)
89
+ end
90
+ end
91
+
92
+ def handle_message(m)
93
+ message = m
94
+ unless message.empty?
95
+ message = message.gsub('seconds ', '秒').gsub('minutes ', '分钟').gsub('hours ', '小时').gsub('weeks ', '周').gsub('days ', '天').gsub('ago ', '前')
96
+ Lhj::TeamMemberConfig.config.each do |key, value|
97
+ message = message.gsub(key, value) if message =~ /#{key}/
98
+ end
62
99
  end
100
+ message
63
101
  end
64
102
 
65
103
  end
@@ -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
@@ -64,11 +64,11 @@ module Lhj
64
64
  @result = response.body
65
65
  puts @result
66
66
  puts 'upload success'
67
- if @result['data'] && @result['data']['appUpdateDescription'] && @env == :uat
68
- str = Lhj::TbHelper.trans_tb(@result['data']['appUpdateDescription'])
69
- str = Lhj::VikaHelper.trans_vika(str)
70
- @result['data']['appUpdateDescription'] = str
71
- end
67
+ # if @result['data'] && @result['data']['appUpdateDescription'] && @env == :uat
68
+ # str = Lhj::TbHelper.trans_tb(@result['data']['appUpdateDescription'])
69
+ # str = Lhj::VikaHelper.trans_vika(str)
70
+ # @result['data']['appUpdateDescription'] = str
71
+ # end
72
72
  rescue Faraday::TimeoutError
73
73
  puts 'upload fail'
74
74
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lhj
4
4
  module Tools
5
- VERSION = "0.1.54"
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.54
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-15 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