cocoapods-jyanalyzer 0.0.8 → 0.1.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9f3fc256393d91524a2b147e54448d0b3f41121f1d5caf6c911dc2e2f2698d2
|
4
|
+
data.tar.gz: 36a4be6e378bbfe8150f4d07d8fb7180b1d83f4cfe06fd375cf2960399ecbe5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53e600d17f2647468b483a88342f54c060d5e94ba6713070472c284dddad45a8f9e55f9ea3365a4a988dee5922bc299c65fb9788fadb312fdbf8266c2c7a0ad6
|
7
|
+
data.tar.gz: 8e32762f7cdaa06179fb531668d4a4857eb12db864cf02e831b5b9113fef62e68baee5d625bae3cfddb37d266d70dce04c86c56218041fb41da5b8ad4e390342
|
@@ -6,6 +6,7 @@ module Pod
|
|
6
6
|
require 'cocoapods-jyanalyzer/command/jyanalyzer/recursion'
|
7
7
|
require 'cocoapods-jyanalyzer/command/jyanalyzer/depend'
|
8
8
|
require 'cocoapods-jyanalyzer/command/jyanalyzer/component'
|
9
|
+
require 'cocoapods-jyanalyzer/command/jyanalyzer/list'
|
9
10
|
|
10
11
|
self.abstract_command = true
|
11
12
|
self.default_subcommand = 'app'
|
@@ -14,7 +15,7 @@ module Pod
|
|
14
15
|
self.description = <<-DESC
|
15
16
|
哈啰pod依赖分析:recursion、app 、component 这是给服务端用的,请勿使用
|
16
17
|
|
17
|
-
本地使用 depend
|
18
|
+
本地使用 depend 命令获取完整依赖关系,list获取pod 依赖的库名列表
|
18
19
|
DESC
|
19
20
|
end
|
20
21
|
end
|
@@ -52,10 +52,18 @@ module Pod
|
|
52
52
|
installer.prepare
|
53
53
|
installer.resolve_dependencies
|
54
54
|
pod_targets = installer.pod_targets;
|
55
|
-
|
55
|
+
|
56
56
|
Pod::UI.puts "组件库依赖关系树、包大小, 使用: pod jyanalyzer component"
|
57
|
+
|
58
|
+
|
59
|
+
podfile_path = "#{Config.instance.podfile_path}"
|
60
|
+
Pod::UI.puts "#{podfile_path}"
|
61
|
+
|
62
|
+
tmp_ary = podfile_path.split("/")
|
63
|
+
tmp_ary.pop
|
64
|
+
|
65
|
+
currentPath = tmp_ary.join("/")
|
57
66
|
|
58
|
-
currentPath = "/Users/huanglei/Documents/HelloTrip_iOS_New/EasyBike"
|
59
67
|
podsPath = "#{currentPath}/Pods"
|
60
68
|
Pod::UI.puts currentPath
|
61
69
|
|
@@ -65,9 +73,14 @@ module Pod
|
|
65
73
|
end
|
66
74
|
|
67
75
|
body = Hash["planId" => planId,
|
68
|
-
"treePackageNodeList" =>
|
76
|
+
"treePackageNodeList" => dependencies_tmp(pod_targets,podsPath)]
|
69
77
|
|
70
78
|
# Pod::UI.puts JSON.pretty_generate(body).yellow
|
79
|
+
|
80
|
+
f=File.new("component.lock","w+")
|
81
|
+
f.puts(JSON.pretty_generate(body))
|
82
|
+
f.close
|
83
|
+
# return
|
71
84
|
|
72
85
|
url = URI.parse(api_url)
|
73
86
|
http = Net::HTTP.new(url.host, url.port)
|
@@ -101,45 +114,91 @@ module Pod
|
|
101
114
|
|
102
115
|
end
|
103
116
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
117
|
+
|
118
|
+
def type_lib(podsPath,pod_name)
|
119
|
+
type = 1
|
120
|
+
IO.popen("find #{podsPath}/#{pod_name} -name \"*.m\""){ |f|
|
121
|
+
text = f.gets
|
122
|
+
if text.nil?
|
123
|
+
type = 0
|
124
|
+
end
|
125
|
+
}
|
126
|
+
return type
|
127
|
+
end
|
128
|
+
|
129
|
+
def size_lib(podsPath,pod_name)
|
130
|
+
size=0
|
131
|
+
IO.popen("du -sk #{podsPath}/#{pod_name}"){ |f|
|
111
132
|
text = f.gets.split(" ")
|
112
133
|
size = text[0]
|
113
134
|
}
|
135
|
+
size=size.to_i*1024
|
136
|
+
return size
|
137
|
+
end
|
114
138
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
type = 0
|
120
|
-
end
|
121
|
-
}
|
122
|
-
size=size.to_i*1024
|
139
|
+
def dependencies_tmp(pods,podsPath)
|
140
|
+
|
141
|
+
names = Array.new
|
142
|
+
pods.each do |item|
|
123
143
|
|
124
144
|
childNodes = Array.new
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
145
|
+
recursive_pods = item.recursive_dependent_targets
|
146
|
+
recursive_pods.each do |recursive_item|
|
147
|
+
|
148
|
+
recursive_size = size_lib(podsPath,recursive_item.pod_name)
|
149
|
+
recursive_type = type_lib(podsPath,recursive_item.pod_name)
|
150
|
+
|
151
|
+
recursive_map = Hash["name" => recursive_item.pod_name,"version" => recursive_item.version,"size" => recursive_size,"system" => "ios","type" => recursive_type,"childNodes" => Array.new]
|
152
|
+
childNodes.push(recursive_map)
|
133
153
|
end
|
134
154
|
|
155
|
+
size = size_lib(podsPath,item.pod_name)
|
156
|
+
type = type_lib(podsPath,item.pod_name)
|
135
157
|
map = Hash["name" => item.pod_name,"version" => item.version,"size" => size,"system" => "ios","type" => type,"childNodes" => childNodes]
|
136
158
|
names.push(map)
|
137
|
-
|
138
159
|
end
|
139
|
-
@podHash[parent_pod_name] = names
|
140
160
|
return names
|
141
161
|
end
|
142
162
|
|
163
|
+
# def recursion_dependencies(pods,podsPath,i,parent_pod_name)
|
164
|
+
|
165
|
+
# names = Array.new
|
166
|
+
# pods.each do |item|
|
167
|
+
# # puts "#{item.pod_name}=====#{i}"
|
168
|
+
# size=0
|
169
|
+
# IO.popen("du -sk #{podsPath}/#{item.pod_name}"){ |f|
|
170
|
+
# text = f.gets.split(" ")
|
171
|
+
# size = text[0]
|
172
|
+
# }
|
173
|
+
|
174
|
+
# type = 1
|
175
|
+
# IO.popen("find #{podsPath}/#{item.pod_name} -name \"*.m\""){ |f|
|
176
|
+
# text = f.gets
|
177
|
+
# if text.nil?
|
178
|
+
# type = 0
|
179
|
+
# end
|
180
|
+
# }
|
181
|
+
# size=size.to_i*1024
|
182
|
+
|
183
|
+
# childNodes = Array.new
|
184
|
+
# if item.dependent_targets.empty?
|
185
|
+
# # puts "sdfdsfdsfdsfsdfdsfdsfsdfsfdsfdsf"
|
186
|
+
# else
|
187
|
+
# if @podHash.has_key?(item.pod_name)
|
188
|
+
# childNodes = @podHash[item.pod_name]
|
189
|
+
# else
|
190
|
+
# childNodes = recursion_dependencies(item.dependent_targets,podsPath,1+i,item.pod_name)
|
191
|
+
# end
|
192
|
+
# end
|
193
|
+
|
194
|
+
# map = Hash["name" => item.pod_name,"version" => item.version,"size" => size,"system" => "ios","type" => type,"childNodes" => childNodes]
|
195
|
+
# names.push(map)
|
196
|
+
|
197
|
+
# end
|
198
|
+
# @podHash[parent_pod_name] = names
|
199
|
+
# return names
|
200
|
+
# end
|
201
|
+
|
143
202
|
end
|
144
203
|
end
|
145
204
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
require 'openssl'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Jyanalyzer
|
8
|
+
class List < Jyanalyzer
|
9
|
+
include RepoUpdate
|
10
|
+
include ProjectDirectory
|
11
|
+
|
12
|
+
self.summary = '本地使用:查看app依赖库名列表,pod jyanalyzer list'
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('POD_NAMES', false, true),
|
16
|
+
]
|
17
|
+
def initialize(argv)
|
18
|
+
@pods = argv.arguments!
|
19
|
+
super
|
20
|
+
end
|
21
|
+
def run
|
22
|
+
|
23
|
+
verify_podfile_exists!
|
24
|
+
installer = installer_for_config
|
25
|
+
installer.repo_update = repo_update?(:default => true)
|
26
|
+
UI.puts 'Update all pods'.yellow
|
27
|
+
installer.update = true
|
28
|
+
installer.prepare
|
29
|
+
installer.resolve_dependencies
|
30
|
+
pod_targets = installer.pod_targets;
|
31
|
+
|
32
|
+
Pod::UI.puts '查看app依赖库名列表,pod jyanalyzer list'
|
33
|
+
|
34
|
+
text = recursion_dependencies(pod_targets)
|
35
|
+
Pod::UI.puts text
|
36
|
+
|
37
|
+
f=File.new("dependencies.json","w+")
|
38
|
+
f.puts(JSON.pretty_generate(text))
|
39
|
+
f.close
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
def recursion_dependencies(pod_targets)
|
44
|
+
text = {}
|
45
|
+
dependent_targets = pod_targets
|
46
|
+
dependent_targets.each do |item|
|
47
|
+
text[item.pod_name]=item.version
|
48
|
+
end
|
49
|
+
return text
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-jyanalyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- leo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- lib/cocoapods-jyanalyzer/command/jyanalyzer/app.rb
|
52
52
|
- lib/cocoapods-jyanalyzer/command/jyanalyzer/component.rb
|
53
53
|
- lib/cocoapods-jyanalyzer/command/jyanalyzer/depend.rb
|
54
|
+
- lib/cocoapods-jyanalyzer/command/jyanalyzer/list.rb
|
54
55
|
- lib/cocoapods-jyanalyzer/command/jyanalyzer/recursion.rb
|
55
56
|
- lib/cocoapods-jyanalyzer/gem_version.rb
|
56
57
|
- lib/cocoapods_plugin.rb
|