slather 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
 - data/bin/slather +6 -0
 - data/lib/slather.rb +6 -0
 - data/lib/slather/coverage_file.rb +9 -3
 - data/lib/slather/project.rb +21 -8
 - data/lib/slather/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                Mzk5NGNiYzA1NGVhMzEzYWJhMzdhNjA0YjBhNjhhYWY2ZmQ3NDNlZQ==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                YTY0ZjBiNDcwZGFlMmM5YzQyNjU0YjdkYjQyNDcyYThhMDAyYzM3Zg==
         
     | 
| 
       7 
7 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                YmNkNjVhOGYxNWM4NzFjMTBiYTY3NGMwZjM2Y2Y5NDU5MDMzNjEwYWQyYjJj
         
     | 
| 
      
 10 
     | 
    
         
            +
                MjcwNDkxNTEzNmQwNGE5NjVhODI4NTM5OTA5OTRlYjEwMTc2YWYxMWMzMGM1
         
     | 
| 
      
 11 
     | 
    
         
            +
                ZDEwODRiMjdjYmZjNTUxZjZlMDJmMTJjNDQyZWU1YmM3OGEyNzE=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                M2E4N2ZmNzZkYTViMjAzYzA0N2MyZDQxMmI0NjQyOGY0YjExNjhkYTIwYjky
         
     | 
| 
      
 14 
     | 
    
         
            +
                N2Y3M2IzZGE3NmU0NmUwZWRiZDhiNzUwZjhlYjc3NWNlOGYyOGFmMGFlYmI1
         
     | 
| 
      
 15 
     | 
    
         
            +
                YWE3ODA0NDA0NGI2YWZhNGI1MzdlNmU0NTc1NWUwYzJlN2I5NjA=
         
     | 
    
        data/bin/slather
    CHANGED
    
    | 
         @@ -17,6 +17,7 @@ Clamp do 
     | 
|
| 
       17 
17 
     | 
    
         
             
                option ["--simple-output", "-s"], :flag, "Post coverage results to coveralls"
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
                option ["--build-directory", "-b"], "BUILD_DIRECTORY", "The directory where gcno files will be written to. Defaults to derived data."
         
     | 
| 
      
 20 
     | 
    
         
            +
                option ["--source-directory"], "SOURCE_DIRECTORY", "The directory where your source files are located."
         
     | 
| 
       20 
21 
     | 
    
         
             
                option ["--ignore", "-i"], "IGNORE", "ignore files conforming to a path", :multivalued => true
         
     | 
| 
       21 
22 
     | 
    
         | 
| 
       22 
23 
     | 
    
         
             
                def execute
         
     | 
| 
         @@ -25,6 +26,7 @@ Clamp do 
     | 
|
| 
       25 
26 
     | 
    
         
             
                  setup_service_name
         
     | 
| 
       26 
27 
     | 
    
         
             
                  setup_ignore_list
         
     | 
| 
       27 
28 
     | 
    
         
             
                  setup_build_directory
         
     | 
| 
      
 29 
     | 
    
         
            +
                  setup_source_directory
         
     | 
| 
       28 
30 
     | 
    
         
             
                  setup_coverage_service
         
     | 
| 
       29 
31 
     | 
    
         | 
| 
       30 
32 
     | 
    
         
             
                  post
         
     | 
| 
         @@ -36,6 +38,10 @@ Clamp do 
     | 
|
| 
       36 
38 
     | 
    
         
             
                  project.build_directory = build_directory if build_directory
         
     | 
| 
       37 
39 
     | 
    
         
             
                end
         
     | 
| 
       38 
40 
     | 
    
         | 
| 
      
 41 
     | 
    
         
            +
                def setup_source_directory
         
     | 
| 
      
 42 
     | 
    
         
            +
                  project.source_directory = source_directory if source_directory
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
       39 
45 
     | 
    
         
             
                def setup_ignore_list
         
     | 
| 
       40 
46 
     | 
    
         
             
                  project.ignore_list = ignore_list if !ignore_list.empty?
         
     | 
| 
       41 
47 
     | 
    
         
             
                end
         
     | 
    
        data/lib/slather.rb
    CHANGED
    
    
| 
         @@ -12,8 +12,15 @@ module Slather 
     | 
|
| 
       12 
12 
     | 
    
         
             
                  @source_file_pathname ||= begin
         
     | 
| 
       13 
13 
     | 
    
         
             
                    base_filename = gcno_file_pathname.basename.sub_ext("")
         
     | 
| 
       14 
14 
     | 
    
         
             
                    # TODO: Handle Swift
         
     | 
| 
       15 
     | 
    
         
            -
                    path =  
     | 
| 
       16 
     | 
    
         
            -
                     
     | 
| 
      
 15 
     | 
    
         
            +
                    path = nil
         
     | 
| 
      
 16 
     | 
    
         
            +
                    if project.source_directory
         
     | 
| 
      
 17 
     | 
    
         
            +
                      path = Dir["#{project.source_directory}/**/#{base_filename}.m"].first
         
     | 
| 
      
 18 
     | 
    
         
            +
                      path &&= Pathname(path)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    else
         
     | 
| 
      
 20 
     | 
    
         
            +
                      pbx_file = project.files.detect { |pbx_file| pbx_file.real_path.basename.to_s == "#{base_filename}.m" }
         
     | 
| 
      
 21 
     | 
    
         
            +
                      path = pbx_file && pbx_file.real_path
         
     | 
| 
      
 22 
     | 
    
         
            +
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
                    path
         
     | 
| 
       17 
24 
     | 
    
         
             
                  end
         
     | 
| 
       18 
25 
     | 
    
         
             
                end
         
     | 
| 
       19 
26 
     | 
    
         | 
| 
         @@ -26,7 +33,6 @@ module Slather 
     | 
|
| 
       26 
33 
     | 
    
         
             
                end
         
     | 
| 
       27 
34 
     | 
    
         | 
| 
       28 
35 
     | 
    
         
             
                def source_file_pathname_relative_to_repo_root
         
     | 
| 
       29 
     | 
    
         
            -
                  puts "pathhh: #{source_file_pathname.cleanpath}"
         
     | 
| 
       30 
36 
     | 
    
         
             
                  source_file_pathname.realpath.relative_path_from(Pathname("./").realpath)
         
     | 
| 
       31 
37 
     | 
    
         
             
                end
         
     | 
| 
       32 
38 
     | 
    
         | 
    
        data/lib/slather/project.rb
    CHANGED
    
    | 
         @@ -3,10 +3,25 @@ require 'xcodeproj' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require 'json'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'yaml'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
      
 6 
     | 
    
         
            +
            module Xcodeproj
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Project
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def slather_setup_for_coverage
         
     | 
| 
      
 10 
     | 
    
         
            +
                  build_configurations.each do |build_configuration|
         
     | 
| 
      
 11 
     | 
    
         
            +
                    build_configuration.build_settings["GCC_INSTRUMENT_PROGRAM_FLOW_ARCS"] = "YES"
         
     | 
| 
      
 12 
     | 
    
         
            +
                    build_configuration.build_settings["GCC_GENERATE_TEST_COVERAGE_FILES"] = "YES"
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       6 
19 
     | 
    
         
             
            module Slather
         
     | 
| 
       7 
20 
     | 
    
         
             
              class Project < Xcodeproj::Project
         
     | 
| 
       8 
21 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
                attr_accessor :build_directory, :ignore_list, :ci_service, :coverage_service
         
     | 
| 
      
 22 
     | 
    
         
            +
                attr_accessor :build_directory, :ignore_list, :ci_service, :coverage_service, :source_directory
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                alias_method :setup_for_coverage, :slather_setup_for_coverage
         
     | 
| 
       10 
25 
     | 
    
         | 
| 
       11 
26 
     | 
    
         
             
                def self.open(xcodeproj)
         
     | 
| 
       12 
27 
     | 
    
         
             
                  proj = super
         
     | 
| 
         @@ -51,12 +66,17 @@ module Slather 
     | 
|
| 
       51 
66 
     | 
    
         
             
                  configure_ignore_list_from_yml
         
     | 
| 
       52 
67 
     | 
    
         
             
                  configure_ci_service_from_yml
         
     | 
| 
       53 
68 
     | 
    
         
             
                  configure_coverage_service_from_yml
         
     | 
| 
      
 69 
     | 
    
         
            +
                  configure_source_directory_from_yml
         
     | 
| 
       54 
70 
     | 
    
         
             
                end
         
     | 
| 
       55 
71 
     | 
    
         | 
| 
       56 
72 
     | 
    
         
             
                def configure_build_directory_from_yml
         
     | 
| 
       57 
73 
     | 
    
         
             
                  self.build_directory = self.class.yml["build_directory"] if self.class.yml["build_directory"] && !@build_directory
         
     | 
| 
       58 
74 
     | 
    
         
             
                end
         
     | 
| 
       59 
75 
     | 
    
         | 
| 
      
 76 
     | 
    
         
            +
                def configure_source_directory_from_yml
         
     | 
| 
      
 77 
     | 
    
         
            +
                  self.source_directory ||= self.class.yml["source_directory"] if self.class.yml["source_directory"]
         
     | 
| 
      
 78 
     | 
    
         
            +
                end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
       60 
80 
     | 
    
         
             
                def configure_ignore_list_from_yml
         
     | 
| 
       61 
81 
     | 
    
         
             
                  self.ignore_list ||= [(self.class.yml["ignore"] || [])].flatten
         
     | 
| 
       62 
82 
     | 
    
         
             
                end
         
     | 
| 
         @@ -85,13 +105,6 @@ module Slather 
     | 
|
| 
       85 
105 
     | 
    
         
             
                  @coverage_service = service
         
     | 
| 
       86 
106 
     | 
    
         
             
                end
         
     | 
| 
       87 
107 
     | 
    
         | 
| 
       88 
     | 
    
         
            -
                def setup_for_coverage
         
     | 
| 
       89 
     | 
    
         
            -
                  build_configurations.each do |build_configuration|
         
     | 
| 
       90 
     | 
    
         
            -
                    build_configuration.build_settings["GCC_INSTRUMENT_PROGRAM_FLOW_ARCS"] = "YES"
         
     | 
| 
       91 
     | 
    
         
            -
                    build_configuration.build_settings["GCC_GENERATE_TEST_COVERAGE_FILES"] = "YES"
         
     | 
| 
       92 
     | 
    
         
            -
                  end
         
     | 
| 
       93 
     | 
    
         
            -
                end
         
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
108 
     | 
    
         
             
              end
         
     | 
| 
       96 
109 
     | 
    
         
             
            end
         
     | 
| 
       97 
110 
     | 
    
         | 
    
        data/lib/slather/version.rb
    CHANGED