fastlane/lib/fastlane/actions/slather.rb in fastlane-2.216.0 vs fastlane/lib/fastlane/actions/slather.rb in fastlane-2.217.0
- old
+ new
@@ -33,11 +33,12 @@
workspace: '--workspace',
binary_file: '--binary-file',
binary_basename: '--binary-basename',
arch: '--arch',
source_files: '--source-files',
- decimals: '--decimals'
+ decimals: '--decimals',
+ ymlfile: '--ymlfile'
}.freeze
def self.run(params)
# This will fail if using Bundler. Skip the check rather than needing to
# require bundler
@@ -49,12 +50,12 @@
command = build_command(params)
sh(command)
end
- def self.has_config_file
- File.file?('.slather.yml')
+ def self.has_config_file?(params)
+ params[:ymlfile] ? File.file?(params[:ymlfile]) : File.file?('.slather.yml')
end
def self.slather_version
require 'slather'
Slather::VERSION
@@ -62,16 +63,24 @@
def self.configuration_available?
Gem::Version.new('2.4.1') <= Gem::Version.new(slather_version)
end
+ def self.ymlfile_available?
+ Gem::Version.new('2.8.0') <= Gem::Version.new(slather_version)
+ end
+
def self.validate_params!(params)
if params[:configuration]
UI.user_error!('configuration option is available since version 2.4.1') unless configuration_available?
end
- if params[:proj] || has_config_file
+ if params[:ymlfile]
+ UI.user_error!('ymlfile option is available since version 2.8.0') unless ymlfile_available?
+ end
+
+ if params[:proj] || has_config_file?(params)
true
else
UI.user_error!("You have to provide a project with `:proj` or use a .slather.yml")
end
@@ -283,9 +292,13 @@
FastlaneCore::ConfigItem.new(key: :decimals,
env_name: "FL_SLATHER_DECIMALS",
description: "The amount of decimals to use for % coverage reporting",
skip_type_validation: true, # allow Integer, String
default_value: false,
+ optional: true),
+ FastlaneCore::ConfigItem.new(key: :ymlfile,
+ env_name: "FL_SLATHER_YMLFILE",
+ description: "Relative path to a file used in place of '.slather.yml'",
optional: true)
]
end
def self.output