cocoapods-dependsay 0.1.0
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/.gitignore +3 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +116 -0
- data/LICENSE.txt +22 -0
- data/README.md +11 -0
- data/Rakefile +13 -0
- data/cocoapods-dependsay.gemspec +27 -0
- data/lib/cocoapods-dependsay.rb +1 -0
- data/lib/cocoapods-dependsay/command.rb +1 -0
- data/lib/cocoapods-dependsay/command/dependsay.rb +214 -0
- data/lib/cocoapods-dependsay/gem_version.rb +3 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/public/css/application.css +113 -0
- data/public/javascript/application.js +205 -0
- data/public/javascript/toolbox.js +223 -0
- data/public/javascript/websocket.js +613 -0
- data/spec/command/dependsay_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- data/views/index.erb +30 -0
- data/views/toolbox.erb +67 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 39008ef00a678b148b8dda47c539e0adcf776d64
|
4
|
+
data.tar.gz: 8e43d13d387d1271b6978a963b09c9aff7e112fa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 542b8809ec2e88513089e2c181d69d026bd6efd11fe884d09651538b22c3ad3568d2427d6c99b52f85c980a73e5d7db3c8b75361dd0862b208d939d64533f972
|
7
|
+
data.tar.gz: 5046fb27386b1fb71789d5729fb3d575892f228c9bb55a3a41c225ad941ddb1fcf8cd6183c6f59173c0f0ee8bfff27da467438b8e3b93b12c44dfd96ee8fcb6f
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cocoapods-dependsay (0.0.1)
|
5
|
+
parser (~> 2.3, >= 2.3.0)
|
6
|
+
rubocop (~> 0.57.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
CFPropertyList (3.0.0)
|
12
|
+
activesupport (4.2.10)
|
13
|
+
i18n (~> 0.7)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
ast (2.4.0)
|
18
|
+
atomos (0.1.2)
|
19
|
+
bacon (1.2.0)
|
20
|
+
claide (1.0.2)
|
21
|
+
cocoapods (1.5.3)
|
22
|
+
activesupport (>= 4.0.2, < 5)
|
23
|
+
claide (>= 1.0.2, < 2.0)
|
24
|
+
cocoapods-core (= 1.5.3)
|
25
|
+
cocoapods-deintegrate (>= 1.0.2, < 2.0)
|
26
|
+
cocoapods-downloader (>= 1.2.0, < 2.0)
|
27
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
28
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
29
|
+
cocoapods-stats (>= 1.0.0, < 2.0)
|
30
|
+
cocoapods-trunk (>= 1.3.0, < 2.0)
|
31
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
32
|
+
colored2 (~> 3.1)
|
33
|
+
escape (~> 0.0.4)
|
34
|
+
fourflusher (~> 2.0.1)
|
35
|
+
gh_inspector (~> 1.0)
|
36
|
+
molinillo (~> 0.6.5)
|
37
|
+
nap (~> 1.0)
|
38
|
+
ruby-macho (~> 1.1)
|
39
|
+
xcodeproj (>= 1.5.7, < 2.0)
|
40
|
+
cocoapods-core (1.5.3)
|
41
|
+
activesupport (>= 4.0.2, < 6)
|
42
|
+
fuzzy_match (~> 2.0.4)
|
43
|
+
nap (~> 1.0)
|
44
|
+
cocoapods-deintegrate (1.0.2)
|
45
|
+
cocoapods-downloader (1.2.1)
|
46
|
+
cocoapods-plugins (1.0.0)
|
47
|
+
nap
|
48
|
+
cocoapods-search (1.0.0)
|
49
|
+
cocoapods-stats (1.0.0)
|
50
|
+
cocoapods-trunk (1.3.0)
|
51
|
+
nap (>= 0.8, < 2.0)
|
52
|
+
netrc (~> 0.11)
|
53
|
+
cocoapods-try (1.1.0)
|
54
|
+
colored2 (3.1.2)
|
55
|
+
concurrent-ruby (1.0.5)
|
56
|
+
escape (0.0.4)
|
57
|
+
fourflusher (2.0.1)
|
58
|
+
fuzzy_match (2.0.4)
|
59
|
+
gh_inspector (1.1.3)
|
60
|
+
i18n (0.9.5)
|
61
|
+
concurrent-ruby (~> 1.0)
|
62
|
+
jaro_winkler (1.5.1)
|
63
|
+
metaclass (0.0.4)
|
64
|
+
minitest (5.11.3)
|
65
|
+
mocha (1.5.0)
|
66
|
+
metaclass (~> 0.0.1)
|
67
|
+
mocha-on-bacon (0.2.3)
|
68
|
+
mocha (>= 0.13.0)
|
69
|
+
molinillo (0.6.5)
|
70
|
+
nanaimo (0.2.6)
|
71
|
+
nap (1.1.0)
|
72
|
+
netrc (0.11.0)
|
73
|
+
parallel (1.12.1)
|
74
|
+
parser (2.5.1.0)
|
75
|
+
ast (~> 2.4.0)
|
76
|
+
powerpack (0.1.2)
|
77
|
+
prettybacon (0.0.2)
|
78
|
+
bacon (~> 1.2)
|
79
|
+
rainbow (3.0.0)
|
80
|
+
rake (12.3.1)
|
81
|
+
rubocop (0.57.2)
|
82
|
+
jaro_winkler (~> 1.5.1)
|
83
|
+
parallel (~> 1.10)
|
84
|
+
parser (>= 2.5)
|
85
|
+
powerpack (~> 0.1)
|
86
|
+
rainbow (>= 2.2.2, < 4.0)
|
87
|
+
ruby-progressbar (~> 1.7)
|
88
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
89
|
+
ruby-macho (1.2.0)
|
90
|
+
ruby-progressbar (1.9.0)
|
91
|
+
thread_safe (0.3.6)
|
92
|
+
tzinfo (1.2.5)
|
93
|
+
thread_safe (~> 0.1)
|
94
|
+
unicode-display_width (1.4.0)
|
95
|
+
xcodeproj (1.5.9)
|
96
|
+
CFPropertyList (>= 2.3.3, < 4.0)
|
97
|
+
atomos (~> 0.1.2)
|
98
|
+
claide (>= 1.0.2, < 2.0)
|
99
|
+
colored2 (~> 3.1)
|
100
|
+
nanaimo (~> 0.2.5)
|
101
|
+
|
102
|
+
PLATFORMS
|
103
|
+
ruby
|
104
|
+
|
105
|
+
DEPENDENCIES
|
106
|
+
bacon
|
107
|
+
bundler (~> 1.3)
|
108
|
+
cocoapods
|
109
|
+
cocoapods-dependsay!
|
110
|
+
mocha
|
111
|
+
mocha-on-bacon
|
112
|
+
prettybacon
|
113
|
+
rake
|
114
|
+
|
115
|
+
BUNDLED WITH
|
116
|
+
1.16.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2018 ddhjy <510893492@qq.com>
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods-dependsay/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-dependsay'
|
8
|
+
spec.version = CocoapodsDependsay::VERSION
|
9
|
+
spec.authors = ['ddhjy']
|
10
|
+
spec.email = ['510893492@qq.com']
|
11
|
+
spec.description = %q{A short description of cocoapods-dependsay.}
|
12
|
+
spec.summary = %q{A longer description of cocoapods-dependsay.}
|
13
|
+
spec.homepage = 'https://github.com/EXAMPLE/cocoapods-dependsay'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_runtime_dependency 'parser', '~> 2.3', '>= 2.3.0'
|
23
|
+
spec.add_runtime_dependency 'rubocop', '~> 0.57.2'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
26
|
+
spec.add_development_dependency 'rake'
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-dependsay/gem_version'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-dependsay/command/dependsay'
|
@@ -0,0 +1,214 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Dependsay < Command
|
4
|
+
include Command::ProjectDirectory
|
5
|
+
|
6
|
+
self.summary = "Visualize the project's dependencies."
|
7
|
+
|
8
|
+
self.description = <<-DESC
|
9
|
+
Visualize the project's dependencies.
|
10
|
+
DESC
|
11
|
+
|
12
|
+
def self.options
|
13
|
+
[
|
14
|
+
['--ignore-lockfile', 'Whether the lockfile should be ignored when calculating the dependency graph'],
|
15
|
+
['--repo-update', 'Fetch external podspecs and run `pod repo update` before calculating the dependency graph']
|
16
|
+
].concat(super)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.arguments
|
20
|
+
[
|
21
|
+
CLAide::Argument.new('PODSPEC', false)
|
22
|
+
].concat(super)
|
23
|
+
end
|
24
|
+
|
25
|
+
attr_reader :output
|
26
|
+
|
27
|
+
def initialize(argv)
|
28
|
+
@output = output_file
|
29
|
+
@podspec_name = argv.shift_argument
|
30
|
+
@ignore_lockfile = argv.flag?('ignore-lockfile', false)
|
31
|
+
@repo_update = argv.flag?('repo-update', false)
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
def output_file(path = nil)
|
36
|
+
File.open(path.nil? ? 'output.html' : path, 'w')
|
37
|
+
end
|
38
|
+
|
39
|
+
def validate!
|
40
|
+
super
|
41
|
+
if @podspec_name
|
42
|
+
require 'pathname'
|
43
|
+
path = Pathname.new(@podspec_name)
|
44
|
+
if path.file?
|
45
|
+
@podspec = Specification.from_file(path)
|
46
|
+
else
|
47
|
+
sets = Config
|
48
|
+
.instance
|
49
|
+
.sources_manager
|
50
|
+
.search(Dependency.new(@podspec_name))
|
51
|
+
spec = sets && sets.specification
|
52
|
+
@podspec = spec && spec.subspec_by_name(@podspec_name)
|
53
|
+
raise Informative, "Cannot find `#{@podspec_name}`." unless @podspec
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def run
|
59
|
+
UI.title 'Calculating dependencies' do
|
60
|
+
dependencies
|
61
|
+
end
|
62
|
+
output.write(erb(:index))
|
63
|
+
end
|
64
|
+
|
65
|
+
def toolbox?
|
66
|
+
false
|
67
|
+
end
|
68
|
+
|
69
|
+
def layout
|
70
|
+
'null'
|
71
|
+
end
|
72
|
+
|
73
|
+
def file(path)
|
74
|
+
File.read(resolve_file_path("/public/#{path}"))
|
75
|
+
end
|
76
|
+
|
77
|
+
def erb(template)
|
78
|
+
path = resolve_file_path("/views/#{template}.erb")
|
79
|
+
file = File.open(path).read
|
80
|
+
ERB.new(file).result binding
|
81
|
+
end
|
82
|
+
|
83
|
+
def resolve_file_path(path)
|
84
|
+
File.expand_path("../../../..#{path}", __FILE__)
|
85
|
+
end
|
86
|
+
|
87
|
+
def dependencies
|
88
|
+
@dependencies ||= begin
|
89
|
+
analyzer = Installer::Analyzer.new(
|
90
|
+
sandbox,
|
91
|
+
podfile,
|
92
|
+
@ignore_lockfile || @podspec ? nil : config.lockfile
|
93
|
+
)
|
94
|
+
|
95
|
+
specs = config.with_changes(skip_repo_update: !@repo_update) do
|
96
|
+
analyzer.analyze(@repo_update || @podspec).specs_by_target.values.flatten(1)
|
97
|
+
end
|
98
|
+
|
99
|
+
lockfile = Lockfile.generate(podfile, specs, {})
|
100
|
+
lockfile.to_hash['PODS']
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def podfile
|
105
|
+
@podfile ||= begin
|
106
|
+
if podspec = @podspec
|
107
|
+
platform = podspec.available_platforms.first
|
108
|
+
platform_name = platform.name
|
109
|
+
platform_version = platform.deployment_target.to_s
|
110
|
+
source_urls = Config.instance.sources_manager.all.map(&:url).compact
|
111
|
+
Podfile.new do
|
112
|
+
install! 'cocoapods', integrate_targets: false, warn_for_multiple_pod_sources: false
|
113
|
+
source_urls.each { |u| source(u) }
|
114
|
+
platform platform_name, platform_version
|
115
|
+
pod podspec.name, podspec: podspec.defined_in_file
|
116
|
+
target 'Dependencies'
|
117
|
+
end
|
118
|
+
else
|
119
|
+
verify_podfile_exists!
|
120
|
+
config.podfile
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def sandbox
|
126
|
+
if @podspec
|
127
|
+
require 'tmpdir'
|
128
|
+
Sandbox.new(Dir.mktmpdir)
|
129
|
+
else
|
130
|
+
config.sandbox
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def data
|
135
|
+
@data ||= begin
|
136
|
+
definitions = []
|
137
|
+
relations = []
|
138
|
+
pod_to_dependencies.each do |key, value|
|
139
|
+
definitions << {
|
140
|
+
'type' => 'Class',
|
141
|
+
'namespace' => key,
|
142
|
+
'circular' => false,
|
143
|
+
'line' => 0,
|
144
|
+
'lines' => 0
|
145
|
+
}
|
146
|
+
end
|
147
|
+
|
148
|
+
pod_to_dependencies.each do |key, value|
|
149
|
+
value.each do |v|
|
150
|
+
relations << {
|
151
|
+
'type' => 'Base',
|
152
|
+
'resolved_namespace' => pick(v, definitions),
|
153
|
+
'caller' => key,
|
154
|
+
'circular' => false,
|
155
|
+
'lines' => 0
|
156
|
+
}
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
definitions.each do |value|
|
161
|
+
ns = value['namespace']
|
162
|
+
relations.each do |v|
|
163
|
+
value['lines'] += 1 if [v['caller'], v['resolved_namespace']].include? ns
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
definitions.each do |value|
|
168
|
+
value['namespace'] = name_transform(value['namespace'])
|
169
|
+
end
|
170
|
+
|
171
|
+
relations.each do |value|
|
172
|
+
value['resolved_namespace'] = name_transform(value['resolved_namespace'])
|
173
|
+
value['caller'] = name_transform(value['caller'])
|
174
|
+
end
|
175
|
+
|
176
|
+
data = { 'definitions' => definitions, 'relations' => relations }
|
177
|
+
data.to_s.gsub(/=>/, ':')
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
def name_transform(name)
|
182
|
+
name.instance_of?(String) ? name.gsub(/ \(/,"@").gsub(/\./, "-").gsub(/\)/, "") : name
|
183
|
+
end
|
184
|
+
|
185
|
+
def pick(key, pool)
|
186
|
+
pool.each do |v|
|
187
|
+
return v['namespace'] if sanitized_pod_name(key) == sanitized_pod_name(v['namespace'])
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Truncates the input string after a pod's name removing version requirements, etc.
|
192
|
+
def sanitized_pod_name(name)
|
193
|
+
Pod::Dependency.from_string(name).name
|
194
|
+
end
|
195
|
+
|
196
|
+
# Returns a Set of Strings of the names of dependencies specified in the Podfile.
|
197
|
+
def podfile_dependencies
|
198
|
+
Set.new(podfile.target_definitions.values.map { |t| t.dependencies.map { |d| d.name } }.flatten)
|
199
|
+
end
|
200
|
+
|
201
|
+
# Returns a [String: [String]] containing resolved mappings from the name of a pod to an array of the names of its dependencies.
|
202
|
+
def pod_to_dependencies
|
203
|
+
dependencies.map { |d| d.is_a?(Hash) ? d : { d => [] } }.reduce({}) { |combined, individual| combined.merge!(individual) }
|
204
|
+
end
|
205
|
+
|
206
|
+
# Basename to use for output files.
|
207
|
+
def output_file_basename
|
208
|
+
return 'Podfile' unless @podspec_name
|
209
|
+
File.basename(@podspec_name, File.extname(@podspec_name))
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|