yptools 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/yptools/file/yp_updatecreatedate.rb +69 -0
- data/lib/yptools/help/yp_help.rb +2 -0
- data/lib/yptools/xcodeproj/yp_xcodeproj.rb +2 -40
- data/lib/yptools.rb +17 -8
- 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: 7d9a36624bc18f1d519d0a1b5e24440eec56f05729f2bb997646518eef48130e
|
4
|
+
data.tar.gz: 5682539c004927df1bd3b4c8cb9ae8e0c327181311542370bdf42d4d82c46793
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5212b210a35eaef7c94b78e416847b4deb21a528f68db4173d0243966502268d0995d774090862b19c271dda78b45abd1def619bedd88c4134b2061adab950ce
|
7
|
+
data.tar.gz: 1645e155cd85a3adb1f02492bc17759e6e969cc82f9de10fef12ff993eafdd849e65ec942f89e161487fad4a54e66be5a33d437bd2e460861fcc01aaddefd872
|
@@ -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
|
data/lib/yptools/help/yp_help.rb
CHANGED
@@ -16,46 +16,9 @@ class YPXcodeproj
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.message
|
19
|
-
|
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
@@ -4,14 +4,25 @@ require_relative 'yptools/log/yp_log'
|
|
4
4
|
require_relative 'yptools/install/yp_install'
|
5
5
|
require_relative 'yptools/update/yp_update'
|
6
6
|
require_relative 'yptools/xcodeproj/yp_xcodeproj'
|
7
|
+
require_relative 'yptools/file/yp_updatecreatedate'
|
7
8
|
|
8
9
|
class YPTools
|
9
10
|
|
10
11
|
def self.cmd_dispatch(argvs)
|
11
12
|
cmd = argvs[0]
|
12
13
|
case cmd
|
14
|
+
when 'install'
|
15
|
+
if argvs.size > 1
|
16
|
+
name = argvs[1]
|
17
|
+
self.install name
|
18
|
+
else
|
19
|
+
yp_log_fail "'yptools install ..' 参数缺失"
|
20
|
+
self.help
|
21
|
+
end
|
13
22
|
when 'help'
|
14
23
|
self.help
|
24
|
+
when 'ufct'
|
25
|
+
self.ufct
|
15
26
|
when 'mgc'
|
16
27
|
if argvs.size > 1
|
17
28
|
suffix = argvs[1]
|
@@ -20,14 +31,6 @@ class YPTools
|
|
20
31
|
yp_log_fail "'yptools mgc ..' 参数缺失"
|
21
32
|
self.help
|
22
33
|
end
|
23
|
-
when 'install'
|
24
|
-
if argvs.size > 1
|
25
|
-
name = argvs[1]
|
26
|
-
self.install name
|
27
|
-
else
|
28
|
-
yp_log_fail "'yptools install ..' 参数缺失"
|
29
|
-
self.help
|
30
|
-
end
|
31
34
|
when 'update'
|
32
35
|
self.update
|
33
36
|
when 'xpj'
|
@@ -48,6 +51,12 @@ class YPTools
|
|
48
51
|
YPHelp.message
|
49
52
|
end
|
50
53
|
|
54
|
+
def self.ufct
|
55
|
+
path = `pwd`
|
56
|
+
path = path.sub("\n","")
|
57
|
+
yp_updatereateDate path
|
58
|
+
end
|
59
|
+
|
51
60
|
def self.mgc(suffix)
|
52
61
|
yp_tools_method_makeGarbage suffix
|
53
62
|
end
|
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.
|
4
|
+
version: 1.0.7
|
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-
|
11
|
+
date: 2022-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,6 +90,7 @@ 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
|