houston-core 0.5.5 → 0.5.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6aef236606e7963c5b5c25f937547b1e018785ef
4
- data.tar.gz: 90fe22a11402775168fdecf5371238b2622987dd
3
+ metadata.gz: 3406892d3fcfe0ad9866e9dd8a498ddcd9f289d0
4
+ data.tar.gz: a211ccfa508c1ed3ce16de510e7f5339d8be2500
5
5
  SHA512:
6
- metadata.gz: a71ad9e5148b88bf6fe5b23d69f05c1bf28b04ab50c442368e9b24bc133a2a6f1c5aa63aebd9182de8477b503ac1f1f776df3b0b1a37ad83986be63f1975bc1a
7
- data.tar.gz: 0a8029b5aa27cb157ee31cad0843b5a613b3103816ead338d6b43e48689c746f9564c68ab241802342385b108de6ec541d821d9e7f72dc6e2480d844f8212d79
6
+ metadata.gz: 07845570a0d72d5477f0238c20b8d766b6543322ddcd504f94d066efa9b28751ea966943b80c0b461c4140a4e2a9ff079fced0bbf3374a80cad9bd86c4722390
7
+ data.tar.gz: ba178a7479bb6657c39fd1ecacbb447644929c95bdb35ff66a7ccbf6cb9b76cd8bd39077ac906def21e5bd2e65b5756038722b7ca33e0d97391d919c77841ecd
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- houston-core (0.5.5)
4
+ houston-core (0.5.6)
5
5
  activerecord-import
6
6
  activerecord-pluck_in_batches
7
7
  addressable
@@ -9,7 +9,7 @@ PATH
9
9
  browser
10
10
  bundler
11
11
  cancan (~> 1.6.10)
12
- codeclimate-test-reporter (= 0.4.1)
12
+ codeclimate-test-reporter (= 0.4.8)
13
13
  coffee-rails (~> 4.0.0)
14
14
  default_value_for (= 3.0.0.1)
15
15
  devise (~> 3.0.0)
@@ -30,7 +30,7 @@ PATH
30
30
  nokogiri (~> 1.6.6.2)
31
31
  octokit (~> 4.1.0)
32
32
  oj (~> 2.13)
33
- openxml-xlsx
33
+ openxml-xlsx (>= 0.2.0)
34
34
  pg (~> 0.18.3)
35
35
  pg_search (~> 1.0.5)
36
36
  premailer (~> 1.8.6)
@@ -52,31 +52,31 @@ PATH
52
52
  GEM
53
53
  remote: https://rubygems.org/
54
54
  specs:
55
- actionmailer (4.1.13)
56
- actionpack (= 4.1.13)
57
- actionview (= 4.1.13)
55
+ actionmailer (4.1.14)
56
+ actionpack (= 4.1.14)
57
+ actionview (= 4.1.14)
58
58
  mail (~> 2.5, >= 2.5.4)
59
- actionpack (4.1.13)
60
- actionview (= 4.1.13)
61
- activesupport (= 4.1.13)
59
+ actionpack (4.1.14)
60
+ actionview (= 4.1.14)
61
+ activesupport (= 4.1.14)
62
62
  rack (~> 1.5.2)
63
63
  rack-test (~> 0.6.2)
64
- actionview (4.1.13)
65
- activesupport (= 4.1.13)
64
+ actionview (4.1.14)
65
+ activesupport (= 4.1.14)
66
66
  builder (~> 3.1)
67
67
  erubis (~> 2.7.0)
68
- activemodel (4.1.13)
69
- activesupport (= 4.1.13)
68
+ activemodel (4.1.14)
69
+ activesupport (= 4.1.14)
70
70
  builder (~> 3.1)
71
- activerecord (4.1.13)
72
- activemodel (= 4.1.13)
73
- activesupport (= 4.1.13)
71
+ activerecord (4.1.14)
72
+ activemodel (= 4.1.14)
73
+ activesupport (= 4.1.14)
74
74
  arel (~> 5.0.0)
75
75
  activerecord-import (0.10.0)
76
76
  activerecord (>= 3.0)
77
77
  activerecord-pluck_in_batches (0.1.0)
78
78
  activerecord
79
- activesupport (4.1.13)
79
+ activesupport (4.1.14)
80
80
  i18n (~> 0.6, >= 0.6.9)
81
81
  json (~> 1.7, >= 1.7.7)
82
82
  minitest (~> 5.1)
@@ -102,7 +102,7 @@ GEM
102
102
  rack-test (>= 0.5.4)
103
103
  xpath (~> 2.0)
104
104
  chronic (0.10.2)
105
- codeclimate-test-reporter (0.4.1)
105
+ codeclimate-test-reporter (0.4.8)
106
106
  simplecov (>= 0.7.1, < 1.0.0)
107
107
  coderay (1.1.0)
108
108
  coffee-rails (4.0.1)
@@ -208,7 +208,7 @@ GEM
208
208
  net-ldap (0.12.0)
209
209
  net-ssh (2.9.2)
210
210
  netrc (0.11.0)
211
- nokogiri (1.6.6.2)
211
+ nokogiri (1.6.6.4)
212
212
  mini_portile (~> 0.6.0)
213
213
  oauth (0.4.7)
214
214
  oauth2 (1.0.0)
@@ -219,17 +219,17 @@ GEM
219
219
  rack (~> 1.2)
220
220
  octokit (4.1.1)
221
221
  sawyer (~> 0.6.0, >= 0.5.3)
222
- oj (2.13.0)
223
- open_xml_package (0.2.0.beta1)
222
+ oj (2.13.1)
223
+ openxml-package (0.2.0)
224
224
  nokogiri
225
225
  ox
226
226
  rubyzip (~> 1.1.0)
227
- openxml-xlsx (0.1.2)
227
+ openxml-xlsx (0.2.0)
228
228
  nokogiri
229
- open_xml_package (= 0.2.0.beta1)
229
+ openxml-package (>= 0.2.0)
230
230
  orm_adapter (0.5.0)
231
231
  ox (2.2.2)
232
- pg (0.18.3)
232
+ pg (0.18.4)
233
233
  pg_search (1.0.5)
234
234
  activerecord (>= 3.1)
235
235
  activesupport (>= 3.1)
@@ -247,19 +247,19 @@ GEM
247
247
  rack (>= 1.0)
248
248
  rack-utf8_sanitizer (1.3.1)
249
249
  rack (~> 1.0)
250
- rails (4.1.13)
251
- actionmailer (= 4.1.13)
252
- actionpack (= 4.1.13)
253
- actionview (= 4.1.13)
254
- activemodel (= 4.1.13)
255
- activerecord (= 4.1.13)
256
- activesupport (= 4.1.13)
250
+ rails (4.1.14)
251
+ actionmailer (= 4.1.14)
252
+ actionpack (= 4.1.14)
253
+ actionview (= 4.1.14)
254
+ activemodel (= 4.1.14)
255
+ activerecord (= 4.1.14)
256
+ activesupport (= 4.1.14)
257
257
  bundler (>= 1.3.0, < 2.0)
258
- railties (= 4.1.13)
258
+ railties (= 4.1.14)
259
259
  sprockets-rails (~> 2.0)
260
- railties (4.1.13)
261
- actionpack (= 4.1.13)
262
- activesupport (= 4.1.13)
260
+ railties (4.1.14)
261
+ actionpack (= 4.1.14)
262
+ activesupport (= 4.1.14)
263
263
  rake (>= 0.8.7)
264
264
  thor (>= 0.18.1, < 2.0)
265
265
  rake (10.4.2)
@@ -272,7 +272,7 @@ GEM
272
272
  rr (1.1.2)
273
273
  ruby-progressbar (1.7.5)
274
274
  rubyzip (1.1.7)
275
- rufus-scheduler (3.1.7)
275
+ rufus-scheduler (3.1.10)
276
276
  rugged (0.23.3)
277
277
  safe_yaml (1.0.4)
278
278
  sass (3.2.19)
@@ -56,3 +56,29 @@
56
56
  &.project-test-status-fail { color: #e24e32; }
57
57
  }
58
58
  }
59
+
60
+ .project-tests tbody {
61
+ .test-suite-name {
62
+ color: #777;
63
+ font-weight: 800;
64
+ }
65
+
66
+ .test-name {
67
+ color: #333;
68
+ font-weight: 200;
69
+ }
70
+
71
+ .test-passes {
72
+ font-weight: 600;
73
+ color: #5db64c;
74
+
75
+ &.zero { color: #ddd; }
76
+ }
77
+
78
+ .test-fails {
79
+ font-weight: 600;
80
+ color: #e24e32;
81
+
82
+ &.zero { color: #ddd; }
83
+ }
84
+ }
@@ -2,13 +2,42 @@ class ProjectTestsController < ApplicationController
2
2
 
3
3
  def index
4
4
  @project = Project.find_by_slug! params[:slug]
5
+
6
+ head = params.fetch :at, @project.repo.branch("master")
7
+ commits = params.fetch(:limit, 500).to_i
8
+
9
+ @commits = Houston.benchmark("[project_tests#index] fetch commits") {
10
+ @project.repo.ancestors(head, including_self: true, limit: commits) }
11
+ @runs = @project.test_runs.where(sha: @commits.map(&:sha))
12
+
13
+ @tests = @project.tests.order(:suite, :name)
14
+ .joins(<<-SQL)
15
+ LEFT JOIN LATERAL (
16
+ SELECT COUNT(*) FROM test_results
17
+ WHERE test_results.test_run_id IN (#{@runs.pluck(:id).join(",")})
18
+ AND test_results.status='pass'
19
+ AND test_results.test_id=tests.id
20
+ ) "passes" ON TRUE
21
+ LEFT JOIN LATERAL (
22
+ SELECT COUNT(*) FROM test_results
23
+ WHERE test_results.test_run_id IN (#{@runs.pluck(:id).join(",")})
24
+ AND test_results.status='fail'
25
+ AND test_results.test_id=tests.id
26
+ ) "fails" ON TRUE
27
+ SQL
28
+ .where("passes.count + fails.count > 0")
29
+ .pluck("tests.id", "tests.suite", "tests.name", "passes.count", "fails.count")
30
+ end
31
+
32
+ def show
33
+ @project = Project.find_by_slug! params[:slug]
5
34
  @test = @project.tests.find params[:id]
6
35
  @totals = Hash[@test.test_results.group(:status).pluck(:status, "COUNT(*)")]
7
36
 
8
37
  begin
9
38
  head = params.fetch :at, @project.repo.branch("master")
10
39
  stop_shas = @test.introduced_in_shas
11
- @commits = Houston.benchmark("[project_tests#index] fetch commits") {
40
+ @commits = Houston.benchmark("[project_tests#show] fetch commits") {
12
41
  @project.repo.ancestors(head, including_self: true, limit: 100, hide: stop_shas) }
13
42
 
14
43
  if @commits.any?
@@ -20,6 +20,8 @@
20
20
  # * environment/simplecov_root is absent
21
21
  #
22
22
  module CodeClimate
23
+ module ServerError; end
24
+
23
25
  class CoverageReport
24
26
 
25
27
  def self.publish!(test_run)
@@ -36,6 +38,10 @@ module CodeClimate
36
38
  def publish!
37
39
  code_climate = CodeClimate::TestReporter::Client.new
38
40
  code_climate.post_results code_climate_payload
41
+ rescue RuntimeError
42
+ # https://github.com/codeclimate/ruby-test-reporter/blob/v0.4.8/lib/code_climate/test_reporter/client.rb#L72
43
+ $!.extend CodeClimate::ServerError if $!.message =~ /HTTP Error: 5\d\d/
44
+ raise
39
45
  end
40
46
 
41
47
 
@@ -158,6 +164,7 @@ module CodeClimate
158
164
  end
159
165
 
160
166
  # https://github.com/codeclimate/ruby-test-reporter/blob/v0.2.0/lib/code_climate/test_reporter/formatter.rb#L78-L83
167
+ # Compare to https://github.com/codeclimate/ruby-test-reporter/blob/v0.4.8/lib/code_climate/test_reporter/calculate_blob.rb
161
168
  def blob_id_of(filename)
162
169
  blob = project.repo.find_file(filename, commit: test_run.sha)
163
170
  blob && blob.oid
@@ -150,6 +150,8 @@ class RunTestsOnPostReceive
150
150
  test_run.project.feature_working! :publish_coverage_to_code_climate
151
151
  rescue Houston::Adapters::VersionControl::CommitNotFound
152
152
  # Got a bad Test Run, nothing we can do about it.
153
+ rescue CodeClimate::ServerError
154
+ # Error on Code Climate's end
153
155
  rescue Net::OpenTimeout, Net::ReadTimeout
154
156
  test_run.project.feature_broken! :publish_coverage_to_code_climate
155
157
  Rails.logger.warn "\e[31m[push:publish:codeclimate] #{$!.class}: #{$!.message}\e[0m"
@@ -1,5 +1,5 @@
1
1
  class TasksExcelPresenter
2
- include Xlsx::Elements
2
+ include OpenXml::Xlsx::Elements
3
3
 
4
4
  attr_reader :tasks
5
5
 
@@ -8,7 +8,7 @@ class TasksExcelPresenter
8
8
  end
9
9
 
10
10
  def to_s
11
- package = Xlsx::Package.new
11
+ package = OpenXml::Xlsx::Package.new
12
12
  worksheet = package.workbook.worksheets[0]
13
13
 
14
14
  tasks = Houston.benchmark "[#{self.class.name.underscore}] Load objects" do
@@ -1,39 +1,40 @@
1
1
  <h1 class="project-banner <%= @project.color %>" style="margin-bottom: 12px;">
2
- <small>Test for</small> <%= @project.name %>
2
+ <small>Tests for</small> <%= @project.name %>
3
3
  </h1>
4
4
 
5
- <div class="project-test-history">
6
- <h3><b><%= @test.suite %></b> <%= @test.name.to_s.gsub(/^(test :|: )/, "") %></h3>
7
-
8
- <dl class="project-test-totals">
9
- <dd><%= @totals.values.sum %></dd><dt>test runs</dt>
10
- <% @totals.each do |key, count| %>
11
- <dd><%= count %></dd><dt><%= key.pluralize %></dt>
12
- <% end %>
13
- </dl>
14
-
15
- <% if @exception %>
16
- <div class="alert alert-block alert-error">
17
- <h4>Invalid Commit</h4>
18
- <p><%= @exception.message %></p>
19
- </div>
20
- <% end %>
21
-
22
- <div class="timeline infinite-scroll">
23
- <p class="spinner"><i class="fa fa-spinner fa-spin fa-large"></i> Loading...</p>
24
- <%= render "commits" %>
25
- </div>
5
+ <div class="nomargin">
6
+ <table id="project_tests" class="table table-sortable table-striped project-tests">
7
+ <thead>
8
+ <tr>
9
+ <td class="table-margin"></td>
10
+ <th class="test-name sort-asc">Name</th>
11
+ <th class="test-passes">Passes</th>
12
+ <th class="test-fails">Fails</th>
13
+ <td class="table-margin"></td>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <% @tests.each do |(id, suite, name, passes, fails)| %>
18
+ <tr class="test">
19
+ <td class="table-margin"></td>
20
+ <td class="test-name">
21
+ <%= link_to project_test_url(slug: @project.slug, id: id) do %>
22
+ <span class="test-suite-name"><%= suite.gsub("__", "::") %></span>
23
+ <span class="test-name"><%= name.to_s.gsub(/^(test :|: )/, "") %></span>
24
+ <% end %>
25
+ </td>
26
+ <td class="test-passes <%= "zero" if passes.zero? %>"><%= passes %></td>
27
+ <td class="test-fails <%= "zero" if fails.zero? %>"><%= fails %></td>
28
+ </tr>
29
+ <% end %>
30
+ </tbody>
31
+ </table>
26
32
  </div>
27
33
 
28
34
  <% content_for :javascripts do %>
29
- <script type="text/javascript">
30
- $(function() {
31
- new InfiniteScroll({
32
- load: function($ol) {
33
- var sha = $ol.find('.project-test-commit:last').attr('data-sha');
34
- return $.get(window.location.pathname, {at: sha});
35
- }
36
- });
37
- });
38
- </script>
35
+ <script type="text/javascript">
36
+ $(function() {
37
+ $('#project_tests').tablesorter();
38
+ });
39
+ </script>
39
40
  <% end %>
@@ -0,0 +1,39 @@
1
+ <h1 class="project-banner <%= @project.color %>" style="margin-bottom: 12px;">
2
+ <small>Test for</small> <%= @project.name %>
3
+ </h1>
4
+
5
+ <div class="project-test-history">
6
+ <h3><b><%= @test.suite %></b> <%= @test.name.to_s.gsub(/^(test :|: )/, "") %></h3>
7
+
8
+ <dl class="project-test-totals">
9
+ <dd><%= @totals.values.sum %></dd><dt>test runs</dt>
10
+ <% @totals.each do |key, count| %>
11
+ <dd><%= count %></dd><dt><%= key.pluralize %></dt>
12
+ <% end %>
13
+ </dl>
14
+
15
+ <% if @exception %>
16
+ <div class="alert alert-block alert-error">
17
+ <h4>Invalid Commit</h4>
18
+ <p><%= @exception.message %></p>
19
+ </div>
20
+ <% end %>
21
+
22
+ <div class="timeline infinite-scroll">
23
+ <p class="spinner"><i class="fa fa-spinner fa-spin fa-large"></i> Loading...</p>
24
+ <%= render "commits" %>
25
+ </div>
26
+ </div>
27
+
28
+ <% content_for :javascripts do %>
29
+ <script type="text/javascript">
30
+ $(function() {
31
+ new InfiniteScroll({
32
+ load: function($ol) {
33
+ var sha = $ol.find('.project-test-commit:last').attr('data-sha');
34
+ return $.get(window.location.pathname, {at: sha});
35
+ }
36
+ });
37
+ });
38
+ </script>
39
+ <% end %>
@@ -30,6 +30,7 @@ require "nokogiri"
30
30
  require "oauth-plugin"
31
31
  require "octokit"
32
32
  require "oj"
33
+ require "openxml/xlsx"
33
34
  require "premailer"
34
35
  require "progressbar"
35
36
  require "rack/utf8_sanitizer"
@@ -40,7 +41,6 @@ require "strongbox"
40
41
  require "thread_safe"
41
42
  require "vestal_versions"
42
43
  require "whenever"
43
- require "xlsx"
44
44
 
45
45
  # Require the gems listed in Gemfile, including any gems
46
46
  # you've limited to :test, :development, or :production.
@@ -37,7 +37,9 @@ Rails.application.routes.draw do
37
37
  get "projects/:slug/test_runs/:commit", to: "test_runs#show", :as => :test_run
38
38
  get "projects/:slug/test_runs/:commit/retry", to: "test_runs#confirm_retry", :as => :retry_test_run
39
39
  post "projects/:slug/test_runs/:commit/retry", to: "test_runs#retry"
40
- get "projects/:slug/tests/:id", to: "project_tests#index", as: :project_test
40
+
41
+ get "projects/:slug/tests", to: "project_tests#index", as: :project_tests
42
+ get "projects/:slug/tests/:id", to: "project_tests#show", as: :project_test
41
43
 
42
44
 
43
45
 
@@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
43
43
  spec.add_dependency "nokogiri", "~> 1.6.6.2"
44
44
  spec.add_dependency "houston-oauth-plugin"
45
45
  spec.add_dependency "oj", "~> 2.13"
46
- spec.add_dependency "openxml-xlsx"
46
+ spec.add_dependency "openxml-xlsx", ">= 0.2.0"
47
47
  spec.add_dependency "pg_search", "~> 1.0.5"
48
48
  spec.add_dependency "premailer", "~> 1.8.6"
49
49
  spec.add_dependency "progressbar" # for long migrations
@@ -76,7 +76,7 @@ Gem::Specification.new do |spec|
76
76
  # This is a runtime dependency because Houston uses it to publish
77
77
  # code coverage to Code Climate. The version is locked because
78
78
  # Houston implements its API.
79
- spec.add_dependency "codeclimate-test-reporter", "0.4.1"
79
+ spec.add_dependency "codeclimate-test-reporter", "0.4.8"
80
80
 
81
81
  # This is a runtime dependency because Houston uses it to parse
82
82
  # code coverage data generated by simplecov
@@ -1,3 +1,3 @@
1
1
  module Houston
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: houston-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Lail
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-08 00:00:00.000000000 Z
11
+ date: 2015-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -324,14 +324,14 @@ dependencies:
324
324
  requirements:
325
325
  - - ">="
326
326
  - !ruby/object:Gem::Version
327
- version: '0'
327
+ version: 0.2.0
328
328
  type: :runtime
329
329
  prerelease: false
330
330
  version_requirements: !ruby/object:Gem::Requirement
331
331
  requirements:
332
332
  - - ">="
333
333
  - !ruby/object:Gem::Version
334
- version: '0'
334
+ version: 0.2.0
335
335
  - !ruby/object:Gem::Dependency
336
336
  name: pg_search
337
337
  requirement: !ruby/object:Gem::Requirement
@@ -576,14 +576,14 @@ dependencies:
576
576
  requirements:
577
577
  - - '='
578
578
  - !ruby/object:Gem::Version
579
- version: 0.4.1
579
+ version: 0.4.8
580
580
  type: :runtime
581
581
  prerelease: false
582
582
  version_requirements: !ruby/object:Gem::Requirement
583
583
  requirements:
584
584
  - - '='
585
585
  - !ruby/object:Gem::Version
586
- version: 0.4.1
586
+ version: 0.4.8
587
587
  - !ruby/object:Gem::Dependency
588
588
  name: simplecov
589
589
  requirement: !ruby/object:Gem::Requirement
@@ -1101,6 +1101,7 @@ files:
1101
1101
  - app/views/project_pretickets/show.html.erb
1102
1102
  - app/views/project_tests/_commits.html.erb
1103
1103
  - app/views/project_tests/index.html.erb
1104
+ - app/views/project_tests/show.html.erb
1104
1105
  - app/views/project_tickets/_tickets.html.erb
1105
1106
  - app/views/project_tickets/bugs.html.erb
1106
1107
  - app/views/project_tickets/ideas.html.erb