cocoapods-jyanalyzer 0.0.5
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 +7 -0
- data/lib/cocoapods-jyanalyzer.rb +1 -0
- data/lib/cocoapods-jyanalyzer/command.rb +1 -0
- data/lib/cocoapods-jyanalyzer/command/jyanalyzer.rb +20 -0
- data/lib/cocoapods-jyanalyzer/command/jyanalyzer/app.rb +127 -0
- data/lib/cocoapods-jyanalyzer/command/jyanalyzer/depend.rb +89 -0
- data/lib/cocoapods-jyanalyzer/command/jyanalyzer/recursion.rb +147 -0
- data/lib/cocoapods-jyanalyzer/gem_version.rb +3 -0
- data/lib/cocoapods_plugin.rb +1 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0eba382f610b90bcb5ed3fb439e1024179f8af65
|
4
|
+
data.tar.gz: e525039d928e690e1799ead6f11eaa214df70762
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3f6a0cbce5500130a2b050af71c6969d3d13a02dd0a3f9777c55fe5dd0d0a8741ad56047f24f9c452863928758da01eadbc40081829d2f43e7cc823705c84bed
|
7
|
+
data.tar.gz: 1a138fa0210e1bc83338f29f13e297a89188eee5fa9eeb79ad35b46ab315e10ce086df3f82ab9fecb9fd977f7645349c36dd91fca9e580ca3c5db51bfe4f79a8
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-jyanalyzer/gem_version'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-jyanalyzer/command/jyanalyzer'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Jyanalyzer < Command
|
4
|
+
|
5
|
+
require 'cocoapods-jyanalyzer/command/jyanalyzer/app'
|
6
|
+
require 'cocoapods-jyanalyzer/command/jyanalyzer/recursion'
|
7
|
+
require 'cocoapods-jyanalyzer/command/jyanalyzer/depend'
|
8
|
+
|
9
|
+
self.abstract_command = true
|
10
|
+
self.default_subcommand = 'app'
|
11
|
+
self.summary = '哈啰pod依赖分析'
|
12
|
+
|
13
|
+
self.description = <<-DESC
|
14
|
+
哈啰pod依赖分析:recursion、app 这是给服务端用的,请勿使用
|
15
|
+
|
16
|
+
本地使用 depend 命令即可
|
17
|
+
DESC
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
require 'openssl'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Jyanalyzer
|
8
|
+
class App < Jyanalyzer
|
9
|
+
include RepoUpdate
|
10
|
+
include ProjectDirectory
|
11
|
+
|
12
|
+
self.summary = '服务端使用:获取app所依赖的库和版本, 使用: pod jyanalyzer app appId=appId branch=branch packageId=packageId businessId=businessId componentId=componentId api_url=api_url'
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('POD_NAMES', false, true),
|
16
|
+
CLAide::Argument.new('TAG', true)
|
17
|
+
]
|
18
|
+
|
19
|
+
def initialize(argv)
|
20
|
+
@pods = argv.arguments!
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
|
26
|
+
appId = ""
|
27
|
+
branch = ""
|
28
|
+
packageId = ""
|
29
|
+
businessId = ""
|
30
|
+
componentId = ""
|
31
|
+
api_url = "https://sunflower.hellobike.cn:20000/plugin/setDependLibrary"
|
32
|
+
|
33
|
+
@pods.each do |item|
|
34
|
+
map = item.split("=")
|
35
|
+
if map[0] == "appId"
|
36
|
+
appId = map[1]
|
37
|
+
elsif map[0] == "branch"
|
38
|
+
branch=map[1]
|
39
|
+
elsif map[0] == "packageId"
|
40
|
+
packageId = map[1]
|
41
|
+
elsif map[0] == "businessId"
|
42
|
+
businessId = map[1]
|
43
|
+
elsif map[0] == "componentId"
|
44
|
+
componentId = map[1]
|
45
|
+
elsif map[0] == "api_url"
|
46
|
+
api_url = map[1]
|
47
|
+
else
|
48
|
+
Pod::UI.puts " "
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
if appId.empty?
|
53
|
+
UI.puts 'appId 不可为空'
|
54
|
+
exit 2
|
55
|
+
end
|
56
|
+
|
57
|
+
if branch.empty?
|
58
|
+
UI.puts 'branch 不可为空'
|
59
|
+
exit 2
|
60
|
+
end
|
61
|
+
|
62
|
+
if packageId.empty?
|
63
|
+
UI.puts 'packageId 不可为空'
|
64
|
+
exit 2
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
verify_podfile_exists!
|
69
|
+
installer = installer_for_config
|
70
|
+
installer.repo_update = repo_update?(:default => true)
|
71
|
+
# installer.clean_install = @clean_install
|
72
|
+
UI.puts 'Update all pods'.yellow
|
73
|
+
installer.update = true
|
74
|
+
installer.prepare
|
75
|
+
installer.resolve_dependencies
|
76
|
+
pod_targets = installer.pod_targets;
|
77
|
+
|
78
|
+
Pod::UI.puts "获取app所依赖的库和版本, 使用: pod jyanalyzer app"
|
79
|
+
names = Array.new
|
80
|
+
pod_targets.each do |item|
|
81
|
+
map = Hash["name" => item.pod_name,"version" => item.version]
|
82
|
+
names.push(map)
|
83
|
+
end
|
84
|
+
|
85
|
+
body = Hash["appId" => appId,
|
86
|
+
"branch" => branch,
|
87
|
+
"packageId" => packageId,
|
88
|
+
"businessId" => businessId,
|
89
|
+
"componentId" => componentId,
|
90
|
+
"appDependLibraryVOList" => names]
|
91
|
+
|
92
|
+
Pod::UI.puts JSON.pretty_generate(body).yellow
|
93
|
+
|
94
|
+
|
95
|
+
url = URI.parse(api_url)
|
96
|
+
http = Net::HTTP.new(url.host, url.port)
|
97
|
+
http.use_ssl = true if url.scheme == "https" # enable SSL/TLS
|
98
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE #这个也很重要
|
99
|
+
# 设置请求参数
|
100
|
+
data = body.to_json
|
101
|
+
# 设置请求头
|
102
|
+
header = {'content-type':'application/json'}
|
103
|
+
response = http.post(url, data, header)
|
104
|
+
|
105
|
+
puts response.body
|
106
|
+
puts response.code
|
107
|
+
|
108
|
+
if "#{response.code}" == "200"
|
109
|
+
result = JSON.parse(response.body)
|
110
|
+
if result["status"] == 0
|
111
|
+
puts "请求成功"
|
112
|
+
else
|
113
|
+
puts "返回结果一异常"
|
114
|
+
exit 2
|
115
|
+
end
|
116
|
+
|
117
|
+
else
|
118
|
+
puts "请求服务器失败"
|
119
|
+
exit 2
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
require 'openssl'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Jyanalyzer
|
8
|
+
class Depend < Jyanalyzer
|
9
|
+
include RepoUpdate
|
10
|
+
include ProjectDirectory
|
11
|
+
|
12
|
+
self.summary = '本地使用:查看app依赖关系,pod jyanalyzer depend'
|
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 depend'
|
33
|
+
|
34
|
+
text = recursion_dependencies(pod_targets,0)
|
35
|
+
Pod::UI.puts text
|
36
|
+
|
37
|
+
f=File.new("dependencies.lock","w+")
|
38
|
+
f.puts(text)
|
39
|
+
f.close
|
40
|
+
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
def recursion_dependencies(pod_targets,index)
|
45
|
+
if index == 2
|
46
|
+
return ""
|
47
|
+
end
|
48
|
+
text = ""
|
49
|
+
dependent_targets = Array.new
|
50
|
+
|
51
|
+
if pod_targets.is_a? Array
|
52
|
+
dependent_targets = pod_targets
|
53
|
+
else
|
54
|
+
dependent_targets = pod_targets.dependent_targets
|
55
|
+
end
|
56
|
+
|
57
|
+
dependent_targets.each do |item|
|
58
|
+
|
59
|
+
$i = 0
|
60
|
+
$num = index
|
61
|
+
while $i < $num do
|
62
|
+
if $i == $num -1
|
63
|
+
text = text + "- "
|
64
|
+
else
|
65
|
+
text = text + " "
|
66
|
+
end
|
67
|
+
|
68
|
+
$i +=1
|
69
|
+
end
|
70
|
+
|
71
|
+
text = text + item.pod_name + "(" + item.version + ")" + "\n"
|
72
|
+
|
73
|
+
if !item.dependent_targets.empty?
|
74
|
+
text = text + recursion_dependencies(item.dependent_targets,index + 1)
|
75
|
+
end
|
76
|
+
if index == 0
|
77
|
+
text = text + "\n"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
return text
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
|
@@ -0,0 +1,147 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
require 'openssl'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Jyanalyzer
|
8
|
+
class Recursion < Jyanalyzer
|
9
|
+
include RepoUpdate
|
10
|
+
include ProjectDirectory
|
11
|
+
|
12
|
+
self.summary = '服务端使用:获取pod递归依赖,pod jyanalyzer recursion appId=appId branch=branch packageId=packageId api_url=api_url'
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('POD_NAMES', false, true),
|
16
|
+
]
|
17
|
+
def initialize(argv)
|
18
|
+
@pods = argv.arguments!
|
19
|
+
|
20
|
+
super
|
21
|
+
end
|
22
|
+
def run
|
23
|
+
|
24
|
+
appId=""
|
25
|
+
branch=""
|
26
|
+
packageId=""
|
27
|
+
api_url="https://sunflower.hellobike.cn:20000/plugin/setDependInfo"
|
28
|
+
|
29
|
+
@pods.each do |item|
|
30
|
+
map = item.split("=")
|
31
|
+
if map[0] == "appId"
|
32
|
+
appId = map[1]
|
33
|
+
elsif map[0] == "branch"
|
34
|
+
branch=map[1]
|
35
|
+
elsif map[0] == "packageId"
|
36
|
+
packageId = map[1]
|
37
|
+
elsif map[0] == "api_url"
|
38
|
+
api_url = map[1]
|
39
|
+
else
|
40
|
+
Pod::UI.puts " "
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
if appId.empty?
|
45
|
+
UI.puts 'appId 不可为空'
|
46
|
+
exit 2
|
47
|
+
end
|
48
|
+
|
49
|
+
if branch.empty?
|
50
|
+
UI.puts 'branch 不可为空'
|
51
|
+
exit 2
|
52
|
+
end
|
53
|
+
|
54
|
+
if packageId.empty?
|
55
|
+
UI.puts 'packageId 不可为空'
|
56
|
+
exit 2
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
verify_podfile_exists!
|
61
|
+
|
62
|
+
installer = installer_for_config
|
63
|
+
installer.repo_update = repo_update?(:default => true)
|
64
|
+
# installer.clean_install = @clean_install
|
65
|
+
UI.puts 'Update all pods'.yellow
|
66
|
+
installer.update = true
|
67
|
+
installer.prepare
|
68
|
+
installer.resolve_dependencies
|
69
|
+
pod_targets = installer.pod_targets;
|
70
|
+
|
71
|
+
Pod::UI.puts "获取pod递归依赖,pod jyanalyzer recursion"
|
72
|
+
|
73
|
+
names = Array.new
|
74
|
+
pod_targets.each do |item|
|
75
|
+
|
76
|
+
depends = recursion_dependencies(item)
|
77
|
+
|
78
|
+
depends.each do | info |
|
79
|
+
array = []
|
80
|
+
array << info
|
81
|
+
depends = depends - array
|
82
|
+
depends << info
|
83
|
+
end
|
84
|
+
|
85
|
+
dependent_pods = recursion_dependencies(item)
|
86
|
+
map = Hash["name" => item.pod_name,"version" => item.version,"depend" => depends]
|
87
|
+
names.push(map)
|
88
|
+
end
|
89
|
+
|
90
|
+
body = Hash["appId" => appId,
|
91
|
+
"branch" => branch,
|
92
|
+
"packageId" => packageId,
|
93
|
+
"libraryDependList" => names]
|
94
|
+
Pod::UI.puts JSON.pretty_generate(body).yellow
|
95
|
+
|
96
|
+
url = URI.parse(api_url)
|
97
|
+
http = Net::HTTP.new(url.host, url.port)
|
98
|
+
http.use_ssl = true if url.scheme == "https" # enable SSL/TLS
|
99
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE #这个也很重要
|
100
|
+
# 设置请求参数
|
101
|
+
data = body.to_json
|
102
|
+
# 设置请求头
|
103
|
+
header = {'content-type':'application/json'}
|
104
|
+
response = http.post(url, data, header)
|
105
|
+
puts response.body
|
106
|
+
puts response.code
|
107
|
+
|
108
|
+
if "#{response.code}" == "200"
|
109
|
+
result = JSON.parse(response.body)
|
110
|
+
if result["status"] == 0
|
111
|
+
puts "请求成功"
|
112
|
+
else
|
113
|
+
puts "返回结果一异常"
|
114
|
+
exit 2
|
115
|
+
end
|
116
|
+
|
117
|
+
else
|
118
|
+
puts "请求服务器失败"
|
119
|
+
exit 2
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
def recursion_dependencies(pod_target)
|
125
|
+
|
126
|
+
names = Array.new
|
127
|
+
pod_targets = pod_target.dependent_targets
|
128
|
+
|
129
|
+
pod_targets.each do |item|
|
130
|
+
map = Hash["name" => item.pod_name,"version" => item.version]
|
131
|
+
names.push(map)
|
132
|
+
|
133
|
+
if item.dependent_targets.empty?
|
134
|
+
puts ""
|
135
|
+
else
|
136
|
+
news = recursion_dependencies(item)
|
137
|
+
names = names + news
|
138
|
+
end
|
139
|
+
end
|
140
|
+
return names
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-jyanalyzer/command'
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-jyanalyzer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- 黄磊
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A short description of cocoapods-jyanalyzer.
|
42
|
+
email:
|
43
|
+
- 2624241712@qq.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- lib/cocoapods-jyanalyzer.rb
|
49
|
+
- lib/cocoapods-jyanalyzer/command.rb
|
50
|
+
- lib/cocoapods-jyanalyzer/command/jyanalyzer.rb
|
51
|
+
- lib/cocoapods-jyanalyzer/command/jyanalyzer/app.rb
|
52
|
+
- lib/cocoapods-jyanalyzer/command/jyanalyzer/depend.rb
|
53
|
+
- lib/cocoapods-jyanalyzer/command/jyanalyzer/recursion.rb
|
54
|
+
- lib/cocoapods-jyanalyzer/gem_version.rb
|
55
|
+
- lib/cocoapods_plugin.rb
|
56
|
+
homepage: https://github.com/EXAMPLE/cocoapods-jyanalyzer
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.6.14
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: A longer description of cocoapods-jyanalyzer.
|
80
|
+
test_files: []
|