hoc 0.7.1 → 0.7.2
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
- data/.0pdd.yml +5 -0
- data/.pdd +7 -0
- data/.rubocop.yml +6 -1
- data/.rultor.yml +7 -6
- data/.simplecov +2 -2
- data/.travis.yml +1 -1
- data/Gemfile +2 -2
- data/LICENSE.txt +2 -2
- data/README.md +1 -0
- data/Rakefile +11 -3
- data/bin/hoc +4 -4
- data/features/gem_package.feature +1 -1
- data/features/git_basics.feature +3 -3
- data/features/git_excludes.feature +2 -2
- data/features/step_definitions/steps.rb +6 -6
- data/features/support/env.rb +2 -2
- data/hoc.gemspec +7 -7
- data/lib/hoc.rb +6 -6
- data/lib/hoc/git.rb +4 -4
- data/lib/hoc/hits.rb +2 -2
- data/lib/hoc/svn.rb +5 -5
- data/lib/hoc/version.rb +4 -4
- data/test/test__helper.rb +2 -2
- data/test/test_git.rb +14 -14
- data/test/test_hoc.rb +5 -5
- data/test/test_svn.rb +5 -5
- metadata +12 -10
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 91552c539bda6026cb4b4d07a625730ff6c95d6a
         | 
| 4 | 
            +
              data.tar.gz: f98220d1298b938cd96a4c8af33846375cf97a47
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d4bf9db824c0c8bb1f73b83c67587e09bb1dba5dc4a8ccdcf70062eea937089b100f375b0a2f244d53e9b292c3529b6ac36d3184ac6279f43e66d0e41cb70f6a
         | 
| 7 | 
            +
              data.tar.gz: d12c915fe8f2cd2e744651ce891343f2be3e84eacd9afe5c8c6056153945e94abdb6bf6b880d0c074e1f7a1d2cbb7aca4fba896ce2c27645f5e9256f6fa85f5d
         | 
    
        data/.0pdd.yml
    ADDED
    
    
    
        data/.pdd
    ADDED
    
    
    
        data/.rubocop.yml
    CHANGED
    
    
    
        data/.rultor.yml
    CHANGED
    
    | @@ -1,7 +1,6 @@ | |
| 1 1 | 
             
            assets:
         | 
| 2 | 
            -
              rubygems.yml:  | 
| 3 | 
            -
              s3cfg:  | 
| 4 | 
            -
             | 
| 2 | 
            +
              rubygems.yml: zerocracy/home#assets/rubygems.yml
         | 
| 3 | 
            +
              s3cfg: zerocracy/home#assets/s3cfg
         | 
| 5 4 | 
             
            install: |
         | 
| 6 5 | 
             
              sudo gem install --no-ri --no-rdoc pdd
         | 
| 7 6 | 
             
              sudo apt-get install -y subversion diffstat
         | 
| @@ -10,9 +9,13 @@ install: | | |
| 10 9 | 
             
              sudo apt-get update
         | 
| 11 10 | 
             
              sudo apt-get remove -y git
         | 
| 12 11 | 
             
              sudo apt-get install -y git
         | 
| 13 | 
            -
             | 
| 12 | 
            +
            deploy:
         | 
| 13 | 
            +
              script: |
         | 
| 14 | 
            +
                sudo bundle install
         | 
| 15 | 
            +
                rake
         | 
| 14 16 | 
             
            release:
         | 
| 15 17 | 
             
              script: |
         | 
| 18 | 
            +
                pdd --verbose --file=/dev/null
         | 
| 16 19 | 
             
                sudo bundle install
         | 
| 17 20 | 
             
                rake
         | 
| 18 21 | 
             
                rm -rf *.gem
         | 
| @@ -21,5 +24,3 @@ release: | |
| 21 24 | 
             
                gem build hoc.gemspec
         | 
| 22 25 | 
             
                chmod 0600 ../rubygems.yml
         | 
| 23 26 | 
             
                gem push *.gem --config-file ../rubygems.yml
         | 
| 24 | 
            -
                pdd --source=$(pwd) --verbose --file=hoc.xml
         | 
| 25 | 
            -
                s3cmd --no-progress put hoc.xml --config=../s3cfg s3://pdd.teamed.io/hoc.xml
         | 
    
        data/.simplecov
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/Gemfile
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
    
        data/LICENSE.txt
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            (The MIT License)
         | 
| 2 2 |  | 
| 3 | 
            -
            Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 |  | 
| 6 6 | 
             
            Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            of this software and associated documentation files (the 'Software'), to deal
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,5 +1,6 @@ | |
| 1 1 | 
             
            [](http://www.teamed.io)
         | 
| 2 2 | 
             
            [](http://www.rultor.com/p/teamed/hoc)
         | 
| 3 | 
            +
            [](https://www.jetbrains.com/ruby/)
         | 
| 3 4 |  | 
| 4 5 | 
             
            [](https://travis-ci.org/teamed/hoc)
         | 
| 5 6 | 
             
            [](https://ci.appveyor.com/project/yegor256/hoc)
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
| @@ -33,7 +33,7 @@ def version | |
| 33 33 | 
             
              Gem::Specification.load(Dir['*.gemspec'].first).version
         | 
| 34 34 | 
             
            end
         | 
| 35 35 |  | 
| 36 | 
            -
            task default: [:clean, :test, :features, :rubocop]
         | 
| 36 | 
            +
            task default: [:clean, :test, :features, :rubocop, :copyright]
         | 
| 37 37 |  | 
| 38 38 | 
             
            task :clean do
         | 
| 39 39 | 
             
              rm_rf 'coverage'
         | 
| @@ -71,3 +71,11 @@ end | |
| 71 71 | 
             
            Cucumber::Rake::Task.new(:'features:html') do |t|
         | 
| 72 72 | 
             
              t.profile = 'html_report'
         | 
| 73 73 | 
             
            end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            task :copyright do
         | 
| 76 | 
            +
              sh "grep -q -r '2014-#{Date.today.strftime('%Y')}' \
         | 
| 77 | 
            +
                --include '*.rb' \
         | 
| 78 | 
            +
                --include '*.txt' \
         | 
| 79 | 
            +
                --include 'Rakefile' \
         | 
| 80 | 
            +
                ."
         | 
| 81 | 
            +
            end
         | 
    
        data/bin/hoc
    CHANGED
    
    | @@ -1,8 +1,8 @@ | |
| 1 1 | 
             
            #!/usr/bin/env ruby
         | 
| 2 2 | 
             
            # encoding: utf-8
         | 
| 3 3 | 
             
            #
         | 
| 4 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 5 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 5 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 6 6 | 
             
            #
         | 
| 7 7 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 8 8 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
| @@ -29,8 +29,8 @@ require 'slop' | |
| 29 29 | 
             
            require 'hoc/version'
         | 
| 30 30 |  | 
| 31 31 | 
             
            args = []
         | 
| 32 | 
            -
            args. | 
| 33 | 
            -
            args. | 
| 32 | 
            +
            args.concat(File.read('.hoc').split(/\s+/).map(&:strip)) if File.exist?('.hoc')
         | 
| 33 | 
            +
            args.concat(ARGV)
         | 
| 34 34 |  | 
| 35 35 | 
             
            opts = Slop.parse(args, strict: true, help: true) do
         | 
| 36 36 | 
             
              banner "Usage (#{HOC::VERSION}): hoc [options]"
         | 
    
        data/features/git_basics.feature
    CHANGED
    
    | @@ -6,12 +6,12 @@ Feature: Git repo processing | |
| 6 6 | 
             
                Given It is Unix
         | 
| 7 7 | 
             
                Given I run bash:
         | 
| 8 8 | 
             
                  """
         | 
| 9 | 
            -
                  git init .
         | 
| 9 | 
            +
                  git init --quiet .
         | 
| 10 10 | 
             
                  git config user.email test@teamed.io
         | 
| 11 11 | 
             
                  git config user.name test
         | 
| 12 12 | 
             
                  echo 'hello, world!' > test.txt
         | 
| 13 13 | 
             
                  git add test.txt
         | 
| 14 | 
            -
                  git commit - | 
| 14 | 
            +
                  git commit -qam test
         | 
| 15 15 | 
             
                  """
         | 
| 16 16 | 
             
                When I run bin/hoc with "-f int"
         | 
| 17 17 | 
             
                Then Exit code is zero
         | 
| @@ -20,7 +20,7 @@ Feature: Git repo processing | |
| 20 20 | 
             
              Scenario: Real git repo
         | 
| 21 21 | 
             
                Given I run bash:
         | 
| 22 22 | 
             
                  """
         | 
| 23 | 
            -
                  git clone https://github.com/teamed/hoc.git hoc-repo
         | 
| 23 | 
            +
                  git clone --quiet https://github.com/teamed/hoc.git hoc-repo
         | 
| 24 24 | 
             
                  """
         | 
| 25 25 | 
             
                When I run bin/hoc with "-f int -d hoc-repo"
         | 
| 26 26 | 
             
                Then Exit code is zero
         | 
| @@ -6,14 +6,14 @@ Feature: Exclude dirs from Git counting | |
| 6 6 | 
             
                Given It is Unix
         | 
| 7 7 | 
             
                Given I run bash:
         | 
| 8 8 | 
             
                  """
         | 
| 9 | 
            -
                  git init .
         | 
| 9 | 
            +
                  git init --quiet .
         | 
| 10 10 | 
             
                  git config user.email test@teamed.io
         | 
| 11 11 | 
             
                  git config user.name test
         | 
| 12 12 | 
             
                  mkdir x
         | 
| 13 13 | 
             
                  echo 'hello, world!' > x/invalid.txt
         | 
| 14 14 | 
             
                  echo 'hello, world!' > valid.txt
         | 
| 15 15 | 
             
                  git add .
         | 
| 16 | 
            -
                  git commit - | 
| 16 | 
            +
                  git commit -qam test
         | 
| 17 17 | 
             
                  """
         | 
| 18 18 | 
             
                When I run bin/hoc with "-e x/** -e a.txt"
         | 
| 19 19 | 
             
                Then Exit code is zero
         | 
| @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
| @@ -51,10 +51,10 @@ Given(/^I run bash:$/) do |script| | |
| 51 51 | 
             
              cmd = script.split("\n").join(' && ')
         | 
| 52 52 | 
             
              @stdout = `#{cmd}`
         | 
| 53 53 | 
             
              @exitstatus = $CHILD_STATUS.exitstatus
         | 
| 54 | 
            -
               | 
| 54 | 
            +
              raise 'non-zero exit code' unless @exitstatus == 0
         | 
| 55 55 | 
             
            end
         | 
| 56 56 |  | 
| 57 | 
            -
            When( | 
| 57 | 
            +
            When(%r{^I run bin/hoc with "([^"]*)"$}) do |arg|
         | 
| 58 58 | 
             
              home = File.join(File.dirname(__FILE__), '../..')
         | 
| 59 59 | 
             
              @stdout = `ruby -I#{home}/lib #{home}/bin/hoc #{arg}`
         | 
| 60 60 | 
             
              @exitstatus = $CHILD_STATUS.exitstatus
         | 
| @@ -62,12 +62,12 @@ end | |
| 62 62 |  | 
| 63 63 | 
             
            Then(/^Stdout contains "([^"]*)"$/) do |txt|
         | 
| 64 64 | 
             
              unless @stdout.include?(txt)
         | 
| 65 | 
            -
                 | 
| 65 | 
            +
                raise "STDOUT doesn't contain '#{txt}':\n\n--------\n#{@stdout}\n--------\n"
         | 
| 66 66 | 
             
              end
         | 
| 67 67 | 
             
            end
         | 
| 68 68 |  | 
| 69 69 | 
             
            Then(/^Exit code is zero$/) do
         | 
| 70 | 
            -
               | 
| 70 | 
            +
              raise "Non-zero exit code #{@exitstatus}" unless @exitstatus == 0
         | 
| 71 71 | 
             
            end
         | 
| 72 72 |  | 
| 73 73 | 
             
            Given(/^I have a "([^"]*)" file with content:$/) do |file, text|
         | 
    
        data/features/support/env.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
    
        data/hoc.gemspec
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
| @@ -41,17 +41,17 @@ Gem::Specification.new do |s| | |
| 41 41 | 
             
              s.email = 'yegor@teamed.io'
         | 
| 42 42 | 
             
              s.homepage = 'http://github.com/teamed/hoc'
         | 
| 43 43 | 
             
              s.files = `git ls-files`.split($RS)
         | 
| 44 | 
            -
              s.executables = s.files.grep( | 
| 45 | 
            -
              s.test_files = s.files.grep( | 
| 44 | 
            +
              s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
         | 
| 45 | 
            +
              s.test_files = s.files.grep(%r{^(test|spec|features)/})
         | 
| 46 46 | 
             
              s.rdoc_options = ['--charset=UTF-8']
         | 
| 47 47 | 
             
              s.extra_rdoc_files = %w(README.md LICENSE.txt)
         | 
| 48 48 | 
             
              s.add_runtime_dependency 'slop', '3.6.0'
         | 
| 49 | 
            -
              s. | 
| 49 | 
            +
              s.add_development_dependency 'rake', '12.0.0'
         | 
| 50 50 | 
             
              s.add_development_dependency 'coveralls', '0.7'
         | 
| 51 51 | 
             
              s.add_development_dependency 'rdoc', '3.11'
         | 
| 52 52 | 
             
              s.add_development_dependency 'cucumber', '1.3.11'
         | 
| 53 53 | 
             
              s.add_development_dependency 'minitest', '5.4'
         | 
| 54 | 
            -
              s.add_development_dependency 'rubocop', '0. | 
| 55 | 
            -
              s.add_development_dependency 'rubocop-rspec', '1.1'
         | 
| 54 | 
            +
              s.add_development_dependency 'rubocop', '0.41.2'
         | 
| 55 | 
            +
              s.add_development_dependency 'rubocop-rspec', '1.5.1'
         | 
| 56 56 | 
             
              s.add_development_dependency 'rspec-rails', '2.13'
         | 
| 57 57 | 
             
            end
         | 
    
        data/lib/hoc.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
| @@ -26,7 +26,7 @@ require 'hoc/svn' | |
| 26 26 |  | 
| 27 27 | 
             
            # HOC main module.
         | 
| 28 28 | 
             
            # Author:: Yegor Bugayenko (yegor@teamed.io)
         | 
| 29 | 
            -
            # Copyright:: Copyright (c) 2014 Yegor Bugayenko
         | 
| 29 | 
            +
            # Copyright:: Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 30 30 | 
             
            # License:: MIT
         | 
| 31 31 | 
             
            module HOC
         | 
| 32 32 | 
             
              # Code base abstraction
         | 
| @@ -35,7 +35,7 @@ module HOC | |
| 35 35 | 
             
                # +opts+:: Options
         | 
| 36 36 | 
             
                def initialize(opts)
         | 
| 37 37 | 
             
                  @dir = opts[:dir]
         | 
| 38 | 
            -
                   | 
| 38 | 
            +
                  raise 'only "int" format is supported now' unless
         | 
| 39 39 | 
             
                    opts[:format].nil? || opts[:format] == 'int'
         | 
| 40 40 | 
             
                  @exclude = opts[:exclude].nil? ? [] : opts[:exclude]
         | 
| 41 41 | 
             
                end
         | 
| @@ -48,9 +48,9 @@ module HOC | |
| 48 48 | 
             
                  elsif File.exist?(File.join(@dir, '.svn'))
         | 
| 49 49 | 
             
                    repo = Svn.new(@dir)
         | 
| 50 50 | 
             
                  else
         | 
| 51 | 
            -
                     | 
| 51 | 
            +
                    raise 'only Git repositories supported now'
         | 
| 52 52 | 
             
                  end
         | 
| 53 | 
            -
                  repo.hits.map | 
| 53 | 
            +
                  repo.hits.map(&:total).inject(:+)
         | 
| 54 54 | 
             
                end
         | 
| 55 55 | 
             
              end
         | 
| 56 56 | 
             
            end
         | 
    
        data/lib/hoc/git.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
| @@ -34,7 +34,7 @@ module HOC | |
| 34 34 |  | 
| 35 35 | 
             
                def hits
         | 
| 36 36 | 
             
                  version = `git --version`.split(/ /)[2]
         | 
| 37 | 
            -
                   | 
| 37 | 
            +
                  raise "git version #{version} is too old, upgrade it to 2.0+" unless
         | 
| 38 38 | 
             
                    Gem::Version.new(version) >= Gem::Version.new('2.0')
         | 
| 39 39 | 
             
                  cmd = [
         | 
| 40 40 | 
             
                    "cd #{@dir} && git",
         | 
| @@ -49,7 +49,7 @@ module HOC | |
| 49 49 | 
             
                    Hits.new(
         | 
| 50 50 | 
             
                      Time.now,
         | 
| 51 51 | 
             
                      `#{cmd}`.split(/\n/).delete_if(&:empty?).map do |t|
         | 
| 52 | 
            -
                        t.split(/\t/).take(2).map | 
| 52 | 
            +
                        t.split(/\t/).take(2).map(&:to_i).inject(:+)
         | 
| 53 53 | 
             
                      end.inject(:+) || 0
         | 
| 54 54 | 
             
                    )
         | 
| 55 55 | 
             
                  ]
         | 
    
        data/lib/hoc/hits.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
    
        data/lib/hoc/svn.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
| @@ -33,16 +33,16 @@ module HOC | |
| 33 33 |  | 
| 34 34 | 
             
                def hits
         | 
| 35 35 | 
             
                  version = `svn --non-interactive --version --quiet`
         | 
| 36 | 
            -
                   | 
| 36 | 
            +
                  raise "svn version #{version} is too old, upgrade it to 1.7+" unless
         | 
| 37 37 | 
             
                    Gem::Version.new(version) >= Gem::Version.new('1.7')
         | 
| 38 | 
            -
                   | 
| 38 | 
            +
                  raise 'diffstat is not installed' if
         | 
| 39 39 | 
             
                    `diffstat -V`.index('version').nil?
         | 
| 40 40 | 
             
                  log = `cd #{@dir} && svn log --diff | diffstat`
         | 
| 41 41 | 
             
                  [
         | 
| 42 42 | 
             
                    Hits.new(
         | 
| 43 43 | 
             
                      Time.now,
         | 
| 44 44 | 
             
                      log.split(/\n/).last.split(/[^\d]/)
         | 
| 45 | 
            -
                        .map | 
| 45 | 
            +
                        .map(&:to_i).select { |x| x > 0 }
         | 
| 46 46 | 
             
                        .drop(1).inject(:+)
         | 
| 47 47 | 
             
                    )
         | 
| 48 48 | 
             
                  ]
         | 
    
        data/lib/hoc/version.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
| @@ -23,8 +23,8 @@ | |
| 23 23 |  | 
| 24 24 | 
             
            # HOC main module.
         | 
| 25 25 | 
             
            # Author:: Yegor Bugayenko (yegor@teamed.io)
         | 
| 26 | 
            -
            # Copyright:: Copyright (c) 2014 Yegor Bugayenko
         | 
| 26 | 
            +
            # Copyright:: Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 27 27 | 
             
            # License:: MIT
         | 
| 28 28 | 
             
            module HOC
         | 
| 29 | 
            -
              VERSION = '0.7. | 
| 29 | 
            +
              VERSION = '0.7.2'.freeze
         | 
| 30 30 | 
             
            end
         | 
    
        data/test/test__helper.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
    
        data/test/test_git.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
| @@ -27,25 +27,25 @@ require 'tmpdir' | |
| 27 27 |  | 
| 28 28 | 
             
            # Git test.
         | 
| 29 29 | 
             
            # Author:: Yegor Bugayenko (yegor@teamed.io)
         | 
| 30 | 
            -
            # Copyright:: Copyright (c) 2014 Yegor Bugayenko
         | 
| 30 | 
            +
            # Copyright:: Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 31 31 | 
             
            # License:: MIT
         | 
| 32 32 | 
             
            class TestGit < Minitest::Test
         | 
| 33 33 | 
             
              def test_parsing
         | 
| 34 34 | 
             
                skip if Gem.win_platform?
         | 
| 35 35 | 
             
                Dir.mktmpdir 'test' do |dir|
         | 
| 36 | 
            -
                   | 
| 36 | 
            +
                  raise unless system("
         | 
| 37 37 | 
             
                    set -e
         | 
| 38 38 | 
             
                    cd '#{dir}'
         | 
| 39 | 
            -
                    git init .
         | 
| 39 | 
            +
                    git init --quiet .
         | 
| 40 40 | 
             
                    git config user.email test@teamed.io
         | 
| 41 41 | 
             
                    git config user.name test
         | 
| 42 42 | 
             
                    echo 'hello, world!' > test.txt
         | 
| 43 43 | 
             
                    git add test.txt
         | 
| 44 | 
            -
                    git commit - | 
| 44 | 
            +
                    git commit -qam 'add line'
         | 
| 45 45 | 
             
                    echo 'good bye, world!' > test.txt
         | 
| 46 | 
            -
                    git commit - | 
| 46 | 
            +
                    git commit -qam 'modify line'
         | 
| 47 47 | 
             
                    rm test.txt
         | 
| 48 | 
            -
                    git commit - | 
| 48 | 
            +
                    git commit -qam 'delete line'
         | 
| 49 49 | 
             
                  ")
         | 
| 50 50 | 
             
                  hits = HOC::Git.new(dir, []).hits
         | 
| 51 51 | 
             
                  assert_equal 1, hits.size
         | 
| @@ -56,10 +56,10 @@ class TestGit < Minitest::Test | |
| 56 56 | 
             
              def test_parsing_with_empty_git
         | 
| 57 57 | 
             
                skip if Gem.win_platform?
         | 
| 58 58 | 
             
                Dir.mktmpdir 'test' do |dir|
         | 
| 59 | 
            -
                   | 
| 59 | 
            +
                  raise unless system("
         | 
| 60 60 | 
             
                    set -e
         | 
| 61 61 | 
             
                    cd '#{dir}'
         | 
| 62 | 
            -
                    git init .
         | 
| 62 | 
            +
                    git init --quiet .
         | 
| 63 63 | 
             
                  ")
         | 
| 64 64 | 
             
                  hits = HOC::Git.new(dir, []).hits
         | 
| 65 65 | 
             
                  assert_equal 1, hits.size
         | 
| @@ -70,18 +70,18 @@ class TestGit < Minitest::Test | |
| 70 70 | 
             
              def test_ignores_binary_files
         | 
| 71 71 | 
             
                skip if Gem.win_platform?
         | 
| 72 72 | 
             
                Dir.mktmpdir 'test' do |dir|
         | 
| 73 | 
            -
                   | 
| 73 | 
            +
                  raise unless system("
         | 
| 74 74 | 
             
                    set -e
         | 
| 75 75 | 
             
                    cd '#{dir}'
         | 
| 76 | 
            -
                    git init .
         | 
| 76 | 
            +
                    git init --quiet .
         | 
| 77 77 | 
             
                    git config user.email test@teamed.io
         | 
| 78 78 | 
             
                    git config user.name test
         | 
| 79 79 | 
             
                    dd if=/dev/urandom of=test.dat bs=1 count=65536
         | 
| 80 80 | 
             
                    git add test.dat
         | 
| 81 | 
            -
                    git commit - | 
| 81 | 
            +
                    git commit -qam 'binary file'
         | 
| 82 82 | 
             
                    dd if=/dev/urandom of=test.dat bs=1 count=65536
         | 
| 83 83 | 
             
                    git add test.dat
         | 
| 84 | 
            -
                    git commit - | 
| 84 | 
            +
                    git commit -qam 'binary file modified'
         | 
| 85 85 | 
             
                  ")
         | 
| 86 86 | 
             
                  hits = HOC::Git.new(dir, []).hits
         | 
| 87 87 | 
             
                  assert_equal 1, hits.size
         | 
    
        data/test/test_hoc.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
| @@ -28,13 +28,13 @@ require 'slop' | |
| 28 28 |  | 
| 29 29 | 
             
            # HOC main module test.
         | 
| 30 30 | 
             
            # Author:: Yegor Bugayenko (yegor@teamed.io)
         | 
| 31 | 
            -
            # Copyright:: Copyright (c) 2014 Yegor Bugayenko
         | 
| 31 | 
            +
            # Copyright:: Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 32 32 | 
             
            # License:: MIT
         | 
| 33 33 | 
             
            class TestHOC < Minitest::Test
         | 
| 34 34 | 
             
              def test_basic_git
         | 
| 35 35 | 
             
                skip if Gem.win_platform?
         | 
| 36 36 | 
             
                Dir.mktmpdir 'test' do |dir|
         | 
| 37 | 
            -
                   | 
| 37 | 
            +
                  raise unless system("
         | 
| 38 38 | 
             
                    set -e
         | 
| 39 39 | 
             
                    cd '#{dir}'
         | 
| 40 40 | 
             
                    git init .
         | 
| @@ -51,7 +51,7 @@ class TestHOC < Minitest::Test | |
| 51 51 | 
             
              def test_basic_svn
         | 
| 52 52 | 
             
                skip if Gem.win_platform?
         | 
| 53 53 | 
             
                Dir.mktmpdir 'test' do |dir|
         | 
| 54 | 
            -
                   | 
| 54 | 
            +
                  raise unless system("
         | 
| 55 55 | 
             
                    set -e
         | 
| 56 56 | 
             
                    cd '#{dir}'
         | 
| 57 57 | 
             
                    svnadmin create base
         | 
    
        data/test/test_svn.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Copyright (c) 2014 Teamed.io
         | 
| 4 | 
            -
            # Copyright (c) 2014 Yegor Bugayenko
         | 
| 3 | 
            +
            # Copyright (c) 2014-2017 Teamed.io
         | 
| 4 | 
            +
            # Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 7 7 | 
             
            # of this software and associated documentation files (the 'Software'), to deal
         | 
| @@ -27,13 +27,13 @@ require 'tmpdir' | |
| 27 27 |  | 
| 28 28 | 
             
            # Svn test.
         | 
| 29 29 | 
             
            # Author:: Yegor Bugayenko (yegor@teamed.io)
         | 
| 30 | 
            -
            # Copyright:: Copyright (c) 2014 Yegor Bugayenko
         | 
| 30 | 
            +
            # Copyright:: Copyright (c) 2014-2017 Yegor Bugayenko
         | 
| 31 31 | 
             
            # License:: MIT
         | 
| 32 32 | 
             
            class TestSvn < Minitest::Test
         | 
| 33 33 | 
             
              def test_parsing
         | 
| 34 34 | 
             
                skip if Gem.win_platform?
         | 
| 35 35 | 
             
                Dir.mktmpdir 'test' do |dir|
         | 
| 36 | 
            -
                   | 
| 36 | 
            +
                  raise unless system("
         | 
| 37 37 | 
             
                    set -e
         | 
| 38 38 | 
             
                    cd '#{dir}'
         | 
| 39 39 | 
             
                    svnadmin create base
         | 
| @@ -57,7 +57,7 @@ class TestSvn < Minitest::Test | |
| 57 57 | 
             
              def test_parsing_empty_repo
         | 
| 58 58 | 
             
                skip('fails now')
         | 
| 59 59 | 
             
                Dir.mktmpdir 'test' do |dir|
         | 
| 60 | 
            -
                   | 
| 60 | 
            +
                  raise unless system("
         | 
| 61 61 | 
             
                    set -e
         | 
| 62 62 | 
             
                    cd '#{dir}'
         | 
| 63 63 | 
             
                    svnadmin create base
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: hoc
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.7. | 
| 4 | 
            +
              version: 0.7.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Yegor Bugayenko
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2017-03-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: slop
         | 
| @@ -30,14 +30,14 @@ dependencies: | |
| 30 30 | 
             
                requirements:
         | 
| 31 31 | 
             
                - - '='
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version:  | 
| 34 | 
            -
              type: : | 
| 33 | 
            +
                    version: 12.0.0
         | 
| 34 | 
            +
              type: :development
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 38 | 
             
                - - '='
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version:  | 
| 40 | 
            +
                    version: 12.0.0
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: coveralls
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -100,28 +100,28 @@ dependencies: | |
| 100 100 | 
             
                requirements:
         | 
| 101 101 | 
             
                - - '='
         | 
| 102 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            -
                    version: 0. | 
| 103 | 
            +
                    version: 0.41.2
         | 
| 104 104 | 
             
              type: :development
         | 
| 105 105 | 
             
              prerelease: false
         | 
| 106 106 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 107 | 
             
                requirements:
         | 
| 108 108 | 
             
                - - '='
         | 
| 109 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            -
                    version: 0. | 
| 110 | 
            +
                    version: 0.41.2
         | 
| 111 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 112 112 | 
             
              name: rubocop-rspec
         | 
| 113 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 114 114 | 
             
                requirements:
         | 
| 115 115 | 
             
                - - '='
         | 
| 116 116 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version:  | 
| 117 | 
            +
                    version: 1.5.1
         | 
| 118 118 | 
             
              type: :development
         | 
| 119 119 | 
             
              prerelease: false
         | 
| 120 120 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 121 | 
             
                requirements:
         | 
| 122 122 | 
             
                - - '='
         | 
| 123 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 124 | 
            -
                    version:  | 
| 124 | 
            +
                    version: 1.5.1
         | 
| 125 125 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 126 126 | 
             
              name: rspec-rails
         | 
| 127 127 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -145,8 +145,10 @@ extra_rdoc_files: | |
| 145 145 | 
             
            - README.md
         | 
| 146 146 | 
             
            - LICENSE.txt
         | 
| 147 147 | 
             
            files:
         | 
| 148 | 
            +
            - ".0pdd.yml"
         | 
| 148 149 | 
             
            - ".gitattributes"
         | 
| 149 150 | 
             
            - ".gitignore"
         | 
| 151 | 
            +
            - ".pdd"
         | 
| 150 152 | 
             
            - ".rubocop.yml"
         | 
| 151 153 | 
             
            - ".rultor.yml"
         | 
| 152 154 | 
             
            - ".simplecov"
         | 
| @@ -197,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 197 199 | 
             
                  version: '0'
         | 
| 198 200 | 
             
            requirements: []
         | 
| 199 201 | 
             
            rubyforge_project: 
         | 
| 200 | 
            -
            rubygems_version: 2.4.5. | 
| 202 | 
            +
            rubygems_version: 2.4.5.2
         | 
| 201 203 | 
             
            signing_key: 
         | 
| 202 204 | 
             
            specification_version: 2
         | 
| 203 205 | 
             
            summary: Hits Of Code
         |