pandan 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.rubocop.yml +12 -0
- data/.rubocop_todo.yml +26 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/CONTRIBUTING.md +5 -0
- data/Gemfile +8 -0
- data/LICENSE.md +21 -0
- data/README.md +47 -0
- data/Rakefile +6 -0
- data/bin/pandan +6 -0
- data/images/sample_dependencies.png +0 -0
- data/images/sample_setup.png +0 -0
- data/lib/pandan.rb +9 -0
- data/lib/pandan/command.rb +17 -0
- data/lib/pandan/command/dependency_graph.rb +85 -0
- data/lib/pandan/command/query.rb +61 -0
- data/lib/pandan/command/targets.rb +44 -0
- data/lib/pandan/graph.rb +78 -0
- data/lib/pandan/parser.rb +19 -0
- data/lib/pandan/version.rb +3 -0
- data/lib/pandan/xcodeproj/user_interface.rb +7 -0
- data/lib/pandan/xcworkspace.rb +9 -0
- data/pandan.gemspec +32 -0
- metadata +159 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 900b67b6cb939c129f2bf77dc1a35c310eab06fc
|
4
|
+
data.tar.gz: fe743a16dfd898ea146b60befdfd512b37075dc9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b73adbbefe5cdca382ac34722e2fb1fb8b192e2f0892849744cb6bd2a32a67112bb924cc9ca9eb2f7aa79b9ad5a4964edf8d60ee1340fa4c29649a617bb43ec9
|
7
|
+
data.tar.gz: fe7aaecc55f3e6794db2f5a3259dff4525653ec6f7720bcab6e6f700472ddda6067bdc0e675e5d313458eae0f3a6a184a3e5ba60668da273f458c35f9fe9d334
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2017-03-23 19:05:08 +0100 using RuboCop version 0.47.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
Metrics/AbcSize:
|
11
|
+
Max: 21
|
12
|
+
|
13
|
+
# Offense count: 10
|
14
|
+
Style/Documentation:
|
15
|
+
Exclude:
|
16
|
+
- 'spec/**/*'
|
17
|
+
- 'test/**/*'
|
18
|
+
- 'lib/pandan.rb'
|
19
|
+
- 'lib/pandan/command.rb'
|
20
|
+
- 'lib/pandan/command/dependency_graph.rb'
|
21
|
+
- 'lib/pandan/command/query.rb'
|
22
|
+
- 'lib/pandan/command/targets.rb'
|
23
|
+
- 'lib/pandan/graph.rb'
|
24
|
+
- 'lib/pandan/parser.rb'
|
25
|
+
- 'lib/pandan/xcodeproj/user_interface.rb'
|
26
|
+
- 'lib/pandan/xcworkspace.rb'
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at renzo.crisostomo@xing.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
## Contributing
|
2
|
+
|
3
|
+
GitHub Issues is for reporting bugs, discussing features and general feedback in `pandan`. Be sure to check our past issues before opening any new issues.
|
4
|
+
|
5
|
+
If you are posting about a crash, a stack trace is helpful, but additional context, in the form of code and explanation, is necessary to be of any use.
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 XING Developers
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Pandan
|
2
|
+
|
3
|
+
> Pandanus amaryllifolius is a tropical plant in the Pandanus (screwpine) genus, which is commonly known as pandan leaves, and is used widely in South Asian and Southeast Asian cooking as a flavoring.
|
4
|
+
> —[Wikipedia](https://en.wikipedia.org/wiki/Pandanus_amaryllifolius)
|
5
|
+
|
6
|
+
`pandan` is a CLI tool that outputs dependency information from a set of Xcode projects with targets that depend on each other, it does it by creating a (reverse) dependency graph using the information in "Link Binary with Libraries" build phase and doing a breadth-first search.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
`pandan` is distributed as a Ruby gem and can be installed using the following command:
|
11
|
+
|
12
|
+
```bash
|
13
|
+
$ gem install pandan
|
14
|
+
```
|
15
|
+
|
16
|
+
## Motivation
|
17
|
+
|
18
|
+
At XING, CocoaPods helped us to manage our Objective-C and Swift dependencies for a long time. But as our team grew, it was evident to us that CocoaPods was not tool we needed anymore. We decided to migrate all our projects to different setup that uses multiple Xcode projects, targets and xcconfig files under a single workspace, but we were lacking a tool that would give us dependency information out of the settings that are already in place in Xcode.
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Given the following project setup:
|
23
|
+
|
24
|
+
![sample_setup](images/sample_setup.png)
|
25
|
+
|
26
|
+
where additionally to this, SampleFrameworkD links against SampleFrameworkE:
|
27
|
+
|
28
|
+
```bash
|
29
|
+
$ pandan query SampleFrameworkB # will output:
|
30
|
+
SampleFrameworkC
|
31
|
+
SampleFrameworkE
|
32
|
+
SampleFrameworkD
|
33
|
+
```
|
34
|
+
|
35
|
+
You can generate a complete dependency graph of your workspace that is output as a PNG image. It's a good idea to exclude targets with names ending in "Tests" for a more tidy graph:
|
36
|
+
|
37
|
+
```bash
|
38
|
+
$ pandan dependency-graph --image --filter='^(?!.*Tests$).*$'
|
39
|
+
```
|
40
|
+
|
41
|
+
![sample_dependencies](images/sample_dependencies.png)
|
42
|
+
|
43
|
+
For a complete and up-to-date usage description, execute:
|
44
|
+
|
45
|
+
```bash
|
46
|
+
$ pandan --help
|
47
|
+
```
|
data/Rakefile
ADDED
data/bin/pandan
ADDED
Binary file
|
Binary file
|
data/lib/pandan.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'claide'
|
2
|
+
require 'pandan/version'
|
3
|
+
|
4
|
+
module Pandan
|
5
|
+
class Command < CLAide::Command
|
6
|
+
require 'pandan/command/query'
|
7
|
+
require 'pandan/command/targets'
|
8
|
+
require 'pandan/command/dependency_graph'
|
9
|
+
|
10
|
+
self.abstract_command = true
|
11
|
+
self.command = 'pandan'
|
12
|
+
self.version = Pandan::VERSION
|
13
|
+
self.description = <<-DESC
|
14
|
+
Retrieve Xcode dependency information with ease.
|
15
|
+
DESC
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'pandan/command'
|
2
|
+
require 'pandan/parser'
|
3
|
+
require 'pandan/graph'
|
4
|
+
require 'pandan/xcworkspace'
|
5
|
+
require 'graphviz'
|
6
|
+
|
7
|
+
module Pandan
|
8
|
+
class DependencyGraph < Command
|
9
|
+
def self.options
|
10
|
+
[
|
11
|
+
['--xcworkspace=path/to/workspace', 'If not set, Pandan will try to find a workspace'],
|
12
|
+
['--graphviz', 'Outputs the dependency graph in GraphViz format'],
|
13
|
+
['--image', 'Outputs the dependency graph as a PNG image'],
|
14
|
+
['--filter=expression', 'If set, pandan will select all targets whose name match the regular expression']
|
15
|
+
].concat(super)
|
16
|
+
end
|
17
|
+
|
18
|
+
self.summary = <<-DESC
|
19
|
+
Saves a dependency graph of the Xcode workspace
|
20
|
+
DESC
|
21
|
+
|
22
|
+
def initialize(argv)
|
23
|
+
@xcworkspace = argv.option('xcworkspace')
|
24
|
+
@xcworkspace ||= XCWorkspace.find_workspace
|
25
|
+
@save_gv = argv.flag?('graphviz')
|
26
|
+
@save_png = argv.flag?('image')
|
27
|
+
@filter = argv.option('filter')
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
def validate!
|
32
|
+
super
|
33
|
+
help! 'Could not find the workspace. Try setting it manually using the --xcworkspace option.' unless @xcworkspace
|
34
|
+
|
35
|
+
if `which tred`.empty?
|
36
|
+
help! 'Pandan requires GraphViz to generate the dependency graph. '\
|
37
|
+
'Please install it, e.g. with Homebrew: `brew install graphviz`.'
|
38
|
+
end
|
39
|
+
|
40
|
+
help! 'Please use at least one of --graphviz and --image.' if @save_gv.nil? && @save_png.nil?
|
41
|
+
end
|
42
|
+
|
43
|
+
def run
|
44
|
+
parser = Parser.new(@xcworkspace, @filter)
|
45
|
+
targets = parser.all_targets
|
46
|
+
graph = Graph.new(false)
|
47
|
+
graph.add_target_info(targets)
|
48
|
+
|
49
|
+
Dir.mktmpdir do |dir|
|
50
|
+
tmpfile = File.join(dir, 'dependencies.gv')
|
51
|
+
tmpfile_reduced = File.join(dir, 'dependencies_reduced.gv')
|
52
|
+
|
53
|
+
save_gv(graphviz_data(graph), tmpfile)
|
54
|
+
`tred #{tmpfile} > #{tmpfile_reduced}` # tred performs a transitive reduction on the graph
|
55
|
+
reduced_graph = GraphViz.parse(tmpfile_reduced)
|
56
|
+
|
57
|
+
FileUtils.mv(tmpfile_reduced, 'dependencies.gv') if @save_gv
|
58
|
+
save_png(reduced_graph, 'dependencies.png') if @save_png
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def graphviz_data(graph)
|
65
|
+
graphviz = GraphViz.new(type: :digraph)
|
66
|
+
|
67
|
+
graph.nodes.each do |_, node|
|
68
|
+
target_node = graphviz.add_node(node.name)
|
69
|
+
node.neighbors.each do |dependency|
|
70
|
+
dep_node = graphviz.add_node(dependency.name)
|
71
|
+
graphviz.add_edge(target_node, dep_node)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
graphviz
|
75
|
+
end
|
76
|
+
|
77
|
+
def save_gv(graphviz_data, filename)
|
78
|
+
graphviz_data.output(dot: filename)
|
79
|
+
end
|
80
|
+
|
81
|
+
def save_png(graphviz_data, filename)
|
82
|
+
graphviz_data.output(png: filename)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'pandan/command'
|
2
|
+
require 'pandan/parser'
|
3
|
+
require 'pandan/graph'
|
4
|
+
require 'pandan/xcworkspace'
|
5
|
+
|
6
|
+
module Pandan
|
7
|
+
class Query < Command
|
8
|
+
self.arguments = [
|
9
|
+
CLAide::Argument.new('target', true)
|
10
|
+
]
|
11
|
+
|
12
|
+
def self.options
|
13
|
+
[
|
14
|
+
['--xcworkspace=path/to/workspace', 'If not set, Pandan will try to find a workspace'],
|
15
|
+
['--reverse', 'If set, pandan will output the targets that depend on the argument'],
|
16
|
+
['--comma-separated', 'If set, Pandan outputs a comma-separated list instead of multiple lines'],
|
17
|
+
['--filter=expression', 'If set, pandan will select all targets whose name match the regular expression']
|
18
|
+
].concat(super)
|
19
|
+
end
|
20
|
+
|
21
|
+
self.summary = <<-DESC
|
22
|
+
Retrieve Xcode dependency information from the target passed as an argument
|
23
|
+
DESC
|
24
|
+
|
25
|
+
def initialize(argv)
|
26
|
+
@target = argv.shift_argument
|
27
|
+
@xcworkspace = argv.option('xcworkspace')
|
28
|
+
@xcworkspace ||= XCWorkspace.find_workspace
|
29
|
+
@reverse = argv.flag?('reverse')
|
30
|
+
@comma_separated = argv.flag?('comma-separated')
|
31
|
+
@filter = argv.option('filter')
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
def validate!
|
36
|
+
super
|
37
|
+
help! 'A target is required to retrieve the dependency information' unless @target
|
38
|
+
|
39
|
+
help! 'Could not find the workspace. Try setting it manually using the --xcworkspace option.' unless @xcworkspace
|
40
|
+
end
|
41
|
+
|
42
|
+
def run
|
43
|
+
parser = Parser.new(@xcworkspace, @filter)
|
44
|
+
targets = parser.all_targets
|
45
|
+
graph = Graph.new(@reverse)
|
46
|
+
graph.add_target_info(targets)
|
47
|
+
deps = graph.resolve_dependencies(@target).map(&:name)
|
48
|
+
unless @filter.nil?
|
49
|
+
deps.select! do |dep|
|
50
|
+
dep.name.include? @filter
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
if @comma_separated
|
55
|
+
puts deps.join ','
|
56
|
+
else
|
57
|
+
puts deps
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'pandan/command'
|
2
|
+
require 'pandan/parser'
|
3
|
+
require 'pandan/xcworkspace'
|
4
|
+
|
5
|
+
module Pandan
|
6
|
+
class Targets < Command
|
7
|
+
def self.options
|
8
|
+
[
|
9
|
+
['--xcworkspace=path/to/workspace', 'If not set, Pandan will try to find a workspace'],
|
10
|
+
['--comma-separated', 'If set, Pandan outputs a comma-separated list instead of multiple lines'],
|
11
|
+
['--filter=expression', 'If set, pandan will select all targets whose name match the regular expression']
|
12
|
+
].concat(super)
|
13
|
+
end
|
14
|
+
|
15
|
+
self.summary = <<-DESC
|
16
|
+
Retrieve all available targets of an Xcode workspace
|
17
|
+
DESC
|
18
|
+
|
19
|
+
def initialize(argv)
|
20
|
+
@xcworkspace = argv.option('xcworkspace')
|
21
|
+
@xcworkspace ||= XCWorkspace.find_workspace
|
22
|
+
@comma_separated = argv.flag?('comma-separated')
|
23
|
+
@filter = argv.option('filter')
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
def validate!
|
28
|
+
super
|
29
|
+
|
30
|
+
help! 'Could not find the workspace. Try setting it manually using the --xcworkspace option.' unless @xcworkspace
|
31
|
+
end
|
32
|
+
|
33
|
+
def run
|
34
|
+
parser = Parser.new(@xcworkspace, @filter)
|
35
|
+
targets = parser.all_targets
|
36
|
+
|
37
|
+
if @comma_separated
|
38
|
+
puts targets.join ','
|
39
|
+
else
|
40
|
+
puts targets
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/pandan/graph.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'xcodeproj'
|
2
|
+
require 'pandan/xcodeproj/user_interface.rb'
|
3
|
+
|
4
|
+
module Pandan
|
5
|
+
class Graph
|
6
|
+
class Node
|
7
|
+
attr_accessor :name
|
8
|
+
attr_accessor :neighbors
|
9
|
+
|
10
|
+
def initialize(name)
|
11
|
+
self.name = name
|
12
|
+
self.neighbors = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_neighbor(node)
|
16
|
+
neighbors << node
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_accessor :nodes, :reverse
|
21
|
+
|
22
|
+
def initialize(reverse)
|
23
|
+
@nodes = {}
|
24
|
+
@reverse = reverse
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_target_info(targets)
|
28
|
+
targets.each do |target|
|
29
|
+
linked_libraries = find_linked_libraries(target)
|
30
|
+
node = nodes[target.display_name]
|
31
|
+
if node.nil?
|
32
|
+
node = Node.new(target.display_name)
|
33
|
+
nodes[target.display_name] = node
|
34
|
+
end
|
35
|
+
linked_libraries.each do |library_name|
|
36
|
+
library_node = nodes[library_name]
|
37
|
+
if library_node.nil?
|
38
|
+
library_node = Node.new(library_name)
|
39
|
+
nodes[library_name] = library_node
|
40
|
+
end
|
41
|
+
if reverse
|
42
|
+
library_node.add_neighbor(node)
|
43
|
+
else
|
44
|
+
node.add_neighbor(library_node)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def resolve_dependencies(target)
|
51
|
+
resolved = []
|
52
|
+
target_node = nodes[target]
|
53
|
+
raise "Target #{target} not found" if target_node.nil?
|
54
|
+
resolve(target_node, resolved)
|
55
|
+
resolved.delete(target_node)
|
56
|
+
resolved
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def find_linked_libraries(target)
|
62
|
+
frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.isa.eql? 'PBXFrameworksBuildPhase' }
|
63
|
+
frameworks_build_phase.files.map { |file| file.display_name.gsub '.framework', '' }
|
64
|
+
end
|
65
|
+
|
66
|
+
def resolve(node, resolved, resolving = [])
|
67
|
+
resolving << node
|
68
|
+
node.neighbors.each do |neighbor|
|
69
|
+
unless resolved.include? neighbor
|
70
|
+
raise "Found dependency cycle: #{node.name} -> #{neighbor.name}" if resolving.include? neighbor
|
71
|
+
resolve(neighbor, resolved, resolving)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
resolved << node
|
75
|
+
resolving.delete(node)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'xcodeproj'
|
2
|
+
|
3
|
+
module Pandan
|
4
|
+
class Parser
|
5
|
+
attr_reader :workspace, :regex
|
6
|
+
|
7
|
+
def initialize(workspace_path, filter)
|
8
|
+
@workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
|
9
|
+
@regex = filter
|
10
|
+
@regex ||= '.*' # Match everything
|
11
|
+
end
|
12
|
+
|
13
|
+
def all_targets
|
14
|
+
all_project_paths = workspace.file_references.map(&:path)
|
15
|
+
projects = all_project_paths.map { |project_path| Xcodeproj::Project.open(project_path) }
|
16
|
+
projects.flat_map(&:targets).select { |target| target.name =~ /#{regex}/ }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/pandan.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pandan/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'pandan'
|
8
|
+
spec.version = Pandan::VERSION
|
9
|
+
spec.authors = ['Renzo Crisóstomo', 'Kim Dung-Pham', 'Max Friedrich']
|
10
|
+
spec.email = ['renzo.crisostomo@xing.com', 'kim.dung-pham@xing.com', 'max.friedrich@xing.com']
|
11
|
+
spec.summary = 'Retrieve Xcode dependency information with ease.'
|
12
|
+
spec.description = 'CLI tool that outputs dependency information from a set of Xcode projects with targets that'\
|
13
|
+
'depend on each other, it does it by creating a (reverse) dependency graph and doing a'\
|
14
|
+
'breadth-first search.'
|
15
|
+
spec.homepage = 'https://github.com/xing/pandan'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = 'bin'
|
22
|
+
spec.executables = 'pandan'
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.14'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
|
29
|
+
spec.add_runtime_dependency 'claide', '~> 1.0.0'
|
30
|
+
spec.add_runtime_dependency 'xcodeproj', '~> 1.4.0'
|
31
|
+
spec.add_dependency 'ruby-graphviz', '~> 1.2'
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pandan
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Renzo Crisóstomo
|
8
|
+
- Kim Dung-Pham
|
9
|
+
- Max Friedrich
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2017-03-27 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bundler
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.14'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '1.14'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: rake
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '10.0'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '10.0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rspec
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.0'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '3.0'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: claide
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 1.0.0
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.0.0
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: xcodeproj
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.4.0
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - "~>"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 1.4.0
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: ruby-graphviz
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '1.2'
|
92
|
+
type: :runtime
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - "~>"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '1.2'
|
99
|
+
description: CLI tool that outputs dependency information from a set of Xcode projects
|
100
|
+
with targets thatdepend on each other, it does it by creating a (reverse) dependency
|
101
|
+
graph and doing abreadth-first search.
|
102
|
+
email:
|
103
|
+
- renzo.crisostomo@xing.com
|
104
|
+
- kim.dung-pham@xing.com
|
105
|
+
- max.friedrich@xing.com
|
106
|
+
executables:
|
107
|
+
- pandan
|
108
|
+
extensions: []
|
109
|
+
extra_rdoc_files: []
|
110
|
+
files:
|
111
|
+
- ".gitignore"
|
112
|
+
- ".rspec"
|
113
|
+
- ".rubocop.yml"
|
114
|
+
- ".rubocop_todo.yml"
|
115
|
+
- CODE_OF_CONDUCT.md
|
116
|
+
- CONTRIBUTING.md
|
117
|
+
- Gemfile
|
118
|
+
- LICENSE.md
|
119
|
+
- README.md
|
120
|
+
- Rakefile
|
121
|
+
- bin/pandan
|
122
|
+
- images/sample_dependencies.png
|
123
|
+
- images/sample_setup.png
|
124
|
+
- lib/pandan.rb
|
125
|
+
- lib/pandan/command.rb
|
126
|
+
- lib/pandan/command/dependency_graph.rb
|
127
|
+
- lib/pandan/command/query.rb
|
128
|
+
- lib/pandan/command/targets.rb
|
129
|
+
- lib/pandan/graph.rb
|
130
|
+
- lib/pandan/parser.rb
|
131
|
+
- lib/pandan/version.rb
|
132
|
+
- lib/pandan/xcodeproj/user_interface.rb
|
133
|
+
- lib/pandan/xcworkspace.rb
|
134
|
+
- pandan.gemspec
|
135
|
+
homepage: https://github.com/xing/pandan
|
136
|
+
licenses:
|
137
|
+
- MIT
|
138
|
+
metadata: {}
|
139
|
+
post_install_message:
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
requirements: []
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 2.6.11
|
156
|
+
signing_key:
|
157
|
+
specification_version: 4
|
158
|
+
summary: Retrieve Xcode dependency information with ease.
|
159
|
+
test_files: []
|