cocoapods-why 1.0.0 → 1.0.1
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/cocoapods_why.rb +1 -1
- data/lib/pod/command/why.rb +21 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c3cff85c9714857f4d2291c3abb3478cabc3564c31398ec078a8a681b3b2786
|
4
|
+
data.tar.gz: 1a87098be80cc339392007248aecd0f8b2dd92259e2e978217ab512c6157275e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee8d9a9bb28c0e180a124d22ae99cdc37c25983c284ae003bb4e57834306999f05c172c145852283361a9fdf3f746dc3a54c52f07cc6bb2d5da6d52b02e3533c
|
7
|
+
data.tar.gz: c173fc047350aa91f209eb90b3a239ac81ee9950af471a4054f910d1b570edfc20fd2193f5b78e0870b20aee11017d96be0ea7f4525a6a5110cfafdbc5326149
|
data/lib/cocoapods_why.rb
CHANGED
data/lib/pod/command/why.rb
CHANGED
@@ -80,8 +80,9 @@ module Pod
|
|
80
80
|
# @return [Hash<String,Array<String>>] a mapping of pod names to their direct dependencies
|
81
81
|
def all_dependencies(targets)
|
82
82
|
targets.to_h do |target|
|
83
|
-
|
84
|
-
|
83
|
+
deps = target[:dependencies] || []
|
84
|
+
deps = deps.delete_if { |dep| dep.include? '/' } # Remove subspecs
|
85
|
+
[target[:name], deps]
|
85
86
|
end
|
86
87
|
end
|
87
88
|
|
@@ -101,10 +102,16 @@ module Pod
|
|
101
102
|
end
|
102
103
|
|
103
104
|
# Computes and returns all possible paths between a source vertex and a target vertex in a directed graph.
|
104
|
-
# It does this by performing a DFS and, whenever the target is discovered (or re-discovered), the current
|
105
|
-
# DFS stack is captured as one of the possible paths.
|
106
105
|
#
|
107
|
-
#
|
106
|
+
# It does this by performing a recursive walk through the graph (like DFS). After returning from a recursive
|
107
|
+
# descent through all of a vertex's edges, the vertex is prepended to each returned path and in this way the
|
108
|
+
# list of all paths is built up. The recursion stops when the target vertex is discovered.
|
109
|
+
#
|
110
|
+
# The algorithm described above is exponential in running time, so memoization is used to speed it up.
|
111
|
+
# After all paths from a vertex are discovered, the results are stored in a hash. Before processing a vertex,
|
112
|
+
# this hash is queried for a previously stored result, which if found is returned instead of recomputed.
|
113
|
+
#
|
114
|
+
# @note The input graph is assumed to be acyclic.
|
108
115
|
#
|
109
116
|
# @param [String] source
|
110
117
|
# The vertex at which to begin the search.
|
@@ -115,20 +122,16 @@ module Pod
|
|
115
122
|
#
|
116
123
|
# @return [Array<Array<String>>] a list of all paths from source to target
|
117
124
|
def all_paths(source, target, graph)
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
visitor.set_forward_edge_event_handler do |_, v|
|
126
|
-
dfs_stack << v
|
127
|
-
all_paths << dfs_stack.dup if v == target
|
128
|
-
dfs_stack.pop
|
125
|
+
|
126
|
+
def search(source, target, graph, all_paths)
|
127
|
+
return all_paths[source] if all_paths.key?(source)
|
128
|
+
return [[target]] if source == target
|
129
|
+
source_paths = []
|
130
|
+
graph.each_adjacent(source) { |v| source_paths += search(v, target, graph, all_paths) }
|
131
|
+
all_paths[source] = source_paths.map { |path| [source] + path }
|
129
132
|
end
|
130
|
-
|
131
|
-
|
133
|
+
|
134
|
+
search(source, target, graph, {})
|
132
135
|
end
|
133
136
|
|
134
137
|
# Converts a list of dependency paths into a graph. The vertices in the paths are
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-why
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Harmon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|