Class: Fastlane::Actions::SlatherAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/slather.rb

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, return_value, sh, step_text

Class Method Details

.authorsObject



139
140
141
142
# File 'lib/fastlane/actions/slather.rb', line 139

def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ["mattdelves"]
end

.available_optionsObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/fastlane/actions/slather.rb', line 47

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :build_directory,
                                 env_name: "FL_SLATHER_BUILD_DIRECTORY", # The name of the environment variable
                                 description: "The location of the build output", # a short description of this parameter
                                 optional: true
                                ),
    FastlaneCore::ConfigItem.new(key: :proj,
                                 env_name: "FL_SLATHER_PROJ", # The name of the environment variable
                                 description: "The project file that slather looks at", # a short description of this parameter
                                 verify_block: proc do |value|
                                   raise "No project file specified, pass using `proj: 'Project.xcodeproj'`".red unless value and !value.empty?
                                 end),
    FastlaneCore::ConfigItem.new(key: :scheme,
                                 env_name: "FL_SLATHER_SCHEME", # The name of the environment variable
                                 description: "Scheme to use when calling slather",
                                 optional: true
                                ),
    FastlaneCore::ConfigItem.new(key: :input_format,
                                 env_name: "FL_SLATHER_INPUT_FORMAT", # The name of the environment variable
                                 description: "The input format that slather should look for",
                                 optional: true
                                ),
    FastlaneCore::ConfigItem.new(key: :buildkite,
                                 env_name: "FL_SLATHER_BUILDKITE_ENABLED", # The name of the environment variable
                                 description: "Tell slather that it is running on Buildkite",
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :jenkins,
                                 env_name: "FL_SLATHER_JENKINS_ENABLED", # The name of the environment variable
                                 description: "Tell slather that it is running on Jenkins",
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :travis,
                                 env_name: "FL_SLATHER_TRAVIS_ENABLED", # The name of the environment variable
                                 description: "Tell slather that it is running on TravisCI",
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :circleci,
                                 env_name: "FL_SLATHER_CIRCLECI_ENABLED",
                                 description: "Tell slather that it is running on CircleCI",
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :coveralls,
                                 env_name: "FL_SLATHER_COVERALLS_ENABLED",
                                 description: "Tell slather that it should post data to Coveralls",
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :simple_output,
                                 env_name: "FL_SLATHER_SIMPLE_OUTPUT_ENABLED",
                                 description: "Tell slather that it should output results to the terminal",
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :gutter_json,
                                 env_name: "FL_SLATHER_GUTTER_JSON_ENABLED",
                                 description: "Tell slather that it should output results as Gutter JSON format",
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :cobertura_xml,
                                 env_name: "FL_SLATHER_COBERTURA_XML_ENABLED",
                                 description: "Tell slather that it should output results as Cobertura XML format",
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :html,
                                 env_name: "FL_SLATHER_HTML_ENABLED",
                                 description: "Tell slather that it should output results as static HTML pages",
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :show,
                                 env_name: "FL_SLATHER_SHOW_ENABLED",
                                 description: "Tell slather that it should oupen static html pages automatically",
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :source_directory,
                                 env_name: "FL_SLATHER_SOURCE_DIRECTORY",
                                 description: "Tell slather the location of your source files",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :output_directory,
                                 env_name: "FL_SLATHER_OUTPUT_DIRECTORY",
                                 description: "Tell slather the location of for your output files",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :ignore,
                                 env_name: "FL_SLATHER_IGNORE",
                                 description: "Tell slather to ignore files matching a path",
                                 optional: true)
  ]
end

.descriptionObject



36
37
38
# File 'lib/fastlane/actions/slather.rb', line 36

def self.description
  "Use slather to generate a code coverage report"
end

.detailsObject



40
41
42
43
44
45
# File 'lib/fastlane/actions/slather.rb', line 40

def self.details
  return <<-eos
Slather works with multiple code coverage formats including Xcode7 code coverage.
Slather is available at https://github.com/venmo/slather
  eos
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


144
145
146
# File 'lib/fastlane/actions/slather.rb', line 144

def self.is_supported?(platform)
  [:ios, :mac].include? platform
end

.outputObject



135
136
137
# File 'lib/fastlane/actions/slather.rb', line 135

def self.output
  # Define the shared values you are going to provide
end

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fastlane/actions/slather.rb', line 8

def self.run(params)
  Actions.verify_gem!('slather')

  command = "slather coverage "
  command += " --build-directory #{params[:build_directory]}" if params[:build_directory]
  command += " --input-format #{params[:input_format]}" if params[:input_format]
  command += " --scheme #{params[:scheme]}" if params[:scheme]
  command += " --buildkite" if params[:buildkite]
  command += " --jenkins" if params[:jenkins]
  command += " --travis" if params[:travis]
  command += " --circleci" if params[:circleci]
  command += " --coveralls" if params[:coveralls]
  command += " --simple-output" if params[:simple_output]
  command += " --gutter-json" if params[:gutter_json]
  command += " --cobertura-xml" if params[:cobertura_xml]
  command += " --html" if params[:html]
  command += " --show" if params[:show]
  command += " --source-directory #{params[:source_directory]}" if params[:source_directory]
  command += " --output-directory #{params[:output_directory]}" if params[:output_directory]
  command += " --ignore #{params[:ignore]}" if params[:ignore]
  command += " #{params[:proj]}"
  sh command
end