lhj-tools 0.2.56 → 0.2.57
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 +22 -14
- data/lib/lhj/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1522e2e897fadad490a8c1b9baaff75d7472a3d7deeadf7bdb790ff310bcd56d
|
4
|
+
data.tar.gz: fa96344cdf3abd706ac13f0b349a3c9b0eb3e745d4da0befb1dc0ef4fcc0d57f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8c8b06eb183abc0969c0ec0d09fccff56c2977ccc3f55923e49180759ac36dbce014f1a98297afd84e93f5befc8eda5f219c09e9792d65780b8af8949d25134
|
7
|
+
data.tar.gz: 9d7caf469da443e5be5b0aa963848cc0ce9f5eac7ae60542d67bdafee2841a7aa3bc8bfa0aca0f4f6422417e3144d300f5341ac38f39aaaf6052d4a8e0ff8eec
|
@@ -5,14 +5,14 @@ require_relative 'team_member_config'
|
|
5
5
|
module Lhj
|
6
6
|
# version info
|
7
7
|
class AppVersionInfo
|
8
|
+
|
9
|
+
VERSION_REGEX = /^(?<begin>[^#]*MARKETING_VERSION\s*=\s*)(?<value>(?<major>[0-9]+)(\.(?<minor>[0-9]+))?(\.(?<patch>[0-9]+))?(?<appendix>(\.[0-9]+)*)?(-(?<prerelease>(.+)))?)(?<end>)/
|
10
|
+
|
8
11
|
# @param [Symbol] env
|
9
12
|
def initialize(env, build_number, work_path)
|
10
13
|
@env = env
|
11
14
|
@build_number = build_number
|
12
15
|
@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
16
|
modify_code
|
17
17
|
end
|
18
18
|
|
@@ -70,25 +70,27 @@ module Lhj
|
|
70
70
|
"#{build_app_version} (#{build_app_version_no}) (build: #{build_version})"
|
71
71
|
end
|
72
72
|
|
73
|
-
def
|
74
|
-
# app version '1.0.0'
|
73
|
+
def self.all_app_version(path)
|
75
74
|
vers = []
|
76
|
-
Dir.glob("#{
|
75
|
+
Dir.glob("#{path}/*.xcodeproj/*.pbxproj").each do |file|
|
77
76
|
File.readlines(file).each do |l|
|
78
77
|
next unless /MARKETING_VERSION/ =~ l
|
79
78
|
|
80
|
-
|
81
|
-
major = version_match[:major].to_i
|
82
|
-
minor = version_match[:minor].to_i || 0
|
83
|
-
patch = version_match[:patch].to_i || 0
|
84
|
-
vers << { value: version_match[:value], major: major, minor: minor, patch: patch }
|
79
|
+
vers << fetch_version(l)
|
85
80
|
end
|
86
81
|
end
|
87
|
-
|
88
|
-
list.last[:value]
|
82
|
+
sort_version_list(vers)
|
89
83
|
end
|
90
84
|
|
91
|
-
def
|
85
|
+
def self.fetch_version(line)
|
86
|
+
version_match = VERSION_REGEX.match(line)
|
87
|
+
major = version_match[:major].to_i
|
88
|
+
minor = version_match[:minor].to_i || 0
|
89
|
+
patch = version_match[:patch].to_i || 0
|
90
|
+
{ value: version_match[:value], major: major, minor: minor, patch: patch }
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.sort_version_list(list)
|
92
94
|
list.sort do |a, b|
|
93
95
|
ma = a[:major] <=> b[:major]
|
94
96
|
ma = a[:minor] <=> b[:minor] if ma.zero?
|
@@ -97,6 +99,12 @@ module Lhj
|
|
97
99
|
end
|
98
100
|
end
|
99
101
|
|
102
|
+
def build_app_version
|
103
|
+
# app version '1.0.0'
|
104
|
+
vers = AppVersionInfo.all_app_version(@work_path)
|
105
|
+
vers.last[:value]
|
106
|
+
end
|
107
|
+
|
100
108
|
def build_app_version_no
|
101
109
|
# xcode build version
|
102
110
|
# ${BUILD_NUMBER} of jenkins
|
data/lib/lhj/version.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.2.
|
4
|
+
version: 0.2.57
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lihaijian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xcodeproj
|