From d690293d7fe6338f15b7b2c1ac18ef2d3a6de61b Mon Sep 17 00:00:00 2001 From: Jarrod Lombardo Date: Wed, 1 Nov 2023 14:22:13 -0700 Subject: [PATCH 1/5] fix: Use require_relative for all local files instead of getting the external gems. --- lib/cocoapods_plugin.rb | 2 +- lib/slather.rb | 30 +++++++++++++-------------- lib/slather/coverage_file.rb | 4 ++-- lib/slather/profdata_coverage_file.rb | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/cocoapods_plugin.rb b/lib/cocoapods_plugin.rb index 480de312..95ab9d42 100644 --- a/lib/cocoapods_plugin.rb +++ b/lib/cocoapods_plugin.rb @@ -1,4 +1,4 @@ -require 'slather' +require_relative 'slather' Pod::HooksManager.register('slather', :post_install) do |installer_context| sandbox_root = installer_context.sandbox_root diff --git a/lib/slather.rb b/lib/slather.rb index cc47a2d4..ca8d21af 100644 --- a/lib/slather.rb +++ b/lib/slather.rb @@ -1,18 +1,18 @@ -require 'slather/version' -require 'slather/project' -require 'slather/coverage_info' -require 'slather/coverage_file' -require 'slather/coveralls_coverage' -require 'slather/profdata_coverage_file' -require 'slather/coverage_service/cobertura_xml_output' -require 'slather/coverage_service/coveralls' -require 'slather/coverage_service/hardcover' -require 'slather/coverage_service/gutter_json_output' -require 'slather/coverage_service/simple_output' -require 'slather/coverage_service/html_output' -require 'slather/coverage_service/json_output' -require 'slather/coverage_service/llvm_cov_output' -require 'slather/coverage_service/sonarqube_xml_output' +require_relative 'slather/version' +require_relative 'slather/project' +require_relative 'slather/coverage_info' +require_relative 'slather/coverage_file' +require_relative 'slather/coveralls_coverage' +require_relative 'slather/profdata_coverage_file' +require_relative 'slather/coverage_service/cobertura_xml_output' +require_relative 'slather/coverage_service/coveralls' +require_relative 'slather/coverage_service/hardcover' +require_relative 'slather/coverage_service/gutter_json_output' +require_relative 'slather/coverage_service/simple_output' +require_relative 'slather/coverage_service/html_output' +require_relative 'slather/coverage_service/json_output' +require_relative 'slather/coverage_service/llvm_cov_output' +require_relative 'slather/coverage_service/sonarqube_xml_output' require 'cfpropertylist' module Slather diff --git a/lib/slather/coverage_file.rb b/lib/slather/coverage_file.rb index cd3fc010..0d2c24cb 100644 --- a/lib/slather/coverage_file.rb +++ b/lib/slather/coverage_file.rb @@ -1,5 +1,5 @@ -require 'slather/coverage_info' -require 'slather/coveralls_coverage' +require_relative 'coverage_info' +require_relative 'coveralls_coverage' module Slather class CoverageFile diff --git a/lib/slather/profdata_coverage_file.rb b/lib/slather/profdata_coverage_file.rb index 57ba9b7a..07a2eac3 100644 --- a/lib/slather/profdata_coverage_file.rb +++ b/lib/slather/profdata_coverage_file.rb @@ -1,5 +1,5 @@ -require 'slather/coverage_info' -require 'slather/coveralls_coverage' +require_relative 'coverage_info' +require_relative 'coveralls_coverage' require 'digest/md5' module Slather From dd3de225f9e520a9d737d5e4a4a35e1714b9257a Mon Sep 17 00:00:00 2001 From: Jarrod Lombardo Date: Wed, 1 Nov 2023 14:24:56 -0700 Subject: [PATCH 2/5] add: yml_filename= singleton method. --- lib/slather/project.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/slather/project.rb b/lib/slather/project.rb index 22534317..17b1e95c 100755 --- a/lib/slather/project.rb +++ b/lib/slather/project.rb @@ -311,8 +311,14 @@ def dedupe(coverage_files) end private :dedupe + @@ymlfile = '.slather.yml' + + def self.yml_filename=(var) + @@ymlfile = var + end + def self.yml_filename - '.slather.yml' + @@ymlfile end def self.yml From 17118f0a3f0709fdb3c6020cd3b9cae831664ffa Mon Sep 17 00:00:00 2001 From: Jarrod Lombardo Date: Wed, 1 Nov 2023 14:26:59 -0700 Subject: [PATCH 3/5] add: --ymlfile option to coverage and setup commands. --- lib/slather/command/coverage_command.rb | 6 ++++++ lib/slather/command/setup_command.rb | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/lib/slather/command/coverage_command.rb b/lib/slather/command/coverage_command.rb index 794a2191..7116f4cc 100644 --- a/lib/slather/command/coverage_command.rb +++ b/lib/slather/command/coverage_command.rb @@ -36,10 +36,12 @@ class CoverageCommand < Clamp::Command option ["--arch"], "ARCH", "Architecture to use from universal binaries" option ["--source-files"], "SOURCE_FILES", "A Dir.glob compatible pattern used to limit the lookup to specific source files. Ignored in gcov mode.", :multivalued => true option ["--decimals"], "DECIMALS", "The amount of decimals to use for % coverage reporting" + option ["--ymlfile"], "YMLFILE", "Relative path to a file used in place of '.slather.yml'" def execute puts "Slathering..." + setup_ymlfile # MUST be the first setup setup_service_name setup_ignore_list setup_build_directory @@ -64,6 +66,10 @@ def execute puts "Slathered" end + def setup_ymlfile + yml_filename = ymlfile if ymlfile + end + def setup_build_directory project.build_directory = build_directory if build_directory end diff --git a/lib/slather/command/setup_command.rb b/lib/slather/command/setup_command.rb index d0397ec9..3f5ab133 100644 --- a/lib/slather/command/setup_command.rb +++ b/lib/slather/command/setup_command.rb @@ -2,8 +2,10 @@ class SetupCommand < Clamp::Command parameter "[PROJECT]", "Path to the .xcodeproj", :attribute_name => :xcodeproj_path option ["--format"], "FORMAT", "Type of coverage to use (gcov, clang, auto)" + option ["--ymlfile"], "YMLFILE", "Relative path to a file used in place of '.slather.yml'" def execute + setup_ymlfile xcodeproj_path_to_open = xcodeproj_path || Slather::Project.yml["xcodeproj"] unless xcodeproj_path_to_open raise StandardError, "Must provide a .xcodeproj either via the 'slather [SUBCOMMAND] [PROJECT].xcodeproj' command or through .slather.yml" @@ -12,4 +14,8 @@ def execute project.setup_for_coverage(format ? format.to_sym : :auto) project.save end + + def setup_ymlfile + Slather::Project.yml_filename = ymlfile if ymlfile + end end From 6cfb297bd212e6ab283b3767684bc97772aa2e25 Mon Sep 17 00:00:00 2001 From: Jarrod Lombardo Date: Wed, 1 Nov 2023 15:55:19 -0700 Subject: [PATCH 4/5] add: ignore .ruby-version created if using rbenv --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 61418b10..78e6db4d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,8 @@ tmp *.o *.a mkmf.log -.vendor +.vendor +.ruby-version # Xcode # *.pbxuser From 166394ce1e886b1b21df6ce628ded1d346afb1b4 Mon Sep 17 00:00:00 2001 From: Jarrod Lombardo Date: Thu, 2 Nov 2023 17:09:50 -0700 Subject: [PATCH 5/5] fix: missing class from previous push. --- lib/slather/command/coverage_command.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/slather/command/coverage_command.rb b/lib/slather/command/coverage_command.rb index 7116f4cc..fc3742fb 100644 --- a/lib/slather/command/coverage_command.rb +++ b/lib/slather/command/coverage_command.rb @@ -67,7 +67,7 @@ def execute end def setup_ymlfile - yml_filename = ymlfile if ymlfile + Slather::Project.yml_filename = ymlfile if ymlfile end def setup_build_directory