covered 0.11.0 → 0.14.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/development.yml +45 -0
- data/.github/workflows/documentation.yml +32 -0
- data/examples/coverage/erb/.covered.db +0 -0
- data/examples/coverage/erb/coverage.rb +21 -0
- data/examples/coverage/erb/template.erb +7 -0
- data/examples/coverage/test.rb +12 -4
- data/examples/coverage/tracepoint.rb +1 -2
- data/lib/covered/capture.rb +10 -5
- data/lib/covered/coveralls.rb +2 -0
- data/lib/covered/markdown_summary.rb +100 -0
- data/lib/covered/policy.rb +7 -1
- data/lib/covered/source.rb +3 -2
- data/lib/covered/summary.rb +74 -51
- data/lib/covered/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +64 -37
- metadata.gz.sig +0 -0
- data/.editorconfig +0 -6
- data/.gitignore +0 -11
- data/.rspec +0 -3
- data/.travis.yml +0 -11
- data/Gemfile +0 -8
- data/README.md +0 -132
- data/Rakefile +0 -13
- data/covered.gemspec +0 -33
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a7debea47cf0febb50f3f84e0f081011000920a6e2946b500034321a4f854054
         | 
| 4 | 
            +
              data.tar.gz: c4dec696971409a1b58ba3b1f6b6d07f7af8f1c121def0d764ee4ccad7a0487b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 491d65f3c87087ced3a3767ec14e3e82fddc99d539fd249ec9615f31386b13f97061f9befc97cc5ab700793a42205ae71d212711f7e9472864a392b41970da00
         | 
| 7 | 
            +
              data.tar.gz: 48b62e8ff991ae8046aca2a70508a677497748fbd6d6665e09ce9e42055a9ccf42c8212461dad7556014e1a3c8328fbeaf2049259dce670e54a33a34dccf45d3
         | 
    
        checksums.yaml.gz.sig
    ADDED
    
    | Binary file | 
| @@ -0,0 +1,45 @@ | |
| 1 | 
            +
            name: Development
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on: [push, pull_request]
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            jobs:
         | 
| 6 | 
            +
              test:
         | 
| 7 | 
            +
                name: ${{matrix.ruby}} on ${{matrix.os}}
         | 
| 8 | 
            +
                runs-on: ${{matrix.os}}-latest
         | 
| 9 | 
            +
                continue-on-error: ${{matrix.experimental}}
         | 
| 10 | 
            +
                
         | 
| 11 | 
            +
                strategy:
         | 
| 12 | 
            +
                  matrix:
         | 
| 13 | 
            +
                    os:
         | 
| 14 | 
            +
                      - ubuntu
         | 
| 15 | 
            +
                      - macos
         | 
| 16 | 
            +
                    
         | 
| 17 | 
            +
                    ruby:
         | 
| 18 | 
            +
                      - "2.6"
         | 
| 19 | 
            +
                      - "2.7"
         | 
| 20 | 
            +
                      - "3.0"
         | 
| 21 | 
            +
                    
         | 
| 22 | 
            +
                    experimental: [false]
         | 
| 23 | 
            +
                    env: [""]
         | 
| 24 | 
            +
                    
         | 
| 25 | 
            +
                    include:
         | 
| 26 | 
            +
                      - os: ubuntu
         | 
| 27 | 
            +
                        ruby: truffleruby
         | 
| 28 | 
            +
                        experimental: true
         | 
| 29 | 
            +
                      - os: ubuntu
         | 
| 30 | 
            +
                        ruby: jruby
         | 
| 31 | 
            +
                        experimental: true
         | 
| 32 | 
            +
                      - os: ubuntu
         | 
| 33 | 
            +
                        ruby: head
         | 
| 34 | 
            +
                        experimental: true
         | 
| 35 | 
            +
                
         | 
| 36 | 
            +
                steps:
         | 
| 37 | 
            +
                - uses: actions/checkout@v2
         | 
| 38 | 
            +
                - uses: ruby/setup-ruby@v1
         | 
| 39 | 
            +
                  with:
         | 
| 40 | 
            +
                    ruby-version: ${{matrix.ruby}}
         | 
| 41 | 
            +
                    bundler-cache: true
         | 
| 42 | 
            +
                
         | 
| 43 | 
            +
                - name: Run tests
         | 
| 44 | 
            +
                  timeout-minutes: 5
         | 
| 45 | 
            +
                  run: ${{matrix.env}} bundle exec rspec
         | 
| @@ -0,0 +1,32 @@ | |
| 1 | 
            +
            name: Documentation
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on:
         | 
| 4 | 
            +
              push:
         | 
| 5 | 
            +
                branches:
         | 
| 6 | 
            +
                  - main
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            jobs:
         | 
| 9 | 
            +
              deploy:
         | 
| 10 | 
            +
                runs-on: ubuntu-latest
         | 
| 11 | 
            +
                
         | 
| 12 | 
            +
                steps:
         | 
| 13 | 
            +
                - uses: actions/checkout@v2
         | 
| 14 | 
            +
                - uses: ruby/setup-ruby@v1
         | 
| 15 | 
            +
                  env:
         | 
| 16 | 
            +
                    BUNDLE_WITH: maintenance
         | 
| 17 | 
            +
                  with:
         | 
| 18 | 
            +
                    ruby-version: 3.0
         | 
| 19 | 
            +
                    bundler-cache: true
         | 
| 20 | 
            +
                
         | 
| 21 | 
            +
                - name: Installing packages
         | 
| 22 | 
            +
                  run: sudo apt-get install wget
         | 
| 23 | 
            +
                
         | 
| 24 | 
            +
                - name: Generate documentation
         | 
| 25 | 
            +
                  timeout-minutes: 5
         | 
| 26 | 
            +
                  run: bundle exec bake utopia:project:static
         | 
| 27 | 
            +
                
         | 
| 28 | 
            +
                - name: Deploy documentation
         | 
| 29 | 
            +
                  uses: JamesIves/github-pages-deploy-action@4.0.0
         | 
| 30 | 
            +
                  with:
         | 
| 31 | 
            +
                    branch: docs
         | 
| 32 | 
            +
                    folder: docs
         | 
| Binary file | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            require 'erb'
         | 
| 3 | 
            +
            $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            template_path = File.expand_path("template.erb", __dir__)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            ENV['COVERAGE'] ||= 'PartialSummary'
         | 
| 8 | 
            +
            require 'covered/policy/default'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            $covered.enable
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            template = ERB.new(File.read(template_path)).tap do |template|
         | 
| 13 | 
            +
            	template.filename = template_path
         | 
| 14 | 
            +
            end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            @items = ["Cats", "Dogs", "Chickens"]
         | 
| 17 | 
            +
            puts template.result(binding)
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            $covered.disable
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            $covered.call($stdout)
         | 
    
        data/examples/coverage/test.rb
    CHANGED
    
    | @@ -1,8 +1,16 @@ | |
| 1 | 
            +
            trace_point = TracePoint.new(:call, :return, :line, :c_call, :c_return, :b_call, :b_return) do |trace|
         | 
| 2 | 
            +
            	puts [trace.path, trace.lineno].join(":")
         | 
| 3 | 
            +
            end
         | 
| 1 4 |  | 
| 2 | 
            -
             | 
| 5 | 
            +
            trace_point.enable
         | 
| 3 6 |  | 
| 4 | 
            -
             | 
| 7 | 
            +
            values = {foo: 10}
         | 
| 5 8 |  | 
| 6 | 
            -
             | 
| 7 | 
            -
            	 | 
| 9 | 
            +
            def shell_escape(x)
         | 
| 10 | 
            +
            	x
         | 
| 8 11 | 
             
            end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            values.map{|key, value| [
         | 
| 14 | 
            +
            	key.to_s.upcase,
         | 
| 15 | 
            +
            	shell_escape(value) # TracePoint is never triggered for this line.
         | 
| 16 | 
            +
            ]}
         | 
    
        data/lib/covered/capture.rb
    CHANGED
    
    | @@ -27,21 +27,26 @@ module Covered | |
| 27 27 | 
             
            		def initialize(output)
         | 
| 28 28 | 
             
            			super(output)
         | 
| 29 29 |  | 
| 30 | 
            -
            			 | 
| 31 | 
            -
            				 | 
| 32 | 
            -
            					 | 
| 30 | 
            +
            			begin
         | 
| 31 | 
            +
            				@trace = TracePoint.new(:line, :call, :c_call) do |event|
         | 
| 32 | 
            +
            					if path = event.path
         | 
| 33 | 
            +
            						@output.mark(path, event.lineno, 1)
         | 
| 34 | 
            +
            					end
         | 
| 33 35 | 
             
            				end
         | 
| 36 | 
            +
            			rescue
         | 
| 37 | 
            +
            				warn "Line coverage disabled: #{$!}"
         | 
| 38 | 
            +
            				@trace = nil
         | 
| 34 39 | 
             
            			end
         | 
| 35 40 | 
             
            		end
         | 
| 36 41 |  | 
| 37 42 | 
             
            		def enable
         | 
| 38 43 | 
             
            			super
         | 
| 39 44 |  | 
| 40 | 
            -
            			@trace | 
| 45 | 
            +
            			@trace&.enable
         | 
| 41 46 | 
             
            		end
         | 
| 42 47 |  | 
| 43 48 | 
             
            		def disable
         | 
| 44 | 
            -
            			@trace | 
| 49 | 
            +
            			@trace&.disable
         | 
| 45 50 |  | 
| 46 51 | 
             
            			super
         | 
| 47 52 | 
             
            		end
         | 
    
        data/lib/covered/coveralls.rb
    CHANGED
    
    | @@ -60,6 +60,8 @@ module Covered | |
| 60 60 | 
             
            				return {"service_name" => @service, "service_job_id" => @job_id}
         | 
| 61 61 | 
             
            			elsif job_id = ENV['TRAVIS_JOB_ID']
         | 
| 62 62 | 
             
            				return {"service_name" => "travis-ci", "service_job_id" => job_id}
         | 
| 63 | 
            +
            			elsif token = ENV['GITHUB_TOKEN']
         | 
| 64 | 
            +
            				return {"service_name" => "github", "repo_token" => token}
         | 
| 63 65 | 
             
            			else
         | 
| 64 66 | 
             
            				warn "#{self.class} can't detect service! Please specify COVERALLS_REPO_TOKEN."
         | 
| 65 67 | 
             
            			end
         | 
| @@ -0,0 +1,100 @@ | |
| 1 | 
            +
            # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
         | 
| 2 | 
            +
            # 
         | 
| 3 | 
            +
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 4 | 
            +
            # of this software and associated documentation files (the "Software"), to deal
         | 
| 5 | 
            +
            # in the Software without restriction, including without limitation the rights
         | 
| 6 | 
            +
            # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 7 | 
            +
            # copies of the Software, and to permit persons to whom the Software is
         | 
| 8 | 
            +
            # furnished to do so, subject to the following conditions:
         | 
| 9 | 
            +
            # 
         | 
| 10 | 
            +
            # The above copyright notice and this permission notice shall be included in
         | 
| 11 | 
            +
            # all copies or substantial portions of the Software.
         | 
| 12 | 
            +
            # 
         | 
| 13 | 
            +
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 14 | 
            +
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 15 | 
            +
            # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 16 | 
            +
            # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 17 | 
            +
            # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 18 | 
            +
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 19 | 
            +
            # THE SOFTWARE.
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            require_relative 'statistics'
         | 
| 22 | 
            +
            require_relative 'wrapper'
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            require 'console/output'
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            module Covered
         | 
| 27 | 
            +
            	class MarkdownSummary
         | 
| 28 | 
            +
            		def initialize(threshold: 1.0)
         | 
| 29 | 
            +
            			@threshold = threshold
         | 
| 30 | 
            +
            		end
         | 
| 31 | 
            +
            		
         | 
| 32 | 
            +
            		def each(wrapper)
         | 
| 33 | 
            +
            			statistics = Statistics.new
         | 
| 34 | 
            +
            			
         | 
| 35 | 
            +
            			wrapper.each do |coverage|
         | 
| 36 | 
            +
            				statistics << coverage
         | 
| 37 | 
            +
            				
         | 
| 38 | 
            +
            				if @threshold.nil? or coverage.ratio < @threshold
         | 
| 39 | 
            +
            					yield coverage
         | 
| 40 | 
            +
            				end
         | 
| 41 | 
            +
            			end
         | 
| 42 | 
            +
            			
         | 
| 43 | 
            +
            			return statistics
         | 
| 44 | 
            +
            		end
         | 
| 45 | 
            +
            		
         | 
| 46 | 
            +
            		def print_annotations(output, coverage, line, line_offset)
         | 
| 47 | 
            +
            			if annotations = coverage.annotations[line_offset]
         | 
| 48 | 
            +
            				prefix = "#{line_offset}|".rjust(8) + "*|".rjust(8)
         | 
| 49 | 
            +
            				output.write prefix
         | 
| 50 | 
            +
            				
         | 
| 51 | 
            +
            				output.write line.match(/^\s+/)
         | 
| 52 | 
            +
            				output.puts "\# #{annotations.join(", ")}"
         | 
| 53 | 
            +
            			end
         | 
| 54 | 
            +
            		end
         | 
| 55 | 
            +
            		
         | 
| 56 | 
            +
            		def print_line_header(output)
         | 
| 57 | 
            +
            			output.puts "Line|".rjust(8) + "Hits|".rjust(8)
         | 
| 58 | 
            +
            		end
         | 
| 59 | 
            +
            		
         | 
| 60 | 
            +
            		def print_line(output, line, line_offset, count)
         | 
| 61 | 
            +
            			prefix = "#{line_offset}|".rjust(8) + "#{count}|".rjust(8)
         | 
| 62 | 
            +
            			
         | 
| 63 | 
            +
            			output.write prefix
         | 
| 64 | 
            +
            			output.write line
         | 
| 65 | 
            +
            			
         | 
| 66 | 
            +
            			# If there was no newline at end of file, we add one:
         | 
| 67 | 
            +
            			unless line.end_with?($/)
         | 
| 68 | 
            +
            				output.puts
         | 
| 69 | 
            +
            			end
         | 
| 70 | 
            +
            		end
         | 
| 71 | 
            +
            		
         | 
| 72 | 
            +
            		# A coverage array gives, for each line, the number of line execution by the interpreter. A nil value means coverage is disabled for this line (lines like else and end).
         | 
| 73 | 
            +
            		def call(wrapper, output = $stdout)
         | 
| 74 | 
            +
            			output.puts '# Coverage Report'
         | 
| 75 | 
            +
            			output.puts
         | 
| 76 | 
            +
            			
         | 
| 77 | 
            +
            			ordered = []
         | 
| 78 | 
            +
            			buffer = StringIO.new
         | 
| 79 | 
            +
            			
         | 
| 80 | 
            +
            			statistics = self.each(wrapper) do |coverage|
         | 
| 81 | 
            +
            				ordered << coverage unless coverage.complete?
         | 
| 82 | 
            +
            			end
         | 
| 83 | 
            +
            			
         | 
| 84 | 
            +
            			statistics.print(output)
         | 
| 85 | 
            +
            			
         | 
| 86 | 
            +
            			if ordered.any?
         | 
| 87 | 
            +
            				output.puts "", "\#\# Least Coverage:", ""
         | 
| 88 | 
            +
            				ordered.sort_by!(&:missing_count).reverse!
         | 
| 89 | 
            +
            				
         | 
| 90 | 
            +
            				ordered.first(5).each do |coverage|
         | 
| 91 | 
            +
            					path = wrapper.relative_path(coverage.path)
         | 
| 92 | 
            +
            					
         | 
| 93 | 
            +
            					output.puts "- `#{path}`: #{coverage.missing_count} lines not executed!"
         | 
| 94 | 
            +
            				end
         | 
| 95 | 
            +
            			end
         | 
| 96 | 
            +
            			
         | 
| 97 | 
            +
            			output.print(buffer.string)
         | 
| 98 | 
            +
            		end
         | 
| 99 | 
            +
            	end
         | 
| 100 | 
            +
            end
         | 
    
        data/lib/covered/policy.rb
    CHANGED
    
    | @@ -102,7 +102,7 @@ module Covered | |
| 102 102 | 
             
            				begin
         | 
| 103 103 | 
             
            					klass = Covered.const_get(@name)
         | 
| 104 104 | 
             
            				rescue NameError
         | 
| 105 | 
            -
            					require_relative | 
| 105 | 
            +
            					require_relative(snake_case(@name))
         | 
| 106 106 | 
             
            				end
         | 
| 107 107 |  | 
| 108 108 | 
             
            				klass = Covered.const_get(@name)
         | 
| @@ -117,6 +117,12 @@ module Covered | |
| 117 117 | 
             
            			def to_s
         | 
| 118 118 | 
             
            				"\#<#{self.class} loading #{@name}>"
         | 
| 119 119 | 
             
            			end
         | 
| 120 | 
            +
            			
         | 
| 121 | 
            +
            			private
         | 
| 122 | 
            +
            			
         | 
| 123 | 
            +
            			def snake_case(name)
         | 
| 124 | 
            +
            				name.gsub(/(.+)(?=[A-Z\z])/){$1 + '_'}.downcase
         | 
| 125 | 
            +
            			end
         | 
| 120 126 | 
             
            		end
         | 
| 121 127 |  | 
| 122 128 | 
             
            		def reports!(coverage = ENV['COVERAGE'])
         | 
    
        data/lib/covered/source.rb
    CHANGED
    
    | @@ -36,13 +36,14 @@ module Covered | |
| 36 36 |  | 
| 37 37 | 
             
            			begin
         | 
| 38 38 | 
             
            				@trace = TracePoint.new(:script_compiled) do |event|
         | 
| 39 | 
            -
            					if path = event.instruction_sequence | 
| 39 | 
            +
            					if path = event.instruction_sequence.path and source = event.eval_script
         | 
| 40 40 | 
             
            						@mutex.synchronize do
         | 
| 41 41 | 
             
            							@paths[path] = source
         | 
| 42 42 | 
             
            						end
         | 
| 43 43 | 
             
            					end
         | 
| 44 44 | 
             
            				end
         | 
| 45 | 
            -
            			rescue | 
| 45 | 
            +
            			rescue
         | 
| 46 | 
            +
            				warn "Script coverage disabled: #{$!}"
         | 
| 46 47 | 
             
            				@trace = nil
         | 
| 47 48 | 
             
            			end
         | 
| 48 49 | 
             
            		end
         | 
    
        data/lib/covered/summary.rb
    CHANGED
    
    | @@ -21,7 +21,7 @@ | |
| 21 21 | 
             
            require_relative 'statistics'
         | 
| 22 22 | 
             
            require_relative 'wrapper'
         | 
| 23 23 |  | 
| 24 | 
            -
            require ' | 
| 24 | 
            +
            require 'console/terminal'
         | 
| 25 25 |  | 
| 26 26 | 
             
            module Covered
         | 
| 27 27 | 
             
            	class Summary
         | 
| @@ -29,6 +29,24 @@ module Covered | |
| 29 29 | 
             
            			@threshold = threshold
         | 
| 30 30 | 
             
            		end
         | 
| 31 31 |  | 
| 32 | 
            +
            		def terminal(output)
         | 
| 33 | 
            +
            			Console::Terminal.for(output).tap do |terminal|
         | 
| 34 | 
            +
            				terminal[:path] ||= terminal.style(nil, nil, :bold, :underline)
         | 
| 35 | 
            +
            				terminal[:brief_path] ||= terminal.style(:yellow)
         | 
| 36 | 
            +
            				
         | 
| 37 | 
            +
            				terminal[:uncovered_prefix] ||= terminal.style(:red)
         | 
| 38 | 
            +
            				terminal[:covered_prefix] ||= terminal.style(:green)
         | 
| 39 | 
            +
            				terminal[:ignored_prefix] ||= terminal.style(nil, nil, :faint)
         | 
| 40 | 
            +
            				terminal[:header_prefix] ||= terminal.style(nil, nil, :faint)
         | 
| 41 | 
            +
            				
         | 
| 42 | 
            +
            				terminal[:uncovered_code] ||= terminal.style(:red)
         | 
| 43 | 
            +
            				terminal[:covered_code] ||= terminal.style(:green)
         | 
| 44 | 
            +
            				terminal[:ignored_code] ||= terminal.style(nil, nil, :faint)
         | 
| 45 | 
            +
            				
         | 
| 46 | 
            +
            				terminal[:annotations] ||= terminal.style(:blue)
         | 
| 47 | 
            +
            			end
         | 
| 48 | 
            +
            		end
         | 
| 49 | 
            +
            		
         | 
| 32 50 | 
             
            		def each(wrapper)
         | 
| 33 51 | 
             
            			statistics = Statistics.new
         | 
| 34 52 |  | 
| @@ -43,49 +61,64 @@ module Covered | |
| 43 61 | 
             
            			return statistics
         | 
| 44 62 | 
             
            		end
         | 
| 45 63 |  | 
| 46 | 
            -
            		def print_annotations( | 
| 64 | 
            +
            		def print_annotations(terminal, coverage, line, line_offset)
         | 
| 47 65 | 
             
            			if annotations = coverage.annotations[line_offset]
         | 
| 48 | 
            -
            				 | 
| 49 | 
            -
            				 | 
| 66 | 
            +
            				prefix = "#{line_offset}|".rjust(8) + "*|".rjust(8)
         | 
| 67 | 
            +
            				terminal.write prefix, style: :ignored_prefix
         | 
| 50 68 |  | 
| 51 | 
            -
            				 | 
| 52 | 
            -
            				 | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 69 | 
            +
            				terminal.write line.match(/^\s+/)
         | 
| 70 | 
            +
            				terminal.puts "\# #{annotations.join(", ")}", style: :annotations
         | 
| 71 | 
            +
            			end
         | 
| 72 | 
            +
            		end
         | 
| 73 | 
            +
            		
         | 
| 74 | 
            +
            		def print_line_header(terminal)
         | 
| 75 | 
            +
            			prefix = "Line|".rjust(8) + "Hits|".rjust(8)
         | 
| 76 | 
            +
            			
         | 
| 77 | 
            +
            			terminal.puts prefix, style: :header_prefix
         | 
| 78 | 
            +
            		end
         | 
| 79 | 
            +
            		
         | 
| 80 | 
            +
            		def print_line(terminal, line, line_offset, count)
         | 
| 81 | 
            +
            			prefix = "#{line_offset}|".rjust(8) + "#{count}|".rjust(8)
         | 
| 82 | 
            +
            			
         | 
| 83 | 
            +
            			if count == nil
         | 
| 84 | 
            +
            				terminal.write prefix, style: :ignored_prefix
         | 
| 85 | 
            +
            				terminal.write line, style: :ignored_code
         | 
| 86 | 
            +
            			elsif count == 0
         | 
| 87 | 
            +
            				terminal.write prefix, style: :uncovered_prefix
         | 
| 88 | 
            +
            				terminal.write line, style: :uncovered_code
         | 
| 89 | 
            +
            			else
         | 
| 90 | 
            +
            				terminal.write prefix, style: :covered_prefix
         | 
| 91 | 
            +
            				terminal.write line, style: :covered_code
         | 
| 92 | 
            +
            			end
         | 
| 93 | 
            +
            			
         | 
| 94 | 
            +
            			# If there was no newline at end of file, we add one:
         | 
| 95 | 
            +
            			unless line.end_with? $/
         | 
| 96 | 
            +
            				terminal.puts
         | 
| 55 97 | 
             
            			end
         | 
| 56 98 | 
             
            		end
         | 
| 57 99 |  | 
| 58 100 | 
             
            		# A coverage array gives, for each line, the number of line execution by the interpreter. A nil value means coverage is disabled for this line (lines like else and end).
         | 
| 59 101 | 
             
            		def call(wrapper, output = $stdout)
         | 
| 102 | 
            +
            			terminal = self.terminal(output)
         | 
| 103 | 
            +
            			
         | 
| 60 104 | 
             
            			statistics = self.each(wrapper) do |coverage|
         | 
| 61 105 | 
             
            				line_offset = 1
         | 
| 62 106 |  | 
| 63 107 | 
             
            				path = wrapper.relative_path(coverage.path)
         | 
| 64 | 
            -
            				 | 
| 108 | 
            +
            				terminal.puts ""
         | 
| 109 | 
            +
            				terminal.puts path, style: :path
         | 
| 65 110 |  | 
| 66 111 | 
             
            				counts = coverage.counts
         | 
| 67 112 |  | 
| 68 113 | 
             
            				coverage.read do |file|
         | 
| 114 | 
            +
            					print_line_header(terminal)
         | 
| 115 | 
            +
            					
         | 
| 69 116 | 
             
            					file.each_line do |line|
         | 
| 70 117 | 
             
            						count = counts[line_offset]
         | 
| 71 118 |  | 
| 72 | 
            -
            						print_annotations( | 
| 73 | 
            -
            						
         | 
| 74 | 
            -
            						output.write("#{line_offset}|".rjust(8))
         | 
| 75 | 
            -
            						output.write("#{count}|".rjust(8))
         | 
| 119 | 
            +
            						print_annotations(terminal, coverage, line, line_offset)
         | 
| 76 120 |  | 
| 77 | 
            -
            						 | 
| 78 | 
            -
            							output.write Rainbow(line).faint
         | 
| 79 | 
            -
            						elsif count == 0
         | 
| 80 | 
            -
            							output.write Rainbow(line).red
         | 
| 81 | 
            -
            						else
         | 
| 82 | 
            -
            							output.write Rainbow(line).green
         | 
| 83 | 
            -
            						end
         | 
| 84 | 
            -
            						
         | 
| 85 | 
            -
            						# If there was no newline at end of file, we add one:
         | 
| 86 | 
            -
            						unless line.end_with? $/
         | 
| 87 | 
            -
            							output.puts
         | 
| 88 | 
            -
            						end
         | 
| 121 | 
            +
            						print_line(terminal, line, line_offset, count)
         | 
| 89 122 |  | 
| 90 123 | 
             
            						line_offset += 1
         | 
| 91 124 | 
             
            					end
         | 
| @@ -100,24 +133,26 @@ module Covered | |
| 100 133 |  | 
| 101 134 | 
             
            	class BriefSummary < Summary
         | 
| 102 135 | 
             
            		def call(wrapper, output = $stdout, before: 4, after: 4)
         | 
| 136 | 
            +
            			terminal = self.terminal(output)
         | 
| 137 | 
            +
            			
         | 
| 103 138 | 
             
            			ordered = []
         | 
| 104 139 |  | 
| 105 140 | 
             
            			statistics = self.each(wrapper) do |coverage|
         | 
| 106 141 | 
             
            				ordered << coverage unless coverage.complete?
         | 
| 107 142 | 
             
            			end
         | 
| 108 143 |  | 
| 109 | 
            -
            			 | 
| 144 | 
            +
            			terminal.puts
         | 
| 110 145 | 
             
            			statistics.print(output)
         | 
| 111 146 |  | 
| 112 147 | 
             
            			if ordered.any?
         | 
| 113 | 
            -
            				 | 
| 148 | 
            +
            				terminal.puts "", "Least Coverage:"
         | 
| 114 149 | 
             
            				ordered.sort_by!(&:missing_count).reverse!
         | 
| 115 150 |  | 
| 116 151 | 
             
            				ordered.first(5).each do |coverage|
         | 
| 117 152 | 
             
            					path = wrapper.relative_path(coverage.path)
         | 
| 118 153 |  | 
| 119 | 
            -
            					 | 
| 120 | 
            -
            					 | 
| 154 | 
            +
            					terminal.write path, style: :brief_path
         | 
| 155 | 
            +
            					terminal.puts ": #{coverage.missing_count} lines not executed!"
         | 
| 121 156 | 
             
            				end
         | 
| 122 157 | 
             
            			end
         | 
| 123 158 | 
             
            		end
         | 
| @@ -125,16 +160,21 @@ module Covered | |
| 125 160 |  | 
| 126 161 | 
             
            	class PartialSummary < Summary
         | 
| 127 162 | 
             
            		def call(wrapper, output = $stdout, before: 4, after: 4)
         | 
| 163 | 
            +
            			terminal = self.terminal(output)
         | 
| 164 | 
            +
            			
         | 
| 128 165 | 
             
            			statistics = self.each(wrapper) do |coverage|
         | 
| 129 166 | 
             
            				line_offset = 1
         | 
| 130 167 |  | 
| 131 168 | 
             
            				path = wrapper.relative_path(coverage.path)
         | 
| 132 | 
            -
            				 | 
| 169 | 
            +
            				terminal.puts ""
         | 
| 170 | 
            +
            				terminal.puts path, style: :path
         | 
| 133 171 |  | 
| 134 172 | 
             
            				counts = coverage.counts
         | 
| 135 173 | 
             
            				last_line = nil
         | 
| 136 174 |  | 
| 137 175 | 
             
            				unless coverage.zero?
         | 
| 176 | 
            +
            					print_line_header(terminal)
         | 
| 177 | 
            +
            					
         | 
| 138 178 | 
             
            					coverage.read do |file|
         | 
| 139 179 | 
             
            						file.each_line do |line|
         | 
| 140 180 | 
             
            							range = Range.new([line_offset - before, 0].max, line_offset+after)
         | 
| @@ -143,28 +183,11 @@ module Covered | |
| 143 183 | 
             
            								count = counts[line_offset]
         | 
| 144 184 |  | 
| 145 185 | 
             
            								if last_line and last_line != line_offset-1
         | 
| 146 | 
            -
            									 | 
| 186 | 
            +
            									terminal.puts ":".rjust(16)
         | 
| 147 187 | 
             
            								end
         | 
| 148 188 |  | 
| 149 | 
            -
            								print_annotations( | 
| 150 | 
            -
            								
         | 
| 151 | 
            -
            								prefix = "#{line_offset}|".rjust(8) + "#{count}|".rjust(8)
         | 
| 152 | 
            -
            								
         | 
| 153 | 
            -
            								if count == nil
         | 
| 154 | 
            -
            									output.write prefix
         | 
| 155 | 
            -
            									output.write Rainbow(line).faint
         | 
| 156 | 
            -
            								elsif count == 0
         | 
| 157 | 
            -
            									output.write Rainbow(prefix).background(:darkred)
         | 
| 158 | 
            -
            									output.write Rainbow(line).red
         | 
| 159 | 
            -
            								else
         | 
| 160 | 
            -
            									output.write Rainbow(prefix).background(:darkgreen)
         | 
| 161 | 
            -
            									output.write Rainbow(line).green
         | 
| 162 | 
            -
            								end
         | 
| 163 | 
            -
            								
         | 
| 164 | 
            -
            								# If there was no newline at end of file, we add one:
         | 
| 165 | 
            -
            								unless line.end_with? $/
         | 
| 166 | 
            -
            									output.puts
         | 
| 167 | 
            -
            								end
         | 
| 189 | 
            +
            								print_annotations(terminal, coverage, line, line_offset)
         | 
| 190 | 
            +
            								print_line(terminal, line, line_offset, count)
         | 
| 168 191 |  | 
| 169 192 | 
             
            								last_line = line_offset
         | 
| 170 193 | 
             
            							end
         | 
| @@ -177,7 +200,7 @@ module Covered | |
| 177 200 | 
             
            				coverage.print(output)
         | 
| 178 201 | 
             
            			end
         | 
| 179 202 |  | 
| 180 | 
            -
            			 | 
| 203 | 
            +
            			terminal.puts
         | 
| 181 204 | 
             
            			statistics.print(output)
         | 
| 182 205 | 
             
            		end
         | 
| 183 206 | 
             
            	end
         | 
    
        data/lib/covered/version.rb
    CHANGED
    
    
    
        data.tar.gz.sig
    ADDED
    
    | Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,17 +1,45 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: covered
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.14.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Samuel Williams
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 | 
            -
            cert_chain: | 
| 11 | 
            -
             | 
| 10 | 
            +
            cert_chain:
         | 
| 11 | 
            +
            - |
         | 
| 12 | 
            +
              -----BEGIN CERTIFICATE-----
         | 
| 13 | 
            +
              MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
         | 
| 14 | 
            +
              ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
         | 
| 15 | 
            +
              MTYwNjMzNDRaFw0yMjA4MTYwNjMzNDRaMDcxNTAzBgNVBAMMLHNhbXVlbC53aWxs
         | 
| 16 | 
            +
              aWFtcy9EQz1vcmlvbnRyYW5zZmVyL0RDPWNvL0RDPW56MIIBojANBgkqhkiG9w0B
         | 
| 17 | 
            +
              AQEFAAOCAY8AMIIBigKCAYEAyXLSS/cw+fXJ5e7hi+U/TeChPWeYdwJojDsFY1xr
         | 
| 18 | 
            +
              xvtqbTTL8gbLHz5LW3QD2nfwCv3qTlw0qI3Ie7a9VMJMbSvgVEGEfQirqIgJXWMj
         | 
| 19 | 
            +
              eNMDgKsMJtC7u/43abRKx7TCURW3iWyR19NRngsJJmaR51yGGGm2Kfsr+JtKKLtL
         | 
| 20 | 
            +
              L188Wm3f13KAx7QJU8qyuBnj1/gWem076hzdA7xi1DbrZrch9GCRz62xymJlrJHn
         | 
| 21 | 
            +
              9iZEZ7AxrS7vokhMlzSr/XMUihx/8aFKtk+tMLClqxZSmBWIErWdicCGTULXCBNb
         | 
| 22 | 
            +
              E/mljo4zEVKhlTWpJklMIhr55ZRrSarKFuW7en0+tpJrfsYiAmXMJNi4XAYJH7uL
         | 
| 23 | 
            +
              rgJuJwSaa/dMz+VmUoo7VKtSfCoOI+6v5/z0sK3oT6sG6ZwyI47DBq2XqNC6tnAj
         | 
| 24 | 
            +
              w+XmCywiTQrFzMMAvcA7rPI4F0nU1rZId51rOvvfxaONp+wgTi4P8owZLw0/j0m4
         | 
| 25 | 
            +
              8C20DYi6EYx4AHDXiLpElWh3AgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8E
         | 
| 26 | 
            +
              BAMCBLAwHQYDVR0OBBYEFB6ZaeWKxQjGTI+pmz7cKRmMIywwMC4GA1UdEQQnMCWB
         | 
| 27 | 
            +
              I3NhbXVlbC53aWxsaWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWB
         | 
| 28 | 
            +
              I3NhbXVlbC53aWxsaWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEB
         | 
| 29 | 
            +
              CwUAA4IBgQBVoM+pu3dpdUhZM1w051iw5GfiqclAr1Psypf16Tiod/ho//4oAu6T
         | 
| 30 | 
            +
              9fj3DPX/acWV9P/FScvqo4Qgv6g4VWO5ZU7z2JmPoTXZtYMunRAmQPFL/gSUc6aK
         | 
| 31 | 
            +
              vszMHIyhtyzRc6DnfW2AiVOjMBjaYv8xXZc9bduniRVPrLR4J7ozmGLh4o4uJp7w
         | 
| 32 | 
            +
              x9KCFaR8Lvn/r0oJWJOqb/DMAYI83YeN2Dlt3jpwrsmsONrtC5S3gOUle5afSGos
         | 
| 33 | 
            +
              bYt5ocnEpKSomR9ZtnCGljds/aeO1Xgpn2r9HHcjwnH346iNrnHmMlC7BtHUFPDg
         | 
| 34 | 
            +
              Ts92S47PTOXzwPBDsrFiq3VLbRjHSwf8rpqybQBH9MfzxGGxTaETQYOd6b4e4Ag6
         | 
| 35 | 
            +
              y92abGna0bmIEb4+Tx9rQ10Uijh1POzvr/VTH4bbIPy9FbKrRsIQ24qDbNJRtOpE
         | 
| 36 | 
            +
              RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
         | 
| 37 | 
            +
              HiLJ8VOFx6w=
         | 
| 38 | 
            +
              -----END CERTIFICATE-----
         | 
| 39 | 
            +
            date: 2021-10-26 00:00:00.000000000 Z
         | 
| 12 40 | 
             
            dependencies:
         | 
| 13 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            -
              name:  | 
| 42 | 
            +
              name: async-rest
         | 
| 15 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 44 | 
             
                requirements:
         | 
| 17 45 | 
             
                - - ">="
         | 
| @@ -25,19 +53,19 @@ dependencies: | |
| 25 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 54 | 
             
                    version: '0'
         | 
| 27 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            -
              name:  | 
| 56 | 
            +
              name: console
         | 
| 29 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 58 | 
             
                requirements:
         | 
| 31 | 
            -
                - - " | 
| 59 | 
            +
                - - "~>"
         | 
| 32 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: '0'
         | 
| 61 | 
            +
                    version: '1.0'
         | 
| 34 62 | 
             
              type: :runtime
         | 
| 35 63 | 
             
              prerelease: false
         | 
| 36 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 65 | 
             
                requirements:
         | 
| 38 | 
            -
                - - " | 
| 66 | 
            +
                - - "~>"
         | 
| 39 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: '0'
         | 
| 68 | 
            +
                    version: '1.0'
         | 
| 41 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 70 | 
             
              name: msgpack
         | 
| 43 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -53,7 +81,7 @@ dependencies: | |
| 53 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 82 | 
             
                    version: '0'
         | 
| 55 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            -
              name:  | 
| 84 | 
            +
              name: parser
         | 
| 57 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 86 | 
             
                requirements:
         | 
| 59 87 | 
             
                - - ">="
         | 
| @@ -67,21 +95,21 @@ dependencies: | |
| 67 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 96 | 
             
                    version: '0'
         | 
| 69 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            -
              name:  | 
| 98 | 
            +
              name: bundler
         | 
| 71 99 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 100 | 
             
                requirements:
         | 
| 73 | 
            -
                - - " | 
| 101 | 
            +
                - - ">="
         | 
| 74 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            -
                    version: ' | 
| 103 | 
            +
                    version: '0'
         | 
| 76 104 | 
             
              type: :development
         | 
| 77 105 | 
             
              prerelease: false
         | 
| 78 106 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 107 | 
             
                requirements:
         | 
| 80 | 
            -
                - - " | 
| 108 | 
            +
                - - ">="
         | 
| 81 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            -
                    version: ' | 
| 110 | 
            +
                    version: '0'
         | 
| 83 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 | 
            -
              name:  | 
| 112 | 
            +
              name: minitest
         | 
| 85 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 114 | 
             
                requirements:
         | 
| 87 115 | 
             
                - - ">="
         | 
| @@ -123,35 +151,31 @@ dependencies: | |
| 123 151 | 
             
                  - !ruby/object:Gem::Version
         | 
| 124 152 | 
             
                    version: '3.6'
         | 
| 125 153 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 126 | 
            -
              name:  | 
| 154 | 
            +
              name: trenni
         | 
| 127 155 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 128 156 | 
             
                requirements:
         | 
| 129 | 
            -
                - - " | 
| 157 | 
            +
                - - "~>"
         | 
| 130 158 | 
             
                  - !ruby/object:Gem::Version
         | 
| 131 | 
            -
                    version: ' | 
| 159 | 
            +
                    version: '3.6'
         | 
| 132 160 | 
             
              type: :development
         | 
| 133 161 | 
             
              prerelease: false
         | 
| 134 162 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 135 163 | 
             
                requirements:
         | 
| 136 | 
            -
                - - " | 
| 164 | 
            +
                - - "~>"
         | 
| 137 165 | 
             
                  - !ruby/object:Gem::Version
         | 
| 138 | 
            -
                    version: ' | 
| 139 | 
            -
            description: | 
| 166 | 
            +
                    version: '3.6'
         | 
| 167 | 
            +
            description:
         | 
| 140 168 | 
             
            email:
         | 
| 141 | 
            -
            - samuel.williams@oriontransfer.co.nz
         | 
| 142 169 | 
             
            executables: []
         | 
| 143 170 | 
             
            extensions: []
         | 
| 144 171 | 
             
            extra_rdoc_files: []
         | 
| 145 172 | 
             
            files:
         | 
| 146 | 
            -
            - ". | 
| 147 | 
            -
            - ". | 
| 148 | 
            -
            - ".rspec"
         | 
| 149 | 
            -
            - ".travis.yml"
         | 
| 150 | 
            -
            - Gemfile
         | 
| 151 | 
            -
            - README.md
         | 
| 152 | 
            -
            - Rakefile
         | 
| 153 | 
            -
            - covered.gemspec
         | 
| 173 | 
            +
            - ".github/workflows/development.yml"
         | 
| 174 | 
            +
            - ".github/workflows/documentation.yml"
         | 
| 154 175 | 
             
            - examples/coverage/covered.rb
         | 
| 176 | 
            +
            - examples/coverage/erb/.covered.db
         | 
| 177 | 
            +
            - examples/coverage/erb/coverage.rb
         | 
| 178 | 
            +
            - examples/coverage/erb/template.erb
         | 
| 155 179 | 
             
            - examples/coverage/parser.rb
         | 
| 156 180 | 
             
            - examples/coverage/simplecov.rb
         | 
| 157 181 | 
             
            - examples/coverage/test.rb
         | 
| @@ -161,6 +185,7 @@ files: | |
| 161 185 | 
             
            - lib/covered/coverage.rb
         | 
| 162 186 | 
             
            - lib/covered/coveralls.rb
         | 
| 163 187 | 
             
            - lib/covered/files.rb
         | 
| 188 | 
            +
            - lib/covered/markdown_summary.rb
         | 
| 164 189 | 
             
            - lib/covered/minitest.rb
         | 
| 165 190 | 
             
            - lib/covered/persist.rb
         | 
| 166 191 | 
             
            - lib/covered/policy.rb
         | 
| @@ -173,9 +198,11 @@ files: | |
| 173 198 | 
             
            - lib/covered/wrapper.rb
         | 
| 174 199 | 
             
            - media/example.png
         | 
| 175 200 | 
             
            homepage: https://github.com/ioquatix/covered
         | 
| 176 | 
            -
            licenses: | 
| 177 | 
            -
             | 
| 178 | 
            -
             | 
| 201 | 
            +
            licenses:
         | 
| 202 | 
            +
            - MIT
         | 
| 203 | 
            +
            metadata:
         | 
| 204 | 
            +
              funding_uri: https://github.com/sponsors/ioquatix/
         | 
| 205 | 
            +
            post_install_message:
         | 
| 179 206 | 
             
            rdoc_options: []
         | 
| 180 207 | 
             
            require_paths:
         | 
| 181 208 | 
             
            - lib
         | 
| @@ -190,8 +217,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 190 217 | 
             
                - !ruby/object:Gem::Version
         | 
| 191 218 | 
             
                  version: '0'
         | 
| 192 219 | 
             
            requirements: []
         | 
| 193 | 
            -
            rubygems_version: 3. | 
| 194 | 
            -
            signing_key: | 
| 220 | 
            +
            rubygems_version: 3.1.6
         | 
| 221 | 
            +
            signing_key:
         | 
| 195 222 | 
             
            specification_version: 4
         | 
| 196 223 | 
             
            summary: A modern approach to code coverage.
         | 
| 197 224 | 
             
            test_files: []
         | 
    
        metadata.gz.sig
    ADDED
    
    | Binary file | 
    
        data/.editorconfig
    DELETED
    
    
    
        data/.gitignore
    DELETED
    
    
    
        data/.rspec
    DELETED
    
    
    
        data/.travis.yml
    DELETED
    
    
    
        data/Gemfile
    DELETED
    
    
    
        data/README.md
    DELETED
    
    | @@ -1,132 +0,0 @@ | |
| 1 | 
            -
            # Covered [](https://travis-ci.com/ioquatix/covered) [](https://coveralls.io/github/ioquatix/covered)
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            Covered uses modern Ruby features to generate comprehensive coverage, including support for templates which are compiled into Ruby.
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            - Incremental coverage - if you run your full test suite, and the run a subset, it will still report the correct coverage - so you can incrementally work on improving coverage.
         | 
| 6 | 
            -
            - Integration with RSpec, Minitest, Travis & Coveralls - no need to configure anything - out of the box support for these platforms.
         | 
| 7 | 
            -
            - Supports coverage of views - templates compiled to Ruby code can be tracked for coverage reporting.
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            ## Motivation
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            Existing Ruby coverage tools are unable to handle `eval`ed code. This is because the `coverage` module built into Ruby doesn't expose the necessary hooks to capture it. Using the [parser] gem allows us to do our own source code analysis to compute executable lines, thus making it possible to compute coverage for "templates".
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            It's still tricky to do it correctly, but it is feasible now to compute coverage of web application "views" by using this technique. This gem is an exploration to see what is possible.
         | 
| 16 | 
            -
             | 
| 17 | 
            -
            [parser]: https://github.com/whitequark/parser
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            ## Installation
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            Add this line to your application's `Gemfile`:
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            ```ruby
         | 
| 24 | 
            -
            gem 'covered'
         | 
| 25 | 
            -
            ```
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            ### RSpec Integration
         | 
| 28 | 
            -
             | 
| 29 | 
            -
            In your `spec/spec_helper.rb` add the following before loading any other code:
         | 
| 30 | 
            -
             | 
| 31 | 
            -
            ```ruby
         | 
| 32 | 
            -
            require 'covered/rspec'
         | 
| 33 | 
            -
            ```
         | 
| 34 | 
            -
             | 
| 35 | 
            -
            Ensure that you have a `.rspec` file with `--require spec_helper`:
         | 
| 36 | 
            -
             | 
| 37 | 
            -
            ```
         | 
| 38 | 
            -
            --require spec_helper
         | 
| 39 | 
            -
            --format documentation
         | 
| 40 | 
            -
            --warnings
         | 
| 41 | 
            -
            ```
         | 
| 42 | 
            -
             | 
| 43 | 
            -
            ### Minitest Integration
         | 
| 44 | 
            -
             | 
| 45 | 
            -
            In your `test/test_helper.rb` add the following before loading any other code:
         | 
| 46 | 
            -
             | 
| 47 | 
            -
            ```ruby
         | 
| 48 | 
            -
            require 'covered/minitest'
         | 
| 49 | 
            -
            require 'minitest/autorun'
         | 
| 50 | 
            -
            ```
         | 
| 51 | 
            -
             | 
| 52 | 
            -
            In your test files, e.g. `test/dummy_test.rb` add the following at the top:
         | 
| 53 | 
            -
             | 
| 54 | 
            -
            ```ruby
         | 
| 55 | 
            -
            require_relative 'test_helper'
         | 
| 56 | 
            -
            ```
         | 
| 57 | 
            -
             | 
| 58 | 
            -
            ## Usage
         | 
| 59 | 
            -
             | 
| 60 | 
            -
            When running `rspec`, you can specify the kind of coverage analysis you would like:
         | 
| 61 | 
            -
             | 
| 62 | 
            -
            ```
         | 
| 63 | 
            -
            COVERAGE=Summary rspec
         | 
| 64 | 
            -
            ```
         | 
| 65 | 
            -
             | 
| 66 | 
            -
            If no `COVERAGE` is specified, coverage tracking will be disabled.
         | 
| 67 | 
            -
             | 
| 68 | 
            -
            ### Partial Summary
         | 
| 69 | 
            -
             | 
| 70 | 
            -
            ```
         | 
| 71 | 
            -
            COVERAGE=PartialSummary rspec
         | 
| 72 | 
            -
            ```
         | 
| 73 | 
            -
             | 
| 74 | 
            -
            This report only shows snippets of source code with incomplete coverage.
         | 
| 75 | 
            -
             | 
| 76 | 
            -
            ### Brief Summary
         | 
| 77 | 
            -
             | 
| 78 | 
            -
            ```
         | 
| 79 | 
            -
            COVERAGE=BriefSummary rspec
         | 
| 80 | 
            -
            ```
         | 
| 81 | 
            -
             | 
| 82 | 
            -
            This report lists several files in order of least coverage.l
         | 
| 83 | 
            -
             | 
| 84 | 
            -
            ### Coveralls/Travis Integration
         | 
| 85 | 
            -
             | 
| 86 | 
            -
            You can send coverage information to [Coveralls](https://coveralls.io) by editing your `.travis.yml` file:
         | 
| 87 | 
            -
             | 
| 88 | 
            -
            ```
         | 
| 89 | 
            -
            matrix:
         | 
| 90 | 
            -
              include:
         | 
| 91 | 
            -
                - rvm: 2.6
         | 
| 92 | 
            -
                  env: COVERAGE=PartialSummary,Coveralls
         | 
| 93 | 
            -
            ```
         | 
| 94 | 
            -
             | 
| 95 | 
            -
            This will print out a brief report and then upload the coverage data. This integrates transparently with Travis.
         | 
| 96 | 
            -
             | 
| 97 | 
            -
            ## See Also
         | 
| 98 | 
            -
             | 
| 99 | 
            -
            - [coveralls-ruby](https://github.com/lemurheavy/coveralls-ruby) – the official Coveralls implementation for Ruby.
         | 
| 100 | 
            -
            - [simplecov](https://github.com/colszowka/simplecov) – one of the original coverage implementations for Ruby, uses the built-in `coverage` library.
         | 
| 101 | 
            -
             | 
| 102 | 
            -
            ## Contributing
         | 
| 103 | 
            -
             | 
| 104 | 
            -
            1. Fork it
         | 
| 105 | 
            -
            2. Create your feature branch (`git checkout -b my-new-feature`)
         | 
| 106 | 
            -
            3. Commit your changes (`git commit -am 'Add some feature'`)
         | 
| 107 | 
            -
            4. Push to the branch (`git push origin my-new-feature`)
         | 
| 108 | 
            -
            5. Create new Pull Request
         | 
| 109 | 
            -
             | 
| 110 | 
            -
            ## License
         | 
| 111 | 
            -
             | 
| 112 | 
            -
            Released under the MIT license.
         | 
| 113 | 
            -
             | 
| 114 | 
            -
            Copyright, 2018, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
         | 
| 115 | 
            -
             | 
| 116 | 
            -
            Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 117 | 
            -
            of this software and associated documentation files (the "Software"), to deal
         | 
| 118 | 
            -
            in the Software without restriction, including without limitation the rights
         | 
| 119 | 
            -
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 120 | 
            -
            copies of the Software, and to permit persons to whom the Software is
         | 
| 121 | 
            -
            furnished to do so, subject to the following conditions:
         | 
| 122 | 
            -
             | 
| 123 | 
            -
            The above copyright notice and this permission notice shall be included in
         | 
| 124 | 
            -
            all copies or substantial portions of the Software.
         | 
| 125 | 
            -
             | 
| 126 | 
            -
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 127 | 
            -
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 128 | 
            -
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 129 | 
            -
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 130 | 
            -
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 131 | 
            -
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 132 | 
            -
            THE SOFTWARE.
         | 
    
        data/Rakefile
    DELETED
    
    | @@ -1,13 +0,0 @@ | |
| 1 | 
            -
            require "bundler/gem_tasks"
         | 
| 2 | 
            -
            require "rspec/core/rake_task"
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            # For RSpec
         | 
| 5 | 
            -
            RSpec::Core::RakeTask.new(:spec)
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            # For Minitest
         | 
| 8 | 
            -
            require 'rake/testtask'
         | 
| 9 | 
            -
            Rake::TestTask.new(:test) do |task|
         | 
| 10 | 
            -
            	task.pattern = "test/*_test.rb"
         | 
| 11 | 
            -
            end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            task :default => :spec
         | 
    
        data/covered.gemspec
    DELETED
    
    | @@ -1,33 +0,0 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            require_relative "lib/covered/version"
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            Gem::Specification.new do |spec|
         | 
| 5 | 
            -
            	spec.name          = "covered"
         | 
| 6 | 
            -
            	spec.version       = Covered::VERSION
         | 
| 7 | 
            -
            	spec.authors       = ["Samuel Williams"]
         | 
| 8 | 
            -
            	spec.email         = ["samuel.williams@oriontransfer.co.nz"]
         | 
| 9 | 
            -
             | 
| 10 | 
            -
            	spec.summary       = "A modern approach to code coverage."
         | 
| 11 | 
            -
            	spec.homepage      = "https://github.com/ioquatix/covered"
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            	# Specify which files should be added to the gem when it is released.
         | 
| 14 | 
            -
            	spec.files         = Dir.chdir(File.expand_path('..', __FILE__)) do
         | 
| 15 | 
            -
            		`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         | 
| 16 | 
            -
            	end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            	spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         | 
| 19 | 
            -
            	spec.require_paths = ["lib"]
         | 
| 20 | 
            -
            	
         | 
| 21 | 
            -
            	spec.add_dependency "rainbow"
         | 
| 22 | 
            -
            	spec.add_dependency "parser"
         | 
| 23 | 
            -
            	spec.add_dependency "msgpack"
         | 
| 24 | 
            -
            	
         | 
| 25 | 
            -
            	spec.add_dependency "async-rest"
         | 
| 26 | 
            -
            	
         | 
| 27 | 
            -
            	spec.add_development_dependency "trenni", "~> 3.6"
         | 
| 28 | 
            -
            	
         | 
| 29 | 
            -
            	spec.add_development_dependency "bundler"
         | 
| 30 | 
            -
            	spec.add_development_dependency "rake", "~> 10.0"
         | 
| 31 | 
            -
            	spec.add_development_dependency "rspec", "~> 3.6"
         | 
| 32 | 
            -
            	spec.add_development_dependency "minitest"
         | 
| 33 | 
            -
            end
         |