diff --git a/.gitignore b/.gitignore index 61418b1..78e6db4 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,8 @@ tmp *.o *.a mkmf.log -.vendor +.vendor +.ruby-version # Xcode # *.pbxuser diff --git a/lib/cocoapods_plugin.rb b/lib/cocoapods_plugin.rb index 480de31..95ab9d4 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 cc47a2d..ca8d21a 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/command/coverage_command.rb b/lib/slather/command/coverage_command.rb index 794a219..fc3742f 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 + Slather::Project.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 d0397ec..3f5ab13 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 diff --git a/lib/slather/coverage_file.rb b/lib/slather/coverage_file.rb index cd3fc01..0d2c24c 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 57ba9b7..07a2eac 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 diff --git a/lib/slather/project.rb b/lib/slather/project.rb index 2253431..17b1e95 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