Class: Pod::Command::Why
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::Why
- Defined in:
- lib/pod/command/why.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Why
constructor
A new instance of Why.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Why
Returns a new instance of Why.
26 27 28 29 30 31 32 33 |
# File 'lib/pod/command/why.rb', line 26 def initialize(argv) super @source = argv.shift_argument @target = argv.shift_argument @to_yaml = argv.option('to-yaml') @to_dot = argv.option('to-dot') @cache = argv.option('cache') end |
Class Method Details
.options ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/pod/command/why.rb', line 18 def self. [ ['--to-yaml=FILE', 'Output the results in YAML format to the given file'], ['--to-dot=FILE', 'Output the results in DOT (GraphViz) format to the given file'], ['--cache=FILE', 'Load the dependency data from the given YAML file (created previously with the "query" command) instead of from the current CocoaPods instance'] ].concat(super) end |
Instance Method Details
#run ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/pod/command/why.rb', line 40 def run UI.puts 'Loading dependencies...' all_dependencies = all_dependencies(targets) [@source, @target].compact.each { |pod| help! "Cannot find pod named #{pod}" if all_dependencies[pod].nil? } graph = make_graph(all_dependencies) @target.nil? ? find_reverse_dependencies(@source, graph) : find_all_dependency_paths(@source, @target, graph) end |
#validate! ⇒ Object
35 36 37 38 |
# File 'lib/pod/command/why.rb', line 35 def validate! super help! if @source.nil? end |