Class: Pod::Command::Dependency

Inherits:
Pod::Command show all
Defined in:
lib/cocoapods-dependency/command/dependency.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Dependency

Returns a new instance of Dependency.



16
17
18
19
# File 'lib/cocoapods-dependency/command/dependency.rb', line 16

def initialize(argv)
  @using_visual_output = argv.flag?('visual', false)
  super
end

Class Method Details

.optionsObject



21
22
23
24
25
# File 'lib/cocoapods-dependency/command/dependency.rb', line 21

def self.options
  [
    ['--visual', 'Output the result using html'],
  ].concat(super)
end

Instance Method Details

#runObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/cocoapods-dependency/command/dependency.rb', line 32

def run
  analyze_result = CocoapodsDependency::Analyzer.analyze_with_podfile(nil, config.podfile)
  if @using_visual_output
    helper = CocoapodsDependency::VisualOutHelper.new(analyze_result)
    final_path = Dir.tmpdir
    helper.write_json_to_file("#{final_path}/index.json")
    html_path = File.expand_path("../resources/index.html", __dir__)
    system "cp #{html_path} #{final_path}"
    final_html_path = "#{final_path}/index.html"
    puts "[CocoapodsDependency] ✅ html file generated at path #{final_html_path}"
    system "open #{final_html_path}"
  else
    pp result
  end
end

#validate!Object



27
28
29
30
# File 'lib/cocoapods-dependency/command/dependency.rb', line 27

def validate!
  super
  verify_podfile_exists!
end