cocoapods-jxedt 0.0.9 → 0.0.10
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 777002b95ef4f80296a0e6289a5a90ad04c2f71e49d2e647fd21e145c872b871
|
4
|
+
data.tar.gz: 0dc4fee30c433a0e07c89c114c61e9f2355746618fd3cf2055f011e9e767b4b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 239b4f5621619a359f42159c0d14bad1402e75b56862af836ae297b6ff88667b0bf8fc6b2bbdc5a1f65d31fade8b04895de910f2d50c99e2ba7f03f19e12ce14
|
7
|
+
data.tar.gz: 198b0e23d430d4788b3fe14cee2562041b8323ac9ad68ac12b215613a9ea443caa6c427e6d49f51fb539687f81c2e0caab8de2290362227ab268de8e34ea0472
|
@@ -2,9 +2,9 @@ module Pod
|
|
2
2
|
class Command
|
3
3
|
class JxedtCommand < Command
|
4
4
|
class Header < JxedtCommand
|
5
|
-
self.summary = '
|
5
|
+
self.summary = '修改头文件引用问题'
|
6
6
|
self.description = <<-DESC
|
7
|
-
|
7
|
+
修改头文件引用问题\n
|
8
8
|
例如修改#import "AFNetworking.h"或#import <AFNetworking.h>这种头文件引用方式为#import <AFNetworking/AFNetworking.h>\n
|
9
9
|
使用方式:\n
|
10
10
|
到Podfile文件所在目录执行以下命令\n
|
@@ -23,6 +23,8 @@ module Pod
|
|
23
23
|
['--write', '修改命中的头文件引用,不写入则直接输出需要修改的文件和修改内容。默认false'],
|
24
24
|
['--suffix', '处理的文件后缀,默认处理\'h,m,mm,pch\'后缀的文件'],
|
25
25
|
['--header-regulation', 'header name的正则,默认为\'[\w+-]*\.h\',如果不满足也可以自定义'],
|
26
|
+
['--verbose', '在屏幕上输出修改文件的详情'],
|
27
|
+
['--log-path', '需要修改文件内容导出路径']
|
26
28
|
]
|
27
29
|
end
|
28
30
|
def initialize(argv)
|
@@ -31,6 +33,8 @@ module Pod
|
|
31
33
|
@suffix = argv.option('suffix', 'h,m,mm,pch')
|
32
34
|
@force_write = argv.flag?('write', false)
|
33
35
|
@header_regulation = argv.option('header-regulation')
|
36
|
+
@verbose_flag = argv.flag?('verbose', false)
|
37
|
+
@log_path = argv.option('log-path')
|
34
38
|
super
|
35
39
|
end
|
36
40
|
|
@@ -65,7 +69,7 @@ module Pod
|
|
65
69
|
}
|
66
70
|
|
67
71
|
# 遍历需要处理的文件
|
68
|
-
record = []
|
72
|
+
files, failed, record = [], [], []
|
69
73
|
process_target_files.each {|file_path|
|
70
74
|
changed = false
|
71
75
|
lines = File.readlines(file_path)
|
@@ -77,16 +81,36 @@ module Pod
|
|
77
81
|
header_name = line.match(/(?<=")#{header_name_regulation}(?=")/) || line.match(/(?<=<)#{header_name_regulation}(?=>)/)
|
78
82
|
next unless public_header_mapping.include?("#{header_name}")
|
79
83
|
|
84
|
+
changed = true # 文件需要修改
|
80
85
|
project_module_name = public_header_mapping["#{header_name}"]
|
81
86
|
replace_line = "#import " << "<#{project_module_name}/#{header_name}>\n"
|
82
87
|
lines[num] = replace_line
|
83
|
-
changed = true
|
84
88
|
record << "#{file_path} 第#{num}行,#{line} => #{replace_line}"
|
85
89
|
}
|
86
|
-
|
90
|
+
files << file_path if changed
|
91
|
+
begin
|
92
|
+
File.open(file_path, 'w') { |f| f.write(lines.join) } if changed && @force_write
|
93
|
+
rescue
|
94
|
+
failed << file_path
|
95
|
+
ensure
|
96
|
+
help! "因权限问题文件修改失败:\n#{file_path}" if failed.size > 0
|
97
|
+
end
|
87
98
|
}
|
88
|
-
puts "
|
89
|
-
puts
|
99
|
+
puts "需要修改文件共有:#{files.size} 个,需要修改的头文件的地方共有:#{record.size} 处"
|
100
|
+
puts "已修改完成" if files.size > 0 && @force_write
|
101
|
+
|
102
|
+
if files.size > 0
|
103
|
+
logs = <<~LOGS
|
104
|
+
需要修改的文件:
|
105
|
+
#{JSON.pretty_generate(files)}
|
106
|
+
|
107
|
+
文件修改详情:
|
108
|
+
#{JSON.pretty_generate(record)}
|
109
|
+
LOGS
|
110
|
+
logs.gsub!('\\"', '"').gsub!('\\n', '') # 去除转义字符
|
111
|
+
puts logs if @verbose_flag
|
112
|
+
File.open(log_file_path, 'w') { |file| file.write("#{logs}") } unless log_file_path.nil?
|
113
|
+
end
|
90
114
|
end
|
91
115
|
|
92
116
|
def installer_for_config
|
@@ -151,6 +175,13 @@ module Pod
|
|
151
175
|
end
|
152
176
|
dependent_targets
|
153
177
|
end
|
178
|
+
|
179
|
+
def log_file_path
|
180
|
+
log_path = @log_path
|
181
|
+
log_path << "/headerfix_output.txt" if log_path && File.directory?(log_path)
|
182
|
+
return if log_path && (!File.exist?(File.dirname(log_path)))
|
183
|
+
log_path
|
184
|
+
end
|
154
185
|
end
|
155
186
|
end
|
156
187
|
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class JxedtCommand < Command
|
4
|
+
class Statistics < JxedtCommand
|
5
|
+
self.summary = '统计二进制使用情况'
|
6
|
+
self.description = <<-DESC
|
7
|
+
统计二进制使用详情
|
8
|
+
DESC
|
9
|
+
self.command = 'statistics'
|
10
|
+
self.arguments = [
|
11
|
+
]
|
12
|
+
def self.options
|
13
|
+
[
|
14
|
+
['--failed', '统计校验失败的二进制'],
|
15
|
+
]
|
16
|
+
end
|
17
|
+
def initialize(argv)
|
18
|
+
@check_failed = argv.flag?('failed')
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def validate!
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def run
|
27
|
+
podfile = Pod::Config.instance.podfile
|
28
|
+
lockfile = Pod::Config.instance.lockfile
|
29
|
+
help! '请检查命令执行路径,需要在Podfile文件所在目录执行' if podfile.nil? || lockfile.nil?
|
30
|
+
|
31
|
+
require 'cocoapods-jxedt/binary/config'
|
32
|
+
require 'cocoapods-jxedt/binary/helper/podfile_options'
|
33
|
+
|
34
|
+
pods_root = Pathname.new(File.dirname(podfile.defined_in_file)) + "Pods"
|
35
|
+
binary_dir = pods_root + Jxedt.config.binary_dir
|
36
|
+
|
37
|
+
used_binary = []
|
38
|
+
Dir.glob("#{pods_root}/*/_Prebuild") do |file_path|
|
39
|
+
next unless File.directory?(file_path)
|
40
|
+
dir_name = File.dirname(file_path)
|
41
|
+
name = File.basename(dir_name).to_s
|
42
|
+
target_path = binary_dir + name
|
43
|
+
next unless target_path.exist? # 路径不存在,跳过
|
44
|
+
|
45
|
+
new_hash = {}
|
46
|
+
# name
|
47
|
+
new_hash[:name] = name
|
48
|
+
|
49
|
+
# multiple_configuration
|
50
|
+
configuration_enable = target_path.children().select { |path| "#{path.basename}" == 'Debug' || "#{path.basename}" == 'Release' }.count == 2
|
51
|
+
new_hash[:multiple_configuration] = configuration_enable
|
52
|
+
|
53
|
+
# checksum validation
|
54
|
+
checksum_file = target_path.children().select { |path| path.extname == '.checksum' }.first
|
55
|
+
new_hash[:checksum] = checksum_file.basename.to_s.gsub('.checksum', '') unless checksum_file.nil?
|
56
|
+
|
57
|
+
used_binary << new_hash
|
58
|
+
end
|
59
|
+
|
60
|
+
# print
|
61
|
+
index, failed = 0, []
|
62
|
+
used_binary.sort_by {|hash| hash[:name] }.each do |hash|
|
63
|
+
name = hash[:name]
|
64
|
+
|
65
|
+
checksum = lockfile.spec_checksums_hash_key(name)
|
66
|
+
validation_passed = checksum && checksum == hash[:checksum]
|
67
|
+
failed << name unless validation_passed
|
68
|
+
|
69
|
+
# 校验和是否用的 git commitid
|
70
|
+
checkout_options = lockfile.internal_data["CHECKOUT OPTIONS"] || {}
|
71
|
+
is_git_commitid = checkout_options[name] && checkout_options[name][:commit]
|
72
|
+
|
73
|
+
if validation_passed
|
74
|
+
next if @check_failed
|
75
|
+
index += 1
|
76
|
+
log = <<~LOG
|
77
|
+
#{index}). #{name}:
|
78
|
+
multiple configuration: #{hash[:multiple_configuration]}
|
79
|
+
checksum#{"(git commitid)" if is_git_commitid}: #{hash[:checksum]}
|
80
|
+
LOG
|
81
|
+
Pod::UI.puts log
|
82
|
+
else
|
83
|
+
index += 1
|
84
|
+
log = <<~LOG
|
85
|
+
#{index}). #{name}:
|
86
|
+
multiple configuration: #{hash[:multiple_configuration]}
|
87
|
+
checksum: #{hash[:checksum]}
|
88
|
+
checksum in lockfile#{"(git commitid)" if is_git_commitid}: #{checksum}
|
89
|
+
LOG
|
90
|
+
Pod::UI.puts log.red
|
91
|
+
end
|
92
|
+
end
|
93
|
+
Pod::UI.puts "checksum校验失败的组件: #{failed}".red if failed.size > 0
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-jxedt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- guojiashuang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- lib/cocoapods-jxedt/command/header/header.rb
|
91
91
|
- lib/cocoapods-jxedt/command/jxedt.rb
|
92
92
|
- lib/cocoapods-jxedt/command/options/options.rb
|
93
|
+
- lib/cocoapods-jxedt/command/statistics/statistics.rb
|
93
94
|
- lib/cocoapods-jxedt/gem_version.rb
|
94
95
|
- lib/cocoapods-jxedt/tool.rb
|
95
96
|
- lib/cocoapods_plugin.rb
|