Class: Danger::DangerXcodeSummary

Inherits:
Plugin
  • Object
show all
Defined in:
lib/xcode_summary/plugin.rb

Overview

Shows all build errors, warnings and unit tests results generated from ‘xcodebuild`. You need to use [xcpretty](github.com/supermarin/xcpretty) with [xcpretty-json-formatter](github.com/marcelofabri/xcpretty-json-formatter) to generate a JSON file that this plugin can read.

Examples:

Showing summary


xcode_summary.report 'xcodebuild.json'

Filtering warnings in Pods


xcode_summary.ignored_files = '**/Pods/**'
xcode_summary.report 'xcodebuild.json'

See Also:

  • diogot/danger-xcode_summary

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ignored_files[String]

A globbed string or array of strings which should match the files that you want to ignore warnings on. Defaults to nil. An example would be ‘’/Pods/‘` to ignore warnings in Pods that your project uses.

Parameters:

  • value (String or [String])

Returns:

  • ([String])


33
34
35
# File 'lib/xcode_summary/plugin.rb', line 33

def ignored_files
  @ignored_files
end

#project_rootString

The project root, which will be used to make the paths relative. Defaults to ‘pwd`.

Parameters:

  • value (String)

Returns:

  • (String)


25
26
27
# File 'lib/xcode_summary/plugin.rb', line 25

def project_root
  @project_root
end

#sticky_summaryBoolean

Defines if the test summary will be sticky or not. Defaults to ‘false`.

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)


39
40
41
# File 'lib/xcode_summary/plugin.rb', line 39

def sticky_summary
  @sticky_summary
end

#test_summaryBoolean

Defines if the build summary is shown or not. Defaults to ‘true`.

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)


45
46
47
# File 'lib/xcode_summary/plugin.rb', line 45

def test_summary
  @test_summary
end

Instance Method Details

#report(file_path) ⇒ void

This method returns an undefined value.

Reads a file with JSON Xcode summary and reports it.

Parameters:

  • file_path (String)

    Path for Xcode summary in JSON format.



69
70
71
72
73
74
75
76
# File 'lib/xcode_summary/plugin.rb', line 69

def report(file_path)
  if File.file?(file_path)
    xcode_summary = JSON.parse(File.read(file_path), symbolize_names: true)
    format_summary(xcode_summary)
  else
    fail 'summary file not found'
  end
end