yptools 1.0.6 → 1.0.8

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: 0077bd48738b9e68825ffeeafc22e984abf32df190609b7b6cceed822ca5311d
4
- data.tar.gz: 8a653f1f78714d8fbf992aab66fbafe4931f2ce6d0d3c89b12bc83cc998d4efb
3
+ metadata.gz: 4fe362757685013ee50d5bbca524fc5e08dd59f9f64a3a4549b7d939d3704fb2
4
+ data.tar.gz: 8e8e02e07fc6c9ad0ced4a9802a2e2b5da2820e20774ad37932c0765e4059ec2
5
5
  SHA512:
6
- metadata.gz: 9ceeb4096543a91b7a9c68a1a86b90cd9dcc2a64fba743536f6dfd44247a4446170377c2a9c251ef8e715dfcef460a7ffe909e0b0e4ca282cb1db77062589b36
7
- data.tar.gz: 6d8aee0caba72e0479a574d8c75876279f71e91734542df9e49b8a3a9f54cf0fc159ccb95f21ebcfb9ef2b036c9055711000a005bdae4d805d5e224b93823839
6
+ metadata.gz: 2f199a39f86c7a4853203c0fb335a58c987caa0c57d3bd2fff2b23bf354389b6e92c7a3270cfcc17de093d442078a60e71c9ce9fafe4e6fe93e0db21b43055d0
7
+ data.tar.gz: 1a50b8e355361882faf85a1db7e72909e0df6494e3ecf35d2a60b322f20386f9a7ec8dde04f57c30e6b564142142c119a131f2801b6b52b47e7d7d07ebc42a66
@@ -0,0 +1,69 @@
1
+ require 'pathname'
2
+ require 'colored'
3
+ require_relative '../log/yp_log'
4
+ require_relative '../mgc/yp_makegarbagecode'
5
+
6
+ def yp_copy_ignoringFiles
7
+ return ".", "..", ".DS_Store"
8
+ end
9
+
10
+ def yp_updatereateDate (path)
11
+ yp_log_msg '#{path}'
12
+ # 筛选文件的正则
13
+ script = /(\.h|\.m)$/
14
+ # 配置忽略文件
15
+ ignoringFiles = yp_copy_ignoringFiles
16
+ # 获取符合条件的文件列表
17
+ fileList = yp_method_fileList path, script, ignoringFiles
18
+
19
+ yp_log_doing "正在准备更新当前目录下面文件后缀为.h|.m 的文件创建时间"
20
+
21
+ fileList.each { |fileDic|
22
+ fileDic.each { |key, value|
23
+ createTime = Time.new
24
+ fileName = File.basename(value,".*")
25
+ yp_log_success "已更新文件:#{key}"
26
+ yp_updateCreateDateWithPath value
27
+ }
28
+ }
29
+
30
+ yp_log_success "已更新完成,总共更新#{fileList.count}个文件"
31
+ end
32
+
33
+ # 重新生成文件(目的是为了重置创建时间)
34
+ def yp_updateCreateDateWithPath (path)
35
+
36
+ pathFile = File.open(path, "r")
37
+ fileName = File.basename(path,".*")
38
+ allLines = Array.new
39
+
40
+ createTime = Time.new
41
+ allLines.push('// YPTools Auto Update Create Date https://github.com/HansenCCC/YPTools')
42
+ allLines.push("\n")
43
+ allLines.push("// #{createTime}")
44
+ allLines.push("\n")
45
+
46
+ fileLine = 0
47
+ while textLine = pathFile.gets
48
+ fileLine += 1
49
+ allLines.push(textLine)
50
+ end
51
+
52
+ allLines.push("\n")
53
+ allLines.push("// #{createTime}")
54
+ allLines.push("\n")
55
+ allLines.push('// YPTools Auto Update Create Date https://github.com/HansenCCC/YPTools')
56
+
57
+ filePath = path
58
+
59
+ pathFile.close
60
+
61
+ File.delete(path)
62
+
63
+ createFile = File.new(filePath,"w+")
64
+ allLines.each {|lineTest|
65
+ createFile.syswrite(lineTest)
66
+ }
67
+
68
+ createFile.close
69
+ end
@@ -7,8 +7,12 @@ class YPHelp
7
7
 
8
8
  mgc: use [yptools mgc suffix] 在当前目录生成垃圾代码(当前目录需要有.xcworkspace或者.xcodeproj目录)
9
9
 
10
+ showipa: use [yptools showipa ...] 用于解析ipa文件
11
+
10
12
  update: use [yptools update] 更新yptools
11
13
 
14
+ ufct: use [yptools ufct] 更新当前目录下面文件后缀为.h|.m 的文件创建时间
15
+
12
16
  xpj: use [yptools xpj ...] use xcodeproj api
13
17
  use [yptools xpj check] 检查当前目录项目文件是否存在引用的问题
14
18
 
@@ -0,0 +1,189 @@
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ require 'pathname'
4
+ require 'colored'
5
+ require 'plist'
6
+ require 'json'
7
+ require_relative '../log/yp_log'
8
+ require_relative '../mgc/yp_makegarbagecode'
9
+
10
+
11
+ class YPPackage
12
+
13
+ def self.analysis(filePath, delete = 1)
14
+
15
+ fileName = File.basename(filePath)
16
+ fileBasename = File.basename(filePath, ".*")
17
+ fileSuffix = File.extname(filePath)
18
+ fileDirname = File.dirname(filePath)
19
+
20
+ yp_path = `pwd`
21
+ yp_path = yp_path.sub("\n","")
22
+
23
+ # yp_outPath = yp_path + '/Payload + ' + Time.new.inspect
24
+ yp_outPath = fileDirname + '/ipa-' + Time.new.strftime("%Y%m%d%H%M%S-%L")
25
+ yp_method_mkdir yp_outPath
26
+ yp_log_doing "将ipa解压到临时目录#{yp_outPath}"
27
+ `tar -xf #{filePath} -C #{yp_outPath}`
28
+
29
+ yp_resourceFile = "#{yp_outPath}/Payload/"
30
+
31
+ yp_resourceFile_app = ""
32
+ Dir.entries(yp_resourceFile).each do |sub|
33
+ if sub.end_with?(".app")
34
+ yp_resourceFile_app = yp_resourceFile + sub;
35
+ end
36
+ end
37
+
38
+ if yp_resourceFile_app.length == 0
39
+ yp_log_fail "解析失败,请检查压缩包是否是ipa文件"
40
+ return
41
+ end
42
+
43
+ puts yp_resourceFile_app
44
+
45
+ yp_infoPlistName = "Info.plist"
46
+ yp_infoPlistPath = ""
47
+
48
+ yp_mobileprovisionName = ".mobileprovision"
49
+ yp_mobileprovisionPath = ""
50
+
51
+ Dir.entries(yp_resourceFile_app).each do |sub|
52
+ if sub == yp_infoPlistName
53
+ yp_infoPlistPath = yp_resourceFile_app + "/" + sub;
54
+ end
55
+ if sub.end_with?(yp_mobileprovisionName)
56
+ yp_mobileprovisionPath = yp_resourceFile_app + "/" + sub;
57
+ end
58
+ end
59
+
60
+ puts yp_infoPlistPath
61
+ puts yp_mobileprovisionPath
62
+
63
+ yp_mobileprovisionPlistPath = yp_resourceFile_app + "/" + "mobileprovision.plist"
64
+ # 解析描述文件
65
+ yp_mobileprovisionDatum = `security cms -D -i #{yp_mobileprovisionPath}`
66
+
67
+ puts yp_mobileprovisionPlistPath
68
+
69
+ yp_plistCreateFile = File.new(yp_mobileprovisionPlistPath,"w+")
70
+ yp_plistCreateFile.syswrite(yp_mobileprovisionDatum)
71
+ yp_plistCreateFile.close
72
+
73
+ yp_log_success "============================================================"
74
+
75
+ yp_plist = Plist.parse_xml(yp_mobileprovisionPlistPath)
76
+
77
+ yp_appIDName = yp_plist["AppIDName"]
78
+ yp_applicationIdentifierPrefix = yp_plist["ApplicationIdentifierPrefix"]
79
+ yp_creationDate = yp_plist["CreationDate"]
80
+ yp_platform = yp_plist["Platform"]
81
+ yp_isXcodeManaged = yp_plist["IsXcodeManaged"]
82
+ yp_developerCertificates = yp_plist["DeveloperCertificates"]
83
+ yp_DER_Encoded_Profile = yp_plist["DER-Encoded-Profile"]
84
+ yp_entitlements = yp_plist["Entitlements"]
85
+ yp_expirationDate = yp_plist["ExpirationDate"]
86
+ yp_name = yp_plist["Name"]
87
+ yp_provisionsAllDevices = yp_plist["ProvisionsAllDevices"]
88
+ yp_teamIdentifier = yp_plist["TeamIdentifier"]
89
+ yp_teamName = yp_plist["TeamName"]
90
+ yp_timeToLive = yp_plist["TimeToLive"]
91
+ yp_uUID = yp_plist["UUID"]
92
+ yp_version = yp_plist["Version"]
93
+ yp_provisionedDevices = yp_plist["ProvisionedDevices"]
94
+
95
+ yp_log_success " 输出描述文件embedded.mobileprovision"
96
+ puts yp_mobileprovisionPlistPath
97
+ puts ''
98
+ yp_log_doing " 程序名称:\t#{yp_appIDName}"
99
+ yp_log_doing " 团队名称:\t#{yp_teamName}"
100
+ yp_log_doing " 创建时间:\t#{yp_creationDate}"
101
+ yp_log_fail " 过期时间:\t#{yp_expirationDate}"
102
+ yp_log_doing " 系统平台:\t#{yp_platform}"
103
+
104
+ if yp_provisionedDevices.class == Array
105
+ yp_log_doing " \n udids"
106
+ for device in yp_provisionedDevices
107
+ yp_log_doing " #{device}"
108
+ end
109
+ end
110
+
111
+ # yp_log_msg " 标识符🚀:\t#{yp_applicationIdentifierPrefix}"
112
+ # yp_log_msg " 证书证书:\t#{yp_developerCertificates}"
113
+ # yp_log_msg " 证书证书:\t#{yp_DER_Encoded_Profile}"
114
+ # yp_log_doing " 随便看看:\t#{yp_entitlements}"
115
+ # yp_log_msg " 名字名字:\t#{yp_name}"
116
+ # yp_log_msg " 支持设备:\t#{yp_provisionsAllDevices}"
117
+ # yp_log_msg " 团队标识:\t#{yp_teamIdentifier}"
118
+ # puts " 生存时间:\t#{yp_timeToLive}"
119
+ # puts " uuid🚀🚀:\t#{yp_uUID}"
120
+ # puts " 版本号🚀:\t#{yp_version}"
121
+ puts ''
122
+ yp_log_success "============================================================"
123
+
124
+ # puts yp_infoPlistPath
125
+
126
+ # 解析加密之后的plist文件
127
+ `plutil -convert json #{yp_infoPlistPath}`
128
+ yp_info_plist = `cat #{yp_infoPlistPath}`
129
+ yp_info_plist_hash = JSON.parse(yp_info_plist)
130
+ yp_log_success " 输出Info.plist文件#{yp_infoPlistName}"
131
+ puts yp_infoPlistPath
132
+
133
+ puts ''
134
+ yp_log_doing " CFBundleDisplayName:\t#{yp_info_plist_hash['CFBundleDisplayName']}"
135
+ yp_log_doing " CFBundleIdentifier:\t#{yp_info_plist_hash['CFBundleIdentifier']}"
136
+ yp_log_doing " CFBundleVersion:\t#{yp_info_plist_hash['CFBundleVersion']}"
137
+ # if yp_info_plist_hash['NSContactsUsageDescription']
138
+ # yp_log_doing " NSContactsUsageDescription:\t#{yp_info_plist_hash['NSContactsUsageDescription']}"
139
+ # end
140
+ # if yp_info_plist_hash['NSPhotoLibraryUsageDescription']
141
+ # yp_log_doing " NSPhotoLibraryUsageDescription:\t#{yp_info_plist_hash['NSPhotoLibraryUsageDescription']}"
142
+ # end
143
+ # if yp_info_plist_hash['NSBluetoothAlwaysUsageDescription']
144
+ # yp_log_doing " NSBluetoothAlwaysUsageDescription:\t#{yp_info_plist_hash['NSBluetoothAlwaysUsageDescription']}"
145
+ # end
146
+ # if yp_info_plist_hash['NSLocationAlwaysAndWhenInUseUsageDescription']
147
+ # yp_log_doing " NSLocationAlwaysAndWhenInUseUsageDescription:\t#{yp_info_plist_hash['NSLocationAlwaysAndWhenInUseUsageDescription']}"
148
+ # end
149
+ # if yp_info_plist_hash['NSLocationWhenInUseUsageDescription']
150
+ # yp_log_doing " NSLocationWhenInUseUsageDescription:\t#{yp_info_plist_hash['NSLocationWhenInUseUsageDescription']}"
151
+ # end
152
+ # if yp_info_plist_hash['NSCameraUsageDescription']
153
+ # yp_log_doing " NSCameraUsageDescription:\t#{yp_info_plist_hash['NSCameraUsageDescription']}"
154
+ # end
155
+ # if yp_info_plist_hash['NSLocationAlwaysUsageDescription']
156
+ # yp_log_doing " NSLocationAlwaysUsageDescription:\t#{yp_info_plist_hash['NSLocationAlwaysUsageDescription']}"
157
+ # end
158
+ # if yp_info_plist_hash['NSBluetoothPeripheralUsageDescription']
159
+ # yp_log_doing " NSBluetoothPeripheralUsageDescription:\t#{yp_info_plist_hash['NSBluetoothPeripheralUsageDescription']}"
160
+ # end
161
+ # if yp_info_plist_hash['NSPhotoLibraryAddUsageDescription']
162
+ # yp_log_doing " NSPhotoLibraryAddUsageDescription:\t#{yp_info_plist_hash['NSPhotoLibraryAddUsageDescription']}"
163
+ # end
164
+ # if yp_info_plist_hash['NSMicrophoneUsageDescription']
165
+ # yp_log_doing " NSMicrophoneUsageDescription:\t#{yp_info_plist_hash['NSMicrophoneUsageDescription']}"
166
+ # end
167
+ # if yp_info_plist_hash['NSMotionUsageDescription']
168
+ # yp_log_doing " NSMotionUsageDescription:\t#{yp_info_plist_hash['NSMotionUsageDescription']}"
169
+ # end
170
+ # if yp_info_plist_hash['NSSiriUsageDescription']
171
+ # yp_log_doing " NSSiriUsageDescription:\t#{yp_info_plist_hash['NSSiriUsageDescription']}"
172
+ # end
173
+ # if yp_info_plist_hash['NSCalendarsUsageDescription']
174
+ # yp_log_doing " NSCalendarsUsageDescription:\t#{yp_info_plist_hash['NSCalendarsUsageDescription']}"
175
+ # end
176
+ # if yp_info_plist_hash['NSFaceIDUsageDescription']
177
+ # yp_log_doing " NSFaceIDUsageDescription:\t#{yp_info_plist_hash['NSFaceIDUsageDescription']}"
178
+ # end
179
+ puts ''
180
+ yp_log_success "============================================================"
181
+
182
+ if delete == 1
183
+ yp_log_doing "移除临时目录#{yp_outPath}"
184
+ yp_method_rmdir yp_outPath
185
+ end
186
+
187
+ end
188
+
189
+ end
@@ -16,46 +16,9 @@ class YPXcodeproj
16
16
  end
17
17
 
18
18
  def self.message
19
- # yp_log_doing "🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀"
20
- # project_path = '/Users/Hansen/Desktop/lehuo/PrivateDiary.xcodeproj'
21
- # project = Xcodeproj::Project.open(project_path)
22
- #
23
- # project.targets.each do |target|
24
- # puts target.name
25
- # end
26
-
27
- # target = project.targets.first
28
- # files = target.source_build_phase.files.to_a.map do |pbx_build_file|
29
- # pbx_build_file.file_ref.real_path.to_s
30
- # end.select do |path|
31
- # path.end_with?(".m", ".mm", ".swift")
32
- # end.select do |path|
33
- # !File.exists?(path)
34
- # end
35
- #
36
- # files = target.source_build_phase.files.to_a.map do |pbx_build_file|
37
- # pbx_build_file.file_ref.real_path.to_s
38
- # end.select do |path|
39
- # path.end_with?(".m", ".mm", ".swift")
40
- # end.select do |path|
41
- # !File.exists?(path)
42
- # end
43
- #
44
- # puts files
45
-
46
- # app_target = project.targets.first
47
- #
48
- # puts app_target
49
- # new_group = project.new_group("CHSS")
50
- #
51
- # header_ref = new_group.new_file('/Users/Hansen/Desktop/CHSS/CoverView+CHSS.h')
52
- # implm_ref = new_group.new_file('/Users/Hansen/Desktop/CHSS/CoverView+CHSS.m')
53
- # app_target.add_file_references([implm_ref])
54
- # project.save()
55
-
19
+
56
20
  end
57
-
58
-
21
+
59
22
  def self.check
60
23
 
61
24
  yp_log_doing "🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀";
@@ -185,7 +148,6 @@ end
185
148
 
186
149
  #xcodeproj工程配置脚本化 https://www.jianshu.com/p/67ab2522daa7
187
150
 
188
-
189
151
  ## puts project.main_group.path
190
152
  # files_m = target.source_build_phase.files.to_a.map do |pbx_build_file|
191
153
  # pbx_build_file.file_ref.real_path.to_s
data/lib/yptools.rb CHANGED
@@ -1,17 +1,31 @@
1
+ # -*- coding: utf-8 -*-
2
+
1
3
  require_relative 'yptools/mgc/yp_makegarbagecode'
2
4
  require_relative 'yptools/help/yp_help'
3
5
  require_relative 'yptools/log/yp_log'
4
6
  require_relative 'yptools/install/yp_install'
5
7
  require_relative 'yptools/update/yp_update'
6
8
  require_relative 'yptools/xcodeproj/yp_xcodeproj'
9
+ require_relative 'yptools/file/yp_updatecreatedate'
10
+ require_relative 'yptools/package/yp_package'
7
11
 
8
12
  class YPTools
9
13
 
10
14
  def self.cmd_dispatch(argvs)
11
15
  cmd = argvs[0]
12
16
  case cmd
17
+ when 'install'
18
+ if argvs.size > 1
19
+ name = argvs[1]
20
+ self.install name
21
+ else
22
+ yp_log_fail "'yptools install ..' 参数缺失"
23
+ self.help
24
+ end
13
25
  when 'help'
14
26
  self.help
27
+ when 'ufct'
28
+ self.ufct
15
29
  when 'mgc'
16
30
  if argvs.size > 1
17
31
  suffix = argvs[1]
@@ -28,6 +42,17 @@ class YPTools
28
42
  yp_log_fail "'yptools install ..' 参数缺失"
29
43
  self.help
30
44
  end
45
+ when 'showipa'
46
+ if argvs.size > 2
47
+ filepath = argvs[1]
48
+ self.package(filepath,0)
49
+ elsif argvs.size > 1
50
+ filepath = argvs[1]
51
+ self.package filepath
52
+ else
53
+ yp_log_fail "'yptools package ..' 参数缺失"
54
+ self.help
55
+ end
31
56
  when 'update'
32
57
  self.update
33
58
  when 'xpj'
@@ -48,6 +73,12 @@ class YPTools
48
73
  YPHelp.message
49
74
  end
50
75
 
76
+ def self.ufct
77
+ path = `pwd`
78
+ path = path.sub("\n","")
79
+ yp_updatereateDate path
80
+ end
81
+
51
82
  def self.mgc(suffix)
52
83
  yp_tools_method_makeGarbage suffix
53
84
  end
@@ -56,6 +87,10 @@ class YPTools
56
87
  YPInstall.install(name)
57
88
  end
58
89
 
90
+ def self.package(filepath, delete = 1)
91
+ YPPackage.analysis(filepath,delete)
92
+ end
93
+
59
94
  def self.update
60
95
  YPUpdate.update
61
96
  end
@@ -72,6 +107,7 @@ end
72
107
  # 垃圾代码自动添加
73
108
  # 自动打包功能
74
109
  # SDK自动生成
110
+ # ipa 自动解析
75
111
 
76
112
  #puts "🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀";
77
113
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yptools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - chenghengsheng
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-13 00:00:00.000000000 Z
11
+ date: 2022-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,10 +90,12 @@ extra_rdoc_files: []
90
90
  files:
91
91
  - bin/yptools
92
92
  - lib/yptools.rb
93
+ - lib/yptools/file/yp_updatecreatedate.rb
93
94
  - lib/yptools/help/yp_help.rb
94
95
  - lib/yptools/install/yp_install.rb
95
96
  - lib/yptools/log/yp_log.rb
96
97
  - lib/yptools/mgc/yp_makegarbagecode.rb
98
+ - lib/yptools/package/yp_package.rb
97
99
  - lib/yptools/update/yp_update.rb
98
100
  - lib/yptools/xcodeproj/yp_xcodeproj.rb
99
101
  homepage: https://github.com/HansenCCC/YPTools.git
@@ -115,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
117
  - !ruby/object:Gem::Version
116
118
  version: '0'
117
119
  requirements: []
118
- rubygems_version: 3.0.9
120
+ rubygems_version: 3.0.3.1
119
121
  signing_key:
120
122
  specification_version: 4
121
123
  summary: YPTools!