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 +4 -4
- data/lib/lhj/helper/app_version_info.rb +88 -0
- data/lib/lhj/tools/version.rb +1 -1
- data/lib/lhj/tools.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0466ef4a511c15e68582056fcee41d1b1453d68eb79bc68610277314ed54fc8a
|
4
|
+
data.tar.gz: caebb0fb1dcd50bbc8f5e841918e4ccf14d32ec8fb5261da7f7c0db546941c71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/lhj/tools/version.rb
CHANGED
data/lib/lhj/tools.rb
CHANGED
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.
|
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
|
+
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
|