pullreview-coverage 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43dbef35aeec4ac67f0b747299bc1bc04efba654
4
- data.tar.gz: 22bbb19335f218f594a243262e3b5be15f538926
3
+ metadata.gz: ef06d79e9efa5c30cfcfa6dd5299e6b5dfec7fea
4
+ data.tar.gz: 1ab33b44a0ccddbc33d48c74c83fef2273f580ed
5
5
  SHA512:
6
- metadata.gz: aab646b40c2f4e49689f9e092f7c17748daf23cb25580a204b3bf8c0811dc366d076b4b77c3dfbe71836f3b189fcc4d3cf7a55c7437c9dc794a8a93d54d3cdbb
7
- data.tar.gz: 03fb513a645b250673185a6b14182c7b2eaf9a8bfcdae47a965e7a597d19e939b1bb57d89cbd8bb2d72386648b6288d82a61afc666a7ad6f4f3f8c847288678f
6
+ metadata.gz: 3ab989b12023f0e613003906a911b627076005710cbc3aadf09796f39124c160ab5fc307016d72ad4bae5d5d0624dc6b89fbc266db6407c8497b31aa5a036247
7
+ data.tar.gz: 061c8ab4aaf6313f9d018d382abb826ad9e41e7b8ecb3698a3d557ab30759248ca74a4cf936ab62d93f89751f8409a0925a25dbeccea06ba305fa1c48a0b2510
data/LICENSE.txt CHANGED
@@ -1,4 +1,7 @@
1
- MIT License
1
+ Original Works
2
+ - Copyright (c) 2013 Code Climate LLC
3
+ - Copyright (c) 2012 Wil Gieseler
4
+ Modified Works Copyright (c) 2014 8th Color SPRL
2
5
 
3
6
  Permission is hereby granted, free of charge, to any person obtaining
4
7
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Pullreview::Coverage
2
2
 
3
+ [![PullReview stats](https://www.pullreview.com/github/8thcolor/pullreview-coverage/badges/master.svg?type=full)](https://www.pullreview.com/github/8thcolor/pullreview-coverage/reviews/master)
4
+
3
5
  TODO: Write a gem description
4
6
 
5
7
  ## Installation
@@ -35,6 +37,13 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[*formatters]
35
37
 
36
38
  ```
37
39
 
40
+ Or if you do not use SimpleCov yet,
41
+
42
+ ```ruby
43
+ require 'pullreview/coverage_reporter'
44
+ PullReview::CoverageReporter.start
45
+ ```
46
+
38
47
  ## How can I check the content submitted to pullreview
39
48
 
40
49
  In your project directory, launch
@@ -49,7 +58,7 @@ A json file will be generated in /tmp/ the content might change a little bit dep
49
58
 
50
59
  ## Contributing
51
60
 
52
- 1. Fork it ( http://github.com/<my-github-username>/pullreview-coverage/fork )
61
+ 1. Fork it ( http://github.com/8thcolor/pullreview-coverage/fork )
53
62
  2. Create your feature branch (`git checkout -b my-new-feature`)
54
63
  3. Commit your changes (`git commit -am 'Add some feature'`)
55
64
  4. Push to the branch (`git push origin my-new-feature`)
data/Rakefile CHANGED
@@ -1 +1,10 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'spec'
6
+ t.test_files = FileList['spec/*/*_spec.rb']
7
+ end
8
+
9
+ desc 'Run tests'
10
+ task default: :test
@@ -39,6 +39,10 @@ module PullReview
39
39
  ENV['PULLREVIEW_REPO_TOKEN']
40
40
  end
41
41
 
42
+ def prefix_filename
43
+ ENV['PULLREVIEW_PREFIX_FILENAME']
44
+ end
45
+
42
46
  def should_run?
43
47
  !!repo_token
44
48
  end
@@ -69,9 +69,14 @@ module PullReview
69
69
  end
70
70
 
71
71
  def short_filename(filename)
72
- return filename unless ::SimpleCov.root
72
+ return prefix(filename) unless ::SimpleCov.root
73
73
  filename = filename.gsub(::SimpleCov.root, '.').gsub(/^\.\//, '')
74
- filename
74
+ prefix(filename)
75
+ end
76
+
77
+ def prefix(filename)
78
+ return filename unless @config.prefix_filename
79
+ "#{config.prefix_filename}/#{filename}"
75
80
  end
76
81
 
77
82
  def round(numeric, precision)
@@ -1,6 +1,6 @@
1
1
  module PullReview
2
2
  module Coverage
3
3
  # gem version
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
6
6
  end
@@ -0,0 +1,11 @@
1
+ require_relative 'coverage'
2
+
3
+ module PullReview
4
+ module CoverageReporter
5
+ def self.start
6
+ require 'simplecov'
7
+ ::SimpleCov.formatter = PullReview::Coverage::Formatter
8
+ ::SimpleCov.start
9
+ end
10
+ end
11
+ end
@@ -21,4 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency 'simplecov', '>= 0.7.1', '< 1.0.0'
22
22
  spec.add_development_dependency 'bundler', '~> 1.5'
23
23
  spec.add_development_dependency 'rake'
24
+ spec.add_development_dependency 'minitest', '4.5.0'
25
+ spec.add_development_dependency 'turn', '~> 0.9'
24
26
  end
@@ -0,0 +1 @@
1
+ require_relative '../spec_helper_lite'
@@ -0,0 +1,20 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe PullReview::Coverage::Config do
4
+
5
+ let(:config) { PullReview::Coverage::Config.new }
6
+
7
+ it 'should have defaults for production' do
8
+ config.api_uri.to_s.must_equal 'https://www.pullreview.com/api/coverage'
9
+ end
10
+
11
+ it 'should allow to overide settings for test purpose via ENV variable' do
12
+ with_env(
13
+ 'PULLREVIEW_HOST' => '127.0.0.1',
14
+ 'PULLREVIEW_PORT' => '3000',
15
+ 'PULLREVIEW_PROTOCOL' => 'http'
16
+ ) do
17
+ config.api_uri.to_s.must_equal 'http://127.0.0.1:3000/api/coverage'
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,24 @@
1
+
2
+ require_relative '../spec_helper'
3
+
4
+ describe PullReview::Coverage::ContinousBuild do
5
+
6
+ it 'should support jenkins' do
7
+ with_env(
8
+ 'BUILD_ID' => '123',
9
+ 'JENKINS_URL' => 'https://jenkins.sample.com',
10
+ 'BUILD_NUMBER' => '123',
11
+ 'BUILD_URL' => 'https://jenkins.sample.com/job/123',
12
+ 'GIT_BRANCH' => 'feature/super',
13
+ 'GIT_COMMIT' => 'sha123456789'
14
+ ) do
15
+ PullReview::Coverage::ContinousBuild.infos.must_equal(
16
+ name: 'jenkins',
17
+ build_id: '123',
18
+ build_url: 'https://jenkins.sample.com/job/123',
19
+ branch: 'feature/super',
20
+ commit_sha: 'sha123456789'
21
+ )
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,15 @@
1
+ # encoding: UTF-8
2
+ gem 'minitest' # demand gem version
3
+ require 'minitest/autorun'
4
+ require 'turn/autorun'
5
+
6
+ $LOAD_PATH << File.expand_path('../lib', File.dirname(__FILE__))
7
+ require_relative '../lib/pullreview/coverage.rb'
8
+
9
+ def with_env(options, &block)
10
+ backup = ENV.to_h
11
+ ENV.update(options)
12
+ yield
13
+ ensure
14
+ ENV.update(backup)
15
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pullreview-coverage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephan Mestach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-14 00:00:00.000000000 Z
11
+ date: 2014-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov
@@ -58,6 +58,34 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: minitest
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '='
66
+ - !ruby/object:Gem::Version
67
+ version: 4.5.0
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '='
73
+ - !ruby/object:Gem::Version
74
+ version: 4.5.0
75
+ - !ruby/object:Gem::Dependency
76
+ name: turn
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.9'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0.9'
61
89
  description: Collect coverage information generated by simplecov and send them to
62
90
  PullReview.com
63
91
  email:
@@ -78,7 +106,12 @@ files:
78
106
  - lib/pullreview/coverage/formatter.rb
79
107
  - lib/pullreview/coverage/git.rb
80
108
  - lib/pullreview/coverage/version.rb
109
+ - lib/pullreview/coverage_reporter.rb
81
110
  - pullreview-coverage.gemspec
111
+ - spec/config_spec.rb
112
+ - spec/coverage/config_spec.rb
113
+ - spec/coverage/continous_build_spec.rb
114
+ - spec/spec_helper.rb
82
115
  homepage: https://www.pullreview.com
83
116
  licenses:
84
117
  - MIT
@@ -103,4 +136,9 @@ rubygems_version: 2.2.2
103
136
  signing_key:
104
137
  specification_version: 4
105
138
  summary: Collect coverage information and send them to PullReview.com
106
- test_files: []
139
+ test_files:
140
+ - spec/config_spec.rb
141
+ - spec/coverage/config_spec.rb
142
+ - spec/coverage/continous_build_spec.rb
143
+ - spec/spec_helper.rb
144
+ has_rdoc: