houston-core 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +20 -22
  3. data/README.md +1 -1
  4. data/app/adapters/houston/adapters/version_control/git_adapter/repo.rb +6 -3
  5. data/app/assets/javascripts/app/boot.coffee +9 -0
  6. data/app/assets/javascripts/app/infinite_scroll.coffee +6 -3
  7. data/app/assets/javascripts/app/models/ticket.coffee +1 -1
  8. data/app/assets/javascripts/core/app.coffee +4 -1
  9. data/app/assets/javascripts/core/core_ext/array.coffee +11 -0
  10. data/app/assets/javascripts/core/core_ext/date.coffee +8 -0
  11. data/app/assets/javascripts/core/handlebars_helpers.coffee +12 -8
  12. data/app/assets/javascripts/vendor.js +2 -2
  13. data/app/assets/stylesheets/application/mobile.scss +96 -0
  14. data/app/assets/stylesheets/application/test.scss +58 -0
  15. data/app/assets/stylesheets/application/test_run.scss +14 -5
  16. data/app/assets/stylesheets/application/timeline.scss +2 -4
  17. data/app/concerns/commit_synchronizer.rb +38 -2
  18. data/app/controllers/application_controller.rb +3 -0
  19. data/app/controllers/hooks_controller.rb +18 -0
  20. data/app/controllers/project_tests_controller.rb +46 -0
  21. data/app/helpers/commit_helper.rb +7 -0
  22. data/app/helpers/test_run_helper.rb +16 -0
  23. data/app/models/commit.rb +4 -0
  24. data/app/models/github/pull_request.rb +7 -7
  25. data/app/models/milestone.rb +1 -1
  26. data/app/models/run_tests_on_post_receive.rb +2 -0
  27. data/app/models/test.rb +4 -0
  28. data/app/models/test_result.rb +1 -1
  29. data/app/models/test_run.rb +25 -2
  30. data/app/views/layouts/_mobile_navigation.html.erb +100 -0
  31. data/app/views/layouts/application.html.erb +20 -10
  32. data/app/views/layouts/dashboard.html.erb +1 -1
  33. data/app/views/layouts/minimal.html.erb +1 -1
  34. data/app/views/layouts/naked_dashboard.html.erb +1 -1
  35. data/app/views/project_notification/test_run.html.erb +97 -120
  36. data/app/views/project_tests/_commits.html.erb +14 -0
  37. data/app/views/project_tests/index.html.erb +39 -0
  38. data/app/views/projects/_form.html.erb +6 -2
  39. data/config/application.rb +1 -2
  40. data/config/routes.rb +2 -0
  41. data/db/migrate/20151108221505_convert_pull_request_labels_to_array.rb +22 -0
  42. data/db/migrate/20151108223154_sync_body_also_for_pull_requests.rb +5 -0
  43. data/db/migrate/20151108233510_add_props_to_pull_requests.rb +5 -0
  44. data/db/structure.sql +10 -1
  45. data/houston.gemspec +4 -5
  46. data/lib/houston/version.rb +1 -1
  47. data/test/integration/web_hook_test.rb +7 -1
  48. data/test/unit/concerns/commit_synchronizer_test.rb +13 -0
  49. data/test/unit/models/pull_request_test.rb +17 -0
  50. data/vendor/assets/javascripts/showdown.js +2489 -0
  51. data/vendor/assets/javascripts/slideout.js +493 -0
  52. metadata +25 -29
  53. data/lib/tasks/config.rake +0 -255
  54. data/vendor/assets/javascripts/Markdown.Converter.js +0 -1412
@@ -1,8 +1,10 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en" <%= "class=tester-bar" if Rails.env.development? %>>
2
+ <html lang="en" class="
3
+ <%= "tester-bar" if Rails.env.development? %>
4
+ <%= "mobile" if mobile? %>">
3
5
  <head>
4
6
  <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
6
8
  <title><%= title %></title>
7
9
  <%= csrf_meta_tags %>
8
10
  <meta name="relative_url_root" content="<%= main_app.root_url %>" />
@@ -30,14 +32,22 @@
30
32
  <link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon" sizes="114x114">
31
33
  </head>
32
34
  <body>
33
-
34
- <%= render "layouts/navigation" %>
35
-
36
- <%= yield :title %>
37
-
38
- <div class="container-fluid" id="body">
35
+
36
+ <% if mobile? %>
37
+ <%= render "layouts/mobile_navigation" %>
38
+
39
+ <div class="container-fluid" id="body">
40
+ <%= yield :title %>
41
+ <% else %>
42
+ <%= render "layouts/navigation" %>
43
+
44
+ <%= yield :title %>
45
+
46
+ <div class="container-fluid" id="body">
47
+ <% end %>
48
+
39
49
  <%= yield -%>
40
-
50
+
41
51
  <%= render partial: "layouts/tester_bar" if Rails.env.development? -%>
42
52
  </div> <!-- /container -->
43
53
 
@@ -48,7 +58,7 @@
48
58
  <%# javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js" %>
49
59
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.1/underscore-min.js" %>
50
60
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js" %>
51
- <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js" %>
61
+ <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.2/handlebars.min.js" %>
52
62
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.1/d3.min.js" %>
53
63
  <%# javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.0.1/min/dropzone.min.js" %>
54
64
  <%= javascript_include_tag :vendor %>
@@ -38,7 +38,7 @@
38
38
  <%# javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js" %>
39
39
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.1/underscore-min.js" %>
40
40
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js" %>
41
- <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js" %>
41
+ <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.2/handlebars.min.js" %>
42
42
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.1/d3.min.js" %>
43
43
  <%# javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.0.1/min/dropzone.min.js" %>
44
44
  <%= javascript_include_tag :vendor %>
@@ -45,7 +45,7 @@
45
45
  <%# javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js" %>
46
46
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.1/underscore-min.js" %>
47
47
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js" %>
48
- <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js" %>
48
+ <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.2/handlebars.min.js" %>
49
49
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.1/d3.min.js" %>
50
50
  <%# javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.0.1/min/dropzone.min.js" %>
51
51
  <%= javascript_include_tag :vendor %>
@@ -37,7 +37,7 @@
37
37
  <%# javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js" %>
38
38
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.1/underscore-min.js" %>
39
39
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js" %>
40
- <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js" %>
40
+ <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.2/handlebars.min.js" %>
41
41
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.1/d3.min.js" %>
42
42
  <%# javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.0.1/min/dropzone.min.js" %>
43
43
  <%= javascript_include_tag :dashboard %>
@@ -2,139 +2,116 @@
2
2
  <small>Test Results for</small> <%= @project.name %>
3
3
  </h1>
4
4
 
5
- <h2 class="test-result-banner <%= @test_run.result %>">
6
- <%= link_to @test_run.result, @test_run.results_url, target: "_blank" %>
5
+ <h2 class="test-result-banner <%= @test_run.pending? ? "pending" : @test_run.result %>">
6
+ <%= link_to @test_run.pending? ? "pending" : @test_run.result, @test_run.results_url, target: "_blank" %>
7
7
  </h2>
8
8
 
9
- <div class="test-result-stats">
10
- <div class="score score-large">
11
- <p class="test-duration">
12
- <span class="score-count"><%= (@test_run.duration / 1000.0).round(2) %><span class="unit">s</span></span>
13
- <span class="score-label">Duration</span>
14
- </p>
15
-
16
- <p class="test-coverage">
17
- <span class="score-count"><%= (@test_run.covered_percent * 100.0).round(1) %><span class="unit">%</span></span>
18
- <span class="score-label">Coverage</span>
19
- </p>
20
-
21
- <% if @test_run.real_fail_count.zero? %>
22
- <p class="test-coverage">
23
- <span class="score-count"><%= @test_run.total_count %></span>
24
- <span class="score-label"><%= @test_run.total_count == 1 ? "Test" : "Tests" %></span>
9
+ <% unless @test_run.pending? %>
10
+ <div class="test-result-stats">
11
+ <div class="score score-large">
12
+ <p class="test-duration">
13
+ <span class="score-count"><%= (@test_run.duration / 1000.0).round(2) %><span class="unit">s</span></span>
14
+ <span class="score-label">Duration</span>
25
15
  </p>
26
- <% else %>
16
+
27
17
  <p class="test-coverage">
28
- <span class="score-count"><%= @test_run.real_fail_count %></span>
29
- <span class="score-label"><%= @test_run.real_fail_count == 1 ? "Fail" : "Fails" %></span>
18
+ <span class="score-count"><%= (@test_run.covered_percent * 100.0).round(1) %><span class="unit">%</span></span>
19
+ <span class="score-label">Coverage</span>
30
20
  </p>
31
- <% end %>
21
+
22
+ <% if @test_run.real_fail_count.zero? %>
23
+ <p class="test-coverage">
24
+ <span class="score-count"><%= @test_run.total_count %></span>
25
+ <span class="score-label"><%= @test_run.total_count == 1 ? "Test" : "Tests" %></span>
26
+ </p>
27
+ <% else %>
28
+ <p class="test-coverage">
29
+ <span class="score-count"><%= @test_run.real_fail_count %></span>
30
+ <span class="score-label"><%= @test_run.real_fail_count == 1 ? "Fail" : "Fails" %></span>
31
+ </p>
32
+ <% end %>
33
+ </div>
32
34
  </div>
33
- </div>
34
-
35
- <% unless @test_run.tests.nil? %>
36
- <table class="test-result-top-matter">
37
- <tr>
38
- <td class="test-result-graph">
39
- <% stats = TestRunStatistics.new(@project) %>
40
- <% runs, width, height = 15, 188, 75 %>
41
-
42
- <%= area_graph(
43
- data: stats.tests(runs),
44
- colors: ["FFFFFF", "AA0000", "E24E32", "5DB64C"],
45
- width: width,
46
- height: height,
47
- retina: true,
48
- bg: "FFFFFF00",
49
- title: "Results (count)" ) %>
50
- </td>
51
- <td class="test-result-graph">
52
- <%= area_graph(
53
- data: [stats.coverage(runs)],
54
- colors: ["445599"],
55
- width: width,
56
- height: height,
57
- retina: true,
58
- max: 100,
59
- bg: "FFFFFF00",
60
- title: "Coverage (percent)" ) %>
61
- </td>
62
- <td class="test-result-graph">
63
- <%= area_graph(
64
- data: [stats.duration(runs)],
65
- colors: ["3FC1AA"],
66
- width: width,
67
- height: height,
68
- retina: true,
69
- bg: "FFFFFF00",
70
- title: "Duration (seconds)" ) %>
71
- </td>
72
- </tr>
73
- </table>
74
35
  <% end %>
75
36
 
76
- <% if @test_run.failed? %>
77
- <% if (blamable_commits = @test_run.blamable_commits).any? %>
78
- <div class="test-result-credit">
79
- <p>
80
- <%= blamable_commits.uniq(&:author_email).map { |commit|
81
- "<span class=\"test-result-committer\">#{gravatar_image commit.author_email, size: 48} #{commit.author_name}</span>"
82
- }.to_sentence(two_words_connector: " or ", last_word_connector: ", or ").html_safe %>
83
- broke the build.
84
- <%= image_tag image_url("emoji/disappointed_relieved.png") %>
85
- </p>
37
+ <% unless @test_run.tests.nil? %>
38
+ <table class="test-result-top-matter">
39
+ <tr>
40
+ <td class="test-result-graph">
41
+ <% stats = TestRunStatistics.new(@project) %>
42
+ <% runs, width, height = 15, 188, 75 %>
86
43
 
87
- See commits <%= link_to_commit_range @test_run.project, blamable_commits.last.sha, blamable_commits.first.sha %>
88
- </div>
89
- <% end %>
90
- <% elsif @test_run.fixed? %>
91
- <% praisable_commits = @test_run.commits_since_last_test_run %>
92
- <div class="test-result-credit">
93
- <p>
94
- <%= praisable_commits.uniq(&:author_email).map { |commit|
95
- "<span class=\"test-result-committer\">#{gravatar_image commit.author_email, size: 48} #{commit.author_name}</span>"
96
- }.to_sentence.html_safe %>
97
- fixed the build!
98
- <%= image_tag image_url("emoji/star.png") %><%= image_tag image_url("emoji/trophy.png") %><%= image_tag image_url("emoji/star.png") %>
99
- </p>
100
-
101
- See commits <%= link_to_commit_range @test_run.project, praisable_commits.last.sha, praisable_commits.first.sha %>
102
- </div>
44
+ <%= area_graph(
45
+ data: stats.tests(runs),
46
+ colors: ["FFFFFF", "AA0000", "E24E32", "5DB64C"],
47
+ width: width,
48
+ height: height,
49
+ retina: true,
50
+ bg: "FFFFFF00",
51
+ title: "Results (count)" ) %>
52
+ </td>
53
+ <td class="test-result-graph">
54
+ <%= area_graph(
55
+ data: [stats.coverage(runs)],
56
+ colors: ["445599"],
57
+ width: width,
58
+ height: height,
59
+ retina: true,
60
+ max: 100,
61
+ bg: "FFFFFF00",
62
+ title: "Coverage (percent)" ) %>
63
+ </td>
64
+ <td class="test-result-graph">
65
+ <%= area_graph(
66
+ data: [stats.duration(runs)],
67
+ colors: ["3FC1AA"],
68
+ width: width,
69
+ height: height,
70
+ retina: true,
71
+ bg: "FFFFFF00",
72
+ title: "Duration (seconds)" ) %>
73
+ </td>
74
+ </tr>
75
+ </table>
103
76
  <% end %>
104
77
 
105
- <div class="tests-detail">
106
- <% if @test_run.tests.nil? %>
107
- <p>The build failed without running tests.</p>
108
- <% elsif @test_run.tests.none? %>
109
- <p>This project does not have any tests.</p>
110
- <% else %>
111
- <% tests = @test_run.tests %>
112
- <% tests = tests.select { |test| test_status(test) == "fail" } if @test_run.failed? %>
113
- <% tests.group_by { |test| test[:suite] }.each do |suite, tests| %>
114
- <div class="test-suite">
115
- <h3 class="test-suite-name"><%= suite %></h3>
116
- <ul class="tests">
117
- <% tests.each do |test| %>
118
- <li class="test <%= test_status(test) %>">
119
- <span class="test-status <%= test_status(test) %>"><%= test_status(test) %></span><span class="test-name"><%= test[:name].to_s.gsub(/^(test :|: )/, "") %></span>&nbsp;
120
- <% if test[:duration] %>
121
- <span class="test-duration">( <%= test[:duration].round(1) %>ms )</span>
122
- <% end %>
123
- <% if test.fetch(:error_backtrace, []).any? %>
124
- <ol class="test-backtrace">
125
- <li class="test-backtrace-line error-message"><%= test[:error_message] %></li>
126
- <% test[:error_backtrace].each do |line| %>
127
- <li class="test-backtrace-line"><%= format_backtrace_line(line) %></li>
78
+ <% unless @test_run.pending? %>
79
+ <div class="tests-detail">
80
+ <% if @test_run.tests.nil? %>
81
+ <p>The build failed without running tests.</p>
82
+ <% elsif @test_run.tests.none? %>
83
+ <p>This project does not have any tests.</p>
84
+ <% else %>
85
+ <% tests = @test_run.tests %>
86
+ <% tests = tests.select { |test| test_status(test) == "fail" } if @test_run.failed? %>
87
+ <% tests.group_by { |test| test[:suite] }.each do |suite, tests| %>
88
+ <div class="test-suite">
89
+ <h3 class="test-suite-name"><%= suite %></h3>
90
+ <ul class="tests">
91
+ <% tests.each do |test| %>
92
+ <li class="test <%= test_status(test) %>">
93
+ <%= link_to project_test_url(slug: @project.slug, id: test[:test_id], at: @test_run.sha) do %>
94
+ <span class="test-status <%= test_status(test) %>"><%= test_status(test) %></span><span class="test-name"><%= test[:name] %></span>&nbsp;
95
+ <% if test[:duration] %>
96
+ <span class="test-duration">( <%= test[:duration].round(1) %>ms )</span>
97
+ <% end %>
98
+ <% if test.fetch(:error_backtrace, []).any? %>
99
+ <ol class="test-backtrace">
100
+ <li class="test-backtrace-line error-message"><%= test[:error_message] %></li>
101
+ <% test[:error_backtrace].each do |line| %>
102
+ <li class="test-backtrace-line"><%= format_backtrace_line(line) %></li>
103
+ <% end %>
104
+ </ol>
128
105
  <% end %>
129
- </ol>
130
- <% end %>
131
- </li>
132
- <% end %>
133
- </ul>
134
- </div>
106
+ <% end %>
107
+ </li>
108
+ <% end %>
109
+ </ul>
110
+ </div>
111
+ <% end %>
135
112
  <% end %>
136
- <% end %>
137
- </div>
113
+ </div>
114
+ <% end %>
138
115
 
139
116
  <%= link_to "Retry", retry_test_run_url(slug: @test_run.project.slug, commit: @test_run.sha), class: "btn btn-large" %>
140
117
 
@@ -0,0 +1,14 @@
1
+ <% @commits.each do |commit| %>
2
+ <% run = @runs[commit.sha]
3
+ result = @results[commit.sha] %>
4
+ <%= @last_date ? render_timeline_gap_for(commit.date...@last_date) : render_timeline_date(commit.date) %>
5
+ <div class="timeline-event project-test-commit" data-sha="<%= commit.sha %>" data-first="<%= result.present? && result.new_test? %>">
6
+ <span class="timeline-event-time"><%= format_timeline_time(commit) %></span>
7
+ <%= commit_test_status run, result %>
8
+ <span class="project-test-commit-author"><%= gravatar_image commit.author_email, size: 20 %></span>
9
+ </span>
10
+ <span class="project-test-commit-message"><%= commit_test_message commit %></span>
11
+ </div>
12
+ <% @last_date = commit.date %>
13
+ <% break if result.present? && result.new_test? %>
14
+ <% 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 %>
@@ -124,12 +124,16 @@
124
124
  $(function() {
125
125
  NestedEditorFor.init();
126
126
 
127
+ function dasherize(string) {
128
+ return inflect.dasherize(inflect.underscore(string));
129
+ }
130
+
127
131
  var $name = $('#project_name'),
128
132
  $slug = $('#project_slug'),
129
- prevSlug = $name.val().dasherize();
133
+ prevSlug = dasherize($name.val());
130
134
  $name.keyup(function() {
131
135
  var name = $name.val(),
132
- slug = name.dasherize();
136
+ slug = dasherize(name);
133
137
  if($slug.val() == prevSlug) {
134
138
  $slug.val(slug);
135
139
  prevSlug = slug;
@@ -10,7 +10,7 @@ require_relative "../lib/houston_daemonize.rb"
10
10
  require "activerecord-import"
11
11
  require "activerecord/pluck_in_batches"
12
12
  require "addressable/uri"
13
- require "backbone-rails"
13
+ require "browser"
14
14
  require "cancan"
15
15
  require "codeclimate-test-reporter"
16
16
  require "default_value_for"
@@ -37,7 +37,6 @@ require "redcarpet"
37
37
  require "rugged"
38
38
  require "simplecov"
39
39
  require "strongbox"
40
- require "sugar-rails"
41
40
  require "thread_safe"
42
41
  require "vestal_versions"
43
42
  require "whenever"
data/config/routes.rb CHANGED
@@ -37,6 +37,7 @@ 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
 
41
42
 
42
43
 
@@ -75,6 +76,7 @@ Rails.application.routes.draw do
75
76
  # Web Hooks
76
77
 
77
78
  post "hooks/github", to: "hooks#github"
79
+ post "hooks/:hook", to: "hooks#trigger"
78
80
 
79
81
  scope "projects/:project_id" do
80
82
  constraints :hook => /[\w\d\-_]+/ do
@@ -0,0 +1,22 @@
1
+ class ConvertPullRequestLabelsToArray < ActiveRecord::Migration
2
+ def up
3
+ rename_column :pull_requests, :labels, :old_labels
4
+ add_column :pull_requests, :labels, :text, array: true, default: []
5
+
6
+ Github::PullRequest.reset_column_information
7
+ Github::PullRequest.pluck(:id, :old_labels).each do |id, old_labels|
8
+ Github::PullRequest.where(id: id).update_all(labels: old_labels.split(/\n/))
9
+ end
10
+ end
11
+
12
+ def down
13
+ raise IrreversibleMigration unless Github::PullRequest.column_names.member? "old_labels"
14
+
15
+ Github::PullRequest.pluck(:id, :labels).each do |id, labels|
16
+ Github::PullRequest.where(id: id).update_all(old_labels: Array(labels).uniq.join("\n"))
17
+ end
18
+
19
+ remove_column :pull_requests, :labels
20
+ rename_column :pull_requests, :old_labels, :labels
21
+ end
22
+ end