lhj-tools 0.1.53 → 0.1.56

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: b7b3a7e3757035f3306fd09213009b4558445763b02c74c40b86e7016a7088ef
4
- data.tar.gz: 86c4e51a41826d0eca77d839bdb8735471737b94452a2e82688e4ca537162721
3
+ metadata.gz: 0466ef4a511c15e68582056fcee41d1b1453d68eb79bc68610277314ed54fc8a
4
+ data.tar.gz: caebb0fb1dcd50bbc8f5e841918e4ccf14d32ec8fb5261da7f7c0db546941c71
5
5
  SHA512:
6
- metadata.gz: 21efdee7795596ff21d051a36ed81d4a4828482ec35639832c08524eca2e9ca39b66d96b78f10c32b012ae4509744df493deecc01b823c3e1396f1806c03d572
7
- data.tar.gz: a2a0d03aeb156b1a7bc4d12a4590dd45b8e595bb3fe5a8d17681b109140a2a7e34b9bd28aa1dea065e76951b01953a2f4753f842e8aa0974c6034db6b9b55c56
6
+ metadata.gz: 7ad62cffb4efe791a82c5f9385f6150acc3e819e7f53e1d884a20300b2c640f2a0944f6a3e21be4fc98fd38850b59ea5f4b0e54cf80b681cab595269e938e15f
7
+ data.tar.gz: c1d31f95c7ca01eb66057d5ab40b22a7eab50e47ec498d64c476fd5729e3118be0cf566ff3a4bed935e6405ed4bf57bb1ca21103becfa1a9b6d71661aa9984f4
@@ -0,0 +1,88 @@
1
+ require_relative 'log_helper'
2
+ require_relative 'pgyer_shortcut_helper'
3
+ require_relative 'team_member_config'
4
+
5
+ module Lhj
6
+ # version info
7
+ class AppVersionInfo
8
+ # @param [Symbol] env
9
+ def initialize(env, build_number, work_path)
10
+ @env = env
11
+ @build_number = build_number
12
+ @work_path = work_path
13
+ setup_config
14
+ end
15
+
16
+ def setup_config
17
+ number = build_app_version_no
18
+ Dir.chdir(@work_path) do
19
+ command = %(xcrun agvtool new-version -all #{number})
20
+ Actions.sh(command, log: false)
21
+ end
22
+ end
23
+
24
+ # build_app_version (build_app_version_no) (build: build_version)
25
+ def build_info
26
+ "#{build_app_version} (#{build_app_version_no}) (build: #{build_version})"
27
+ end
28
+
29
+ def build_app_version
30
+ # app version '1.0.0'
31
+ vers = []
32
+ Dir.glob("#{@work_path}/*.xcodeproj/*.pbxproj").each do |file|
33
+ 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
38
+ end
39
+ end
40
+ vers[0]
41
+ end
42
+
43
+ def build_app_version_no
44
+ # xcode build version
45
+ # ${BUILD_NUMBER} of jenkins
46
+ @build_number || '1'
47
+ end
48
+
49
+ def build_version
50
+ # pu gong ying build number
51
+ client = Lhj::PgyerShortcut.new(@env)
52
+ version = 0
53
+ version = client.build_version.to_i if client.build_version
54
+ version += 1
55
+ version.to_s
56
+ end
57
+
58
+ def build_updated
59
+ time = Time.now
60
+ time.strftime('%Y-%m-%d %H:%M:%S')
61
+ end
62
+
63
+ def branch_name
64
+ Dir.chdir(@work_path) do
65
+ Lhj::LogHelper.instance.current_branch(@work_path)
66
+ end
67
+ end
68
+
69
+ def update_log
70
+ Dir.chdir(@work_path) do
71
+ message = Lhj::Actions.git_log_last_commits(' %an %ar - %s;', 5, :exclude_merges, 'short', false)
72
+ handle_message(message)
73
+ end
74
+ end
75
+
76
+ def handle_message(m)
77
+ message = m
78
+ unless message.empty?
79
+ message = message.gsub('seconds ', '秒').gsub('minutes ', '分钟').gsub('hours ', '小时').gsub('weeks ', '周').gsub('days ', '天').gsub('ago ', '前')
80
+ Lhj::TeamMemberConfig.config.each do |key, value|
81
+ message = message.gsub(key, value) if message =~ /#{key}/
82
+ end
83
+ end
84
+ message
85
+ end
86
+
87
+ end
88
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lhj
4
4
  module Tools
5
- VERSION = "0.1.53"
5
+ VERSION = "0.1.56"
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.53
4
+ version: 0.1.56
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-11 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