simplecov-shield-json 0.0.1 → 0.0.4
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/.circleci/config.yml +71 -0
- data/.gem_release.yml +2 -0
- data/.gitignore +7 -0
- data/.rspec +1 -0
- data/.rubocop.yml +6 -0
- data/Gemfile +6 -0
- data/LICENSE +20 -0
- data/README.md +47 -0
- data/Rakefile +25 -0
- data/lib/{simplecov_shield_json.rb → simplecov-shield-json.rb} +2 -2
- data/lib/simplecov-shield-json/version.rb +9 -0
- data/simplecov-shield-json.gemspec +31 -0
- data/spec/lib/simplecov_shield_json_spec.rb +10 -0
- data/spec/spec_helper.rb +116 -0
- metadata +25 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 796a75ee0d2292e2e200a694898a5edd09b900a238f915b9941239f82c2edb7a
|
4
|
+
data.tar.gz: 3940fe73c0fad0cc638bbd93e09fabbc5c5eaa032bcf24e1dd554795ea4344f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa3615c10376c1f48d6f56657716a383660e77dea6ac848b79a759eb3356050361ad0c3928220538253ca1dd3cf9a208fc1c9a5fd9eb96e640248ec35bc4c2e4
|
7
|
+
data.tar.gz: 4baffa4cb8e0657ad603fda714a77182620aa01ac1e81890ee4b0c0cbce836fe215022549c84ca674962a51a52865a66e317798bde7c7bf9bd6be4f3f9bceb70
|
@@ -0,0 +1,71 @@
|
|
1
|
+
version: 2.1
|
2
|
+
workflows:
|
3
|
+
test-workflow:
|
4
|
+
jobs:
|
5
|
+
- build:
|
6
|
+
context: EdgePetrolApp
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
docker:
|
10
|
+
- image: circleci/ruby:2.7.1
|
11
|
+
environment:
|
12
|
+
RUBYOPT: '-W0 -KU -E utf-8:utf-8'
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- checkout
|
16
|
+
- run:
|
17
|
+
name: Install Cmake
|
18
|
+
command: sudo apt-get install cmake
|
19
|
+
- restore_cache:
|
20
|
+
keys:
|
21
|
+
- edge-bundle-{{ checksum "Gemfile.lock" }}
|
22
|
+
- edge-bundle-
|
23
|
+
- run:
|
24
|
+
name: Bundle Check or Install
|
25
|
+
command: bundle check --path vendor/bundle || bundle install --jobs=4 --retry=3 --path vendor/bundle
|
26
|
+
- save_cache:
|
27
|
+
key: edge-bundle-{{ checksum "Gemfile.lock" }}
|
28
|
+
paths:
|
29
|
+
- vendor/bundle
|
30
|
+
- run:
|
31
|
+
name: Execute Rspec Tests
|
32
|
+
command: |
|
33
|
+
mkdir -p /tmp/coverage
|
34
|
+
bundle exec rspec
|
35
|
+
- run:
|
36
|
+
name: Store coverage report
|
37
|
+
command: |
|
38
|
+
mv coverage/coverage.json /tmp/coverage/
|
39
|
+
mv coverage/shield-coverage.json /tmp/coverage/
|
40
|
+
- persist_to_workspace:
|
41
|
+
root: /tmp/coverage
|
42
|
+
paths: .
|
43
|
+
- store_artifacts:
|
44
|
+
path: /tmp/coverage
|
45
|
+
destination: coverage
|
46
|
+
- run:
|
47
|
+
name: Upload coverage to be persistent
|
48
|
+
command: |
|
49
|
+
mkdir -p /tmp/internal
|
50
|
+
cd /tmp/internal
|
51
|
+
git config --global user.email "bot@edgepetrol.com"
|
52
|
+
git config --global user.name "EdgeBot"
|
53
|
+
git clone https://EdgePetrolBot:${DANGER_GITHUB_API_TOKEN}@github.com/EdgePetrol/coverage.git
|
54
|
+
cd coverage
|
55
|
+
mkdir -p ${CIRCLE_PROJECT_REPONAME}/${CIRCLE_BRANCH}
|
56
|
+
mv /tmp/coverage/* /tmp/internal/coverage/${CIRCLE_PROJECT_REPONAME}/${CIRCLE_BRANCH}
|
57
|
+
git add . && git commit -m "Add ${CIRCLE_PROJECT_REPONAME} coverage"
|
58
|
+
git push --set-upstream origin master
|
59
|
+
- run:
|
60
|
+
name: Run gem build and push
|
61
|
+
command: |-
|
62
|
+
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
63
|
+
git config --global user.email "bot@edgepetrol.com"
|
64
|
+
git config --global user.name "EdgeBot"
|
65
|
+
gem install gem-release --no-document
|
66
|
+
gem bump --skip-ci
|
67
|
+
git remote set-url --push origin https://EdgePetrolBot:${DANGER_GITHUB_API_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git
|
68
|
+
git push --set-upstream origin ${CIRCLE_BRANCH}
|
69
|
+
GEM_VERSION=$(gem build | awk '/File/ {print $2}')
|
70
|
+
curl -X POST https://rubygems.org/api/v1/gems -H "Authorization:${RUBY_GEMS_API_TOKEN}" -H "Content-Type: application/gem" --data-binary "@${GEM_VERSION}"
|
71
|
+
fi
|
data/.gem_release.yml
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Vicent Llongo Silla
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
[](https://app.circleci.com/pipelines/github/EdgePetrol/simplecov-shield-json)
|
2
|
+

|
3
|
+
|
4
|
+
# simplecov-shield-json
|
5
|
+
|
6
|
+
Shield JSON formatter for the ruby 1.9+ code coverage gem SimpleCov
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
1. Add simplecov-shield-json to your `Gemfile` and `bundle install`:
|
11
|
+
|
12
|
+
gem 'simplecov-shield-json', require: false
|
13
|
+
|
14
|
+
2. Require simplecov-shield-json and set it up as SimpleCov's formatter:
|
15
|
+
|
16
|
+
require 'simplecov-shield-json'
|
17
|
+
SimpleCov.formatter = SimpleCov::Formatter::ShieldJSONFormatter
|
18
|
+
|
19
|
+
## Result
|
20
|
+
|
21
|
+
Generated JSON can be found in coverage/shield-coverage.json
|
22
|
+
|
23
|
+
The format you can expect is:
|
24
|
+
```
|
25
|
+
{
|
26
|
+
"schemaVersion": 1,
|
27
|
+
"label": "Coverage",
|
28
|
+
"message": "99.9%",
|
29
|
+
"color": "green",
|
30
|
+
"cacheSeconds": 1800
|
31
|
+
}
|
32
|
+
```
|
33
|
+
|
34
|
+
## Making Contributions
|
35
|
+
|
36
|
+
If you want to contribute, please:
|
37
|
+
|
38
|
+
* Fork the project.
|
39
|
+
* Make your feature addition or bug fix.
|
40
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
41
|
+
* Send me a pull request on Github.
|
42
|
+
* Check that travis build passes for your pull request.
|
43
|
+
|
44
|
+
|
45
|
+
## Copyright
|
46
|
+
|
47
|
+
Copyright (c) 2020 Vicent Llongo. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'rubocop/rake_task'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:specs)
|
8
|
+
|
9
|
+
task default: :specs
|
10
|
+
|
11
|
+
task :spec do
|
12
|
+
Rake::Task['specs'].invoke
|
13
|
+
Rake::Task['rubocop'].invoke
|
14
|
+
Rake::Task['spec_docs'].invoke
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Run RuboCop on the lib/specs directory'
|
18
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
19
|
+
task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Ensure that the plugin passes `danger plugins lint`'
|
23
|
+
task :spec_docs do
|
24
|
+
sh 'bundle exec danger plugins lint'
|
25
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'simplecov'
|
4
4
|
require 'json'
|
5
|
-
|
5
|
+
require_relative 'simplecov-shield-json/version'
|
6
6
|
|
7
7
|
module SimpleCov
|
8
8
|
module Formatter
|
@@ -54,7 +54,7 @@ module SimpleCov
|
|
54
54
|
{
|
55
55
|
schemaVersion: 1,
|
56
56
|
label: 'Coverage',
|
57
|
-
message: result.covered_percent.
|
57
|
+
message: "#{result.covered_percent.round(2)}%",
|
58
58
|
color: color(result.covered_percent),
|
59
59
|
cacheSeconds: 1800
|
60
60
|
}.to_json
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
require 'simplecov-shield-json/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'simplecov-shield-json'
|
8
|
+
s.version = SimpleCov::Formatter::ShieldJSONFormatter::VERSION
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.authors = ['Guilherme Pereira']
|
11
|
+
s.email = ['guilherme.pereira@edgepetrol.com']
|
12
|
+
s.homepage = 'https://github.com/EdgePetrol/simplecov-shield-json'
|
13
|
+
s.license = 'MIT'
|
14
|
+
s.summary = %({Shield JSON formatter for SimpleCov})
|
15
|
+
s.description = %({Shield JSON formatter for SimpleCov code coverage tool for ruby 1.9+})
|
16
|
+
s.required_ruby_version = '>= 2.4.0'
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
20
|
+
s.require_paths = ['lib']
|
21
|
+
|
22
|
+
s.add_dependency 'json'
|
23
|
+
s.add_dependency 'simplecov'
|
24
|
+
|
25
|
+
s.add_development_dependency 'bundler', '~> 2.1'
|
26
|
+
s.add_development_dependency 'rake'
|
27
|
+
s.add_development_dependency 'rspec', '~> 3.4'
|
28
|
+
s.add_development_dependency 'rubocop', '~> 0.85.1'
|
29
|
+
s.add_development_dependency 'simplecov'
|
30
|
+
s.add_development_dependency 'simplecov-json'
|
31
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path('../../lib/simplecov-shield-json', __dir__)
|
4
|
+
require File.expand_path('../spec_helper', __dir__)
|
5
|
+
|
6
|
+
describe SimpleCov::Formatter::ShieldJSONFormatter do
|
7
|
+
it 'should be a class' do
|
8
|
+
expect(described_class.new).to be_a SimpleCov::Formatter::ShieldJSONFormatter
|
9
|
+
end
|
10
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
16
|
+
require 'rspec'
|
17
|
+
require 'simplecov'
|
18
|
+
require 'simplecov-json'
|
19
|
+
|
20
|
+
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
|
21
|
+
[
|
22
|
+
SimpleCov::Formatter::HTMLFormatter,
|
23
|
+
SimpleCov::Formatter::JSONFormatter,
|
24
|
+
SimpleCov::Formatter::ShieldJSONFormatter
|
25
|
+
]
|
26
|
+
)
|
27
|
+
|
28
|
+
SimpleCov.start do
|
29
|
+
add_filter 'spec'
|
30
|
+
end
|
31
|
+
|
32
|
+
RSpec.configure do |config|
|
33
|
+
# rspec-expectations config goes here. You can use an alternate
|
34
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
35
|
+
# assertions if you prefer.
|
36
|
+
config.expect_with :rspec do |expectations|
|
37
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
38
|
+
# and `failure_message` of custom matchers include text for helper methods
|
39
|
+
# defined using `chain`, e.g.:
|
40
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
41
|
+
# # => "be bigger than 2 and smaller than 4"
|
42
|
+
# ...rather than:
|
43
|
+
# # => "be bigger than 2"
|
44
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
45
|
+
end
|
46
|
+
|
47
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
48
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
49
|
+
config.mock_with :rspec do |mocks|
|
50
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
51
|
+
# a real object. This is generally recommended, and will default to
|
52
|
+
# `true` in RSpec 4.
|
53
|
+
mocks.verify_partial_doubles = true
|
54
|
+
end
|
55
|
+
|
56
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
57
|
+
# have no way to turn it off -- the option exists only for backwards
|
58
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
59
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
60
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
61
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
62
|
+
|
63
|
+
# The settings below are suggested to provide a good initial experience
|
64
|
+
# with RSpec, but feel free to customize to your heart's content.
|
65
|
+
=begin
|
66
|
+
# This allows you to limit a spec run to individual examples or groups
|
67
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
68
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
69
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
70
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
71
|
+
config.filter_run_when_matching :focus
|
72
|
+
|
73
|
+
# Allows RSpec to persist some state between runs in order to support
|
74
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
75
|
+
# you configure your source control system to ignore this file.
|
76
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
77
|
+
|
78
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
79
|
+
# recommended. For more details, see:
|
80
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
81
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
82
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
83
|
+
config.disable_monkey_patching!
|
84
|
+
|
85
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
86
|
+
# be too noisy due to issues in dependencies.
|
87
|
+
config.warnings = true
|
88
|
+
|
89
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
90
|
+
# file, and it's useful to allow more verbose output when running an
|
91
|
+
# individual spec file.
|
92
|
+
if config.files_to_run.one?
|
93
|
+
# Use the documentation formatter for detailed output,
|
94
|
+
# unless a formatter has already been configured
|
95
|
+
# (e.g. via a command-line flag).
|
96
|
+
config.default_formatter = "doc"
|
97
|
+
end
|
98
|
+
|
99
|
+
# Print the 10 slowest examples and example groups at the
|
100
|
+
# end of the spec run, to help surface which specs are running
|
101
|
+
# particularly slow.
|
102
|
+
config.profile_examples = 10
|
103
|
+
|
104
|
+
# Run specs in random order to surface order dependencies. If you find an
|
105
|
+
# order dependency and want to debug it, you can fix the order by providing
|
106
|
+
# the seed, which is printed after each run.
|
107
|
+
# --seed 1234
|
108
|
+
config.order = :random
|
109
|
+
|
110
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
111
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
112
|
+
# test failures related to randomization by passing the same `--seed` value
|
113
|
+
# as the one that triggered the failure.
|
114
|
+
Kernel.srand config.seed
|
115
|
+
=end
|
116
|
+
end
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov-shield-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Pereira
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-09-08 00:00:00.000000000 Z
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.85.1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 0.85.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: simplecov
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,12 +129,25 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
-
-
|
132
|
+
- ".circleci/config.yml"
|
133
|
+
- ".gem_release.yml"
|
134
|
+
- ".gitignore"
|
135
|
+
- ".rspec"
|
136
|
+
- ".rubocop.yml"
|
137
|
+
- Gemfile
|
138
|
+
- LICENSE
|
139
|
+
- README.md
|
140
|
+
- Rakefile
|
141
|
+
- lib/simplecov-shield-json.rb
|
142
|
+
- lib/simplecov-shield-json/version.rb
|
143
|
+
- simplecov-shield-json.gemspec
|
144
|
+
- spec/lib/simplecov_shield_json_spec.rb
|
145
|
+
- spec/spec_helper.rb
|
133
146
|
homepage: https://github.com/EdgePetrol/simplecov-shield-json
|
134
147
|
licenses:
|
135
148
|
- MIT
|
136
149
|
metadata: {}
|
137
|
-
post_install_message:
|
150
|
+
post_install_message:
|
138
151
|
rdoc_options: []
|
139
152
|
require_paths:
|
140
153
|
- lib
|
@@ -150,7 +163,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
163
|
version: '0'
|
151
164
|
requirements: []
|
152
165
|
rubygems_version: 3.1.2
|
153
|
-
signing_key:
|
166
|
+
signing_key:
|
154
167
|
specification_version: 4
|
155
168
|
summary: "{Shield JSON formatter for SimpleCov}"
|
156
|
-
test_files:
|
169
|
+
test_files:
|
170
|
+
- spec/lib/simplecov_shield_json_spec.rb
|
171
|
+
- spec/spec_helper.rb
|