lhj-tools 0.1.52 → 0.1.55

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: 52642dc28c1e253b4e66114c555044eea53f1348042f40287e3e266103ec44cd
4
- data.tar.gz: 2e57e34a865622c0471ceddbd182889272ec7bc1c2b171cb82c4456d423e1375
3
+ metadata.gz: b66a2c394691aa23ab4da26a83f5f9623e68c4355cb7f782916568f969a17b6d
4
+ data.tar.gz: 9b41f62a7770b26363f9db7b434f1e56b3fb3d72de4e5c78cd10f3f9478d5018
5
5
  SHA512:
6
- metadata.gz: cae2f12158dbed0c61a72abc83d17d4e59798a917e07df66bf9899a39316febac8a0a1afbc179265124c48fef6cbcf688e6140da4a1ae775d21cf2aa65dd2fa4
7
- data.tar.gz: 4aedf6a244a7a1628d9638b10851d3b3a4864a0841ac79d8574b18e404a1f38e1b4e584a4737e7a5bd3cd821e612264f97f2f1d95789b56b1921b51b23d3778f
6
+ metadata.gz: 5f1fcb3e75bf22881735c6e768d3c95cc0d506f89641edf52695565b700b7e7e92cebecaa7bef7a000f19279d487389597a1581b8e82e9146f5eb1e9ded789ee
7
+ data.tar.gz: 8b3900e23599f314e11205b488b0804e31e90f7080527c1f3635da9258ee1f13c8ee45b19e62657a7d9701edff2dc19b0fa2e657dbf137d9897a3c0d9cf01cb3
@@ -0,0 +1,75 @@
1
+ require_relative 'log_helper'
2
+ require_relative 'pgyer_shortcut_helper'
3
+
4
+ module Lhj
5
+ # version info
6
+ class AppVersionInfo
7
+ # @param [Symbol] env
8
+ def initialize(env, build_number, work_path)
9
+ @env = env
10
+ @build_number = build_number
11
+ @work_path = work_path
12
+ setup_config
13
+ end
14
+
15
+ def setup_config
16
+ number = build_app_version_no
17
+ Dir.chdir(@work_path) do
18
+ command = %(xcrun agvtool new-version -all #{number})
19
+ Actions.sh(command, log: false)
20
+ end
21
+ end
22
+
23
+ # build_app_version (build_app_version_no) (build: build_version)
24
+ def build_info
25
+ "#{build_app_version} (#{build_app_version_no}) (build: #{build_version})"
26
+ end
27
+
28
+ def build_app_version
29
+ # app version '1.0.0'
30
+ vers = []
31
+ Dir.glob("#{@work_path}/*.xcodeproj/*.pbxproj").each do |file|
32
+ File.readlines(file).each do |l|
33
+ if /MARKETING_VERSION.*(\d+\.\d+\.\d+)/ =~ l
34
+ ma = l.match(/(\d+\.\d+\.\d+)/)
35
+ vers << ma[0]
36
+ end
37
+ end
38
+ end
39
+ vers[0]
40
+ end
41
+
42
+ def build_app_version_no
43
+ # xcode build version
44
+ # ${BUILD_NUMBER} of jenkins
45
+ @build_number || '1'
46
+ end
47
+
48
+ def build_version
49
+ # pu gong ying build number
50
+ client = Lhj::PgyerShortcut.new(@env)
51
+ version = 0
52
+ version = client.build_version.to_i if client.build_version
53
+ version += 1
54
+ version.to_s
55
+ end
56
+
57
+ def build_updated
58
+ time = Time.now
59
+ time.strftime('%Y-%m-%d %H:%M:%S')
60
+ end
61
+
62
+ def branch_name
63
+ Dir.chdir(@work_path) do
64
+ Lhj::LogHelper.instance.current_branch(@work_path)
65
+ end
66
+ end
67
+
68
+ def update_log
69
+ Dir.chdir(@work_path) do
70
+ Lhj::Actions.git_log_last_commits(' %an %ar - %s;', 3, :exclude_merges, 'short', false)
71
+ end
72
+ end
73
+
74
+ end
75
+ 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.52"
5
+ VERSION = "0.1.55"
6
6
  end
7
7
  end
data/lib/lhj/tools.rb CHANGED
@@ -21,6 +21,7 @@ module Lhj
21
21
  require 'lhj/helper/git_helper'
22
22
  require 'lhj/helper/log_helper'
23
23
  require 'lhj/helper/vika_helper'
24
+ require 'lhj/helper/app_version_info'
24
25
 
25
26
  class Error < StandardError; end
26
27
 
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.52
4
+ version: 0.1.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-22 00:00:00.000000000 Z
11
+ date: 2022-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -335,6 +335,7 @@ files:
335
335
  - lib/lhj/command/yapi/formatters/template/yapi.erb
336
336
  - lib/lhj/config.rb
337
337
  - lib/lhj/env.rb
338
+ - lib/lhj/helper/app_version_info.rb
338
339
  - lib/lhj/helper/dingtalk_config.rb
339
340
  - lib/lhj/helper/dingtalk_helper.rb
340
341
  - lib/lhj/helper/git_branch_feature_config.rb