pig-ci-rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/CHANGELOG.md +11 -1
- data/README.md +7 -0
- data/config/locales/pig_ci/en.yml +1 -0
- data/lib/pig_ci/api/reports.rb +3 -1
- data/lib/pig_ci/version.rb +1 -1
- data/pig_ci.gemspec +2 -1
- data/public/assets/application.js +1 -109
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa85e7daa23732df9df64cf061da94032f1546feeee471e8acb2fc9a371b4ac8
|
4
|
+
data.tar.gz: 40c1e02b9ebc1e0983341bde07ea117daff01ce9c5c063018c7bc9ca18d4e80c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61a77bce177551a4813bde57f4a8485cfc5f1919c738e67030381a7618a9bacdfd69ee157a7a285cae1418d8deb0515abb2409eff53707a17b6a3e6a795d268b
|
7
|
+
data.tar.gz: 8c238ab03b28ac1b556a466198ae8849f304f372d343deee6d78d75882bde588567479ee72ed7faeda6678f8d587e11c593a8ef6d4ef21c76c515ca8fd09ee21
|
data/.travis.yml
CHANGED
@@ -14,8 +14,14 @@ rvm:
|
|
14
14
|
|
15
15
|
before_install:
|
16
16
|
- gem install bundler -v 2.0.1
|
17
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
18
|
+
- chmod +x ./cc-test-reporter
|
19
|
+
- ./cc-test-reporter before-build
|
17
20
|
|
18
21
|
script: "bundle exec rake spec"
|
19
22
|
|
23
|
+
after_script:
|
24
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
25
|
+
|
20
26
|
notifications:
|
21
27
|
email: false
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## 0.1.
|
3
|
+
## 0.1.2
|
4
|
+
|
5
|
+
* Codacy changes
|
6
|
+
|
7
|
+
## 0.1.1
|
8
|
+
|
9
|
+
* Updating API Endpoints for PigCI.com
|
10
|
+
* Adding fallback for if API is down to not fail CI.
|
11
|
+
* Removing unnecessary JS,
|
12
|
+
|
13
|
+
## 0.1.0
|
4
14
|
|
5
15
|
* Initial Release
|
data/README.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/pig-ci-rails.svg)](https://badge.fury.io/rb/pig-ci-rails)
|
2
|
+
[![Build Status](https://travis-ci.org/PigCI/pig-ci-rails.svg?branch=master)](https://travis-ci.org/PigCI/pig-ci-rails)
|
3
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/a3ab882cc57c4cc68d7e30f25cad2568)](https://www.codacy.com/app/MikeRogers0/pig-ci-rails?utm_source=github.com&utm_medium=referral&utm_content=PigCI/pig-ci-rails&utm_campaign=Badge_Grade)
|
4
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/d022db58c712d425dba9/maintainability)](https://codeclimate.com/github/PigCI/pig-ci-rails/maintainability)
|
5
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/d022db58c712d425dba9/test_coverage)](https://codeclimate.com/github/PigCI/pig-ci-rails/test_coverage)
|
6
|
+
|
1
7
|
# PigCI
|
2
8
|
|
3
9
|
Monitor your Ruby Applications metrics (Memory, SQL Requests & Request Time) as part of your test suite.
|
@@ -114,6 +120,7 @@ Features I'd like to add at some point:
|
|
114
120
|
* Should I disable terminal output by default? It feels like noise.
|
115
121
|
* Should I reject database requests that have a value of 0? I think so.
|
116
122
|
* Document setting branch/commit encase of weird CI.
|
123
|
+
* Add rake rake for submitting reports.
|
117
124
|
|
118
125
|
## Contributing
|
119
126
|
|
data/lib/pig_ci/api/reports.rb
CHANGED
@@ -8,6 +8,8 @@ class PigCI::Api::Reports < PigCI::Api
|
|
8
8
|
return if response.success?
|
9
9
|
|
10
10
|
puts I18n.t('pig_ci.api.reports.error', error: JSON.parse(response.parsed_response || '{}')['error'])
|
11
|
+
rescue JSON::ParserError => _e
|
12
|
+
puts I18n.t('pig_ci.api.reports.api_error')
|
11
13
|
rescue Net::OpenTimeout => e
|
12
14
|
puts I18n.t('pig_ci.api.reports.error', error: e.inspect)
|
13
15
|
end
|
@@ -16,7 +18,7 @@ class PigCI::Api::Reports < PigCI::Api
|
|
16
18
|
|
17
19
|
def post_payload
|
18
20
|
self.class.post(
|
19
|
-
'/v1/reports',
|
21
|
+
'/api/v1/reports',
|
20
22
|
base_uri: PigCI.api_base_uri,
|
21
23
|
verify: PigCI.api_verify_ssl?,
|
22
24
|
body: payload,
|
data/lib/pig_ci/version.rb
CHANGED
data/pig_ci.gemspec
CHANGED
@@ -10,7 +10,8 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = 'Mintor metrics such a memory usage as part of testing'
|
12
12
|
spec.description = 'A gem for Ruby on Rails that will report key metrics (memory, request time & SQL Requests) for request & feature tests.'
|
13
|
-
spec.homepage =
|
13
|
+
spec.homepage = 'https://github.com/PigCI/pig-ci-rails'
|
14
|
+
spec.license = 'MIT'
|
14
15
|
|
15
16
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
17
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
@@ -1,109 +1 @@
|
|
1
|
-
|
2
|
-
constructor() {
|
3
|
-
super();
|
4
|
-
this.data = JSON.parse(this.querySelector('[data-pig-ci-json]').innerText);
|
5
|
-
}
|
6
|
-
|
7
|
-
connectedCallback() {
|
8
|
-
if(this.rendered) { return; }
|
9
|
-
|
10
|
-
this.innerHTML = this._renderTable();
|
11
|
-
}
|
12
|
-
|
13
|
-
_renderTable(){
|
14
|
-
var tablesHtml = '';
|
15
|
-
|
16
|
-
for(const profiler in this.data) {
|
17
|
-
tablesHtml += `
|
18
|
-
<h2>${profiler}</h2>
|
19
|
-
<table class="table">
|
20
|
-
<thead>
|
21
|
-
<tr>
|
22
|
-
${this._renderTableHeaders(profiler)}
|
23
|
-
</tr>
|
24
|
-
</thead>
|
25
|
-
<tbody>
|
26
|
-
${this._renderTableBody(profiler)}
|
27
|
-
</tbody>
|
28
|
-
</table>
|
29
|
-
`;
|
30
|
-
}
|
31
|
-
|
32
|
-
return tablesHtml;
|
33
|
-
}
|
34
|
-
|
35
|
-
_renderTableHeaders(profiler){
|
36
|
-
return Object.keys(this.data[profiler][0]).map(function(currentValue){
|
37
|
-
return `<th>${currentValue}</th>`;
|
38
|
-
}).join('');
|
39
|
-
}
|
40
|
-
|
41
|
-
_renderTableBody(profiler){
|
42
|
-
var finalOutput = '';
|
43
|
-
|
44
|
-
for(const row in this.data[profiler]) {
|
45
|
-
finalOutput += `
|
46
|
-
<tr>
|
47
|
-
${this._renderTableRow(this.data[profiler][row])}
|
48
|
-
</tr>
|
49
|
-
`;
|
50
|
-
}
|
51
|
-
|
52
|
-
return finalOutput;
|
53
|
-
}
|
54
|
-
|
55
|
-
_renderTableRow(row){
|
56
|
-
return Object.values(row).map(function(currentValue){
|
57
|
-
return `<td>${currentValue}</td>`;
|
58
|
-
}).join('');
|
59
|
-
}
|
60
|
-
}
|
61
|
-
customElements.define('pig-ci-profilers', PigCIProfilers);
|
62
|
-
|
63
|
-
|
64
|
-
class PigCIResults extends HTMLElement {
|
65
|
-
constructor() {
|
66
|
-
super();
|
67
|
-
this.data = JSON.parse(this.querySelector('[data-pig-ci-json]').innerText);
|
68
|
-
}
|
69
|
-
|
70
|
-
connectedCallback() {
|
71
|
-
if(this.rendered) { return; }
|
72
|
-
|
73
|
-
this.innerHTML = this._renderNavTabs() + this._renderTestRun();
|
74
|
-
}
|
75
|
-
|
76
|
-
_renderNavTabs(){
|
77
|
-
var navTabs = '<ul class="nav nav-tabs mt-4" id="myTab" role="tablist">';
|
78
|
-
|
79
|
-
for(const timestamp in this.data) {
|
80
|
-
navTabs += `
|
81
|
-
<li class="nav-item">
|
82
|
-
<a class="nav-link" data-toggle="tab" href="#timestamp-${timestamp}" role="tab" aria-controls="${timestamp}">${new Date(timestamp * 1000).toLocaleString()}</a>
|
83
|
-
</li>
|
84
|
-
`;
|
85
|
-
}
|
86
|
-
navTabs += `</ul>`;
|
87
|
-
|
88
|
-
return navTabs;
|
89
|
-
}
|
90
|
-
|
91
|
-
_renderTestRun(){
|
92
|
-
var testRunHtml = '<div class="tab-content mt-3">';
|
93
|
-
|
94
|
-
for(const timestamp in this.data) {
|
95
|
-
testRunHtml += `
|
96
|
-
<div class="tab-pane fade show" id="timestamp-${timestamp}" role="tabpanel" aria-labelledby="${timestamp}-tab">
|
97
|
-
<pig-ci-profilers>
|
98
|
-
<script data-pig-ci-json type="application/json">${JSON.stringify(this.data[timestamp])}</script>
|
99
|
-
</pig-ci-profilers>
|
100
|
-
</div>
|
101
|
-
`;
|
102
|
-
}
|
103
|
-
|
104
|
-
testRunHtml += '</div>';
|
105
|
-
return testRunHtml;
|
106
|
-
}
|
107
|
-
|
108
|
-
}
|
109
|
-
customElements.define('pig-ci-results', PigCIResults);
|
1
|
+
// Any JS here.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pig-ci-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Rogers
|
@@ -241,7 +241,8 @@ files:
|
|
241
241
|
- public/assets/application.css
|
242
242
|
- public/assets/application.js
|
243
243
|
homepage: https://github.com/PigCI/pig-ci-rails
|
244
|
-
licenses:
|
244
|
+
licenses:
|
245
|
+
- MIT
|
245
246
|
metadata:
|
246
247
|
allowed_push_host: https://rubygems.org
|
247
248
|
post_install_message:
|