Class: Pod::Command::Lib::Coverage

Inherits:
Pod::Command::Lib show all
Defined in:
lib/pod/command/lib/coverage.rb

Overview

TODO:

Create a PR to add your plugin to CocoaPods/cocoapods.org in the ‘plugins.json` file, once your plugin is released.

Instance Method Summary collapse

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/pod/command/lib/coverage.rb', line 18

def run
  test_with_coverage

  Pod::Command::Lib::Testing.handle_workspaces_in_dir(Pathname.pwd) do |workspace, _path|
    workspace.file_references.each do |file_ref|
      next unless file_ref.path.end_with? '.xcodeproj'
      next if file_ref.path == 'Pods/Pods.xcodeproj'
      ref_path = File.absolute_path(file_ref.path, Pathname.new(_path).dirname)
      slather(ref_path)
    end
  end
end

#slather(project_path) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/pod/command/lib/coverage.rb', line 31

def slather(project_path)
  return if not File.directory?(project_path)
  project = Slather::Project.open(project_path)

  if ENV['TRAVIS'] == 'true'
    project.coverage_service = :coveralls
  else
    project.coverage_service = :terminal
  end

  begin
    project.post

    project.coverage_service = :gutter_json
    project.post
  rescue
  end
end

#test_with_coverageObject



50
51
52
53
54
55
# File 'lib/pod/command/lib/coverage.rb', line 50

def test_with_coverage
  args = CLAide::ARGV.new(['GCC_GENERATE_TEST_COVERAGE_FILES=YES',
                           'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES'])
  tester = Pod::Command::Lib::Testing.new(args)
  tester.run
end