cocoapods-dependencies 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6df1521f948464f5de577e826da141c40a7dbc5e
4
- data.tar.gz: 65a4380ebca179b108a9793cc8c877aafacf3478
3
+ metadata.gz: c62b19e52b44f498923e9b8c5dda196b19300301
4
+ data.tar.gz: 8406d8fbed988e9c50c1754db0b3d8d17722c1e3
5
5
  SHA512:
6
- metadata.gz: c01ff988b603af73bc674446b24767529f6e88a681895e6d7a97f6fc8b8bcdeddfa13e12431b8a5bd46a4abc57bd6c3a093f3ebc4f6ec6b170ea8b22ce4f6f3c
7
- data.tar.gz: 0d729655c79bb6b07c6bfc28b90edce9d94952a6a78ec48275ff67122022bd71b8e6859887710bbef82256b447a8e597f21f8acc65d402c57f65ecb6abf6a55d
6
+ metadata.gz: 55eb4c6e400cd90b23c7288903774738293956161e82d73b98fa23b51c53dab663eb8863b0fcc4af08927c8041f5039058bd55040ca989b1e2974008db3e6b69
7
+ data.tar.gz: e991098dada99151aa528353c545606253dc97339390ba10466a85ee711e67d165242c51575be94cc1e6b12010ea92b27167847bda0fa11a174bf9555bd92fa9
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocoapods-dependencies (0.5.0)
4
+ cocoapods-dependencies (0.5.1)
5
5
  ruby-graphviz (~> 1.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- rake (10.2.2)
10
+ rake (10.4.2)
11
11
  ruby-graphviz (1.2.2)
12
12
 
13
13
  PLATFORMS
@@ -19,4 +19,4 @@ DEPENDENCIES
19
19
  rake
20
20
 
21
21
  BUNDLED WITH
22
- 1.10.5
22
+ 1.10.6
data/README.md CHANGED
@@ -20,3 +20,5 @@ $ pod dependencies [PODSPEC] [--graphviz] [--image]
20
20
  Use the `--graphviz` option to generate `<podspec name>.gv` or `Podfile.gv` containing the dependency graph in graphviz format.
21
21
 
22
22
  Use the `--image` option to generate `<podsepc name>.png` or `Podfile.png` containing a rendering of the dependency graph.
23
+
24
+ [!] Note that for either graphviz or image output, GraphViz must be installed and `dot` must be accessible via `$PATH`.
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  module Dependencies
3
- VERSION = '0.5.0'
3
+ VERSION = '0.5.1'
4
4
  end
5
5
  end
@@ -45,10 +45,13 @@ module Pod
45
45
  subspec_by_name(@podspec_name)
46
46
  end
47
47
  end
48
+ if (@produce_image_output || @produce_graphviz_output) && Executable.which('dot').nil?
49
+ raise Informative, 'GraphViz must be installed and `dot` must be in ' \
50
+ '$PATH to produce image or graphviz output.'
51
+ end
48
52
  end
49
53
 
50
54
  def run
51
- require 'graphviz'
52
55
  require 'yaml'
53
56
  graphviz_image_output if @produce_image_output
54
57
  graphviz_dot_output if @produce_graphviz_output
@@ -102,19 +105,20 @@ module Pod
102
105
  config.sandbox
103
106
  end
104
107
  end
105
-
108
+
106
109
  def graphviz_data
107
110
  @graphviz ||= begin
111
+ require 'graphviz'
108
112
  graph = GraphViz::new(output_file_basename, :type => :digraph)
109
113
  root = graph.add_node(output_file_basename)
110
-
114
+
111
115
  unless @podspec
112
116
  podfile_dependencies.each do |pod|
113
117
  pod_node = graph.add_node(pod)
114
118
  graph.add_edge(root, pod_node)
115
119
  end
116
120
  end
117
-
121
+
118
122
  pod_to_dependencies.each do |pod, dependencies|
119
123
  pod_node = graph.add_node(sanitized_pod_name(pod))
120
124
  dependencies.each do |dependency|
@@ -122,48 +126,48 @@ module Pod
122
126
  graph.add_edge(pod_node, dep_node)
123
127
  end
124
128
  end
125
-
129
+
126
130
  graph
127
131
  end
128
132
  end
129
-
133
+
130
134
  # Truncates the input string after a pod's name removing version requirements, etc.
131
135
  def sanitized_pod_name(name)
132
136
  match = /([\w_\/]+)( \(.*\))?/.match(name)
133
137
  match ? match[1] : name
134
138
  end
135
-
136
- # Returns a Set of Strings of the names of dependencies specified in the Podfile.
139
+
140
+ # Returns a Set of Strings of the names of dependencies specified in the Podfile.
137
141
  def podfile_dependencies
138
142
  Set.new(podfile.target_definitions.values.map { |t| t.dependencies.map { |d| d.name } }.flatten)
139
143
  end
140
-
144
+
141
145
  # Returns a [String] of the names of dependencies specified in the podspec.
142
146
  def podspec_dependencies
143
147
  @podspec.all_dependencies.map { |d| d.name }
144
148
  end
145
-
149
+
146
150
  # Returns a [String: [String]] containing resolved mappings from the name of a pod to an array of the names of its dependencies.
147
151
  def pod_to_dependencies
148
152
  dependencies.map { |d| d.is_a?(Hash) ? d : { d => [] } }.reduce({}) { |combined, individual| combined.merge!(individual) }
149
153
  end
150
-
154
+
151
155
  # Basename to use for output files.
152
156
  def output_file_basename
153
157
  return 'Podfile' unless @podspec_name
154
158
  File.basename(@podspec_name, File.extname(@podspec_name))
155
159
  end
156
-
160
+
157
161
  def yaml_output
158
162
  UI.title 'Dependencies' do
159
163
  UI.puts dependencies.to_yaml
160
164
  end
161
165
  end
162
-
166
+
163
167
  def graphviz_image_output
164
168
  graphviz_data.output( :png => "#{output_file_basename}.png")
165
169
  end
166
-
170
+
167
171
  def graphviz_dot_output
168
172
  graphviz_data.output( :dot => "#{output_file_basename}.gv")
169
173
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-dependencies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel E. Giddins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-03 00:00:00.000000000 Z
11
+ date: 2015-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,4 +94,3 @@ signing_key:
94
94
  specification_version: 4
95
95
  summary: Shows a project's CocoaPods dependency graph.
96
96
  test_files: []
97
- has_rdoc: