houston-core 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +69 -68
  3. data/app/adapters/houston/adapters/deployment/engineyard.rb +1 -1
  4. data/app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb +19 -0
  5. data/app/adapters/houston/adapters/version_control/git_adapter/remote_repo.rb +27 -0
  6. data/app/assets/images/drag-grip.png +0 -0
  7. data/app/assets/javascripts/app/infinite_scroll.coffee +1 -1
  8. data/app/assets/javascripts/app/views/_show_sprint_view.coffee +9 -9
  9. data/app/assets/javascripts/application.js +1 -0
  10. data/app/assets/javascripts/core/app.coffee +5 -0
  11. data/app/assets/javascripts/{app → core}/stacked_area_graph.coffee +0 -0
  12. data/app/assets/javascripts/{app → core}/stacked_bar_graph.coffee +0 -0
  13. data/app/assets/javascripts/dashboard.js +1 -0
  14. data/app/assets/javascripts/vendor.js +0 -1
  15. data/app/assets/stylesheets/application/exceptions.scss +3 -1
  16. data/app/assets/stylesheets/application/navigation.scss +84 -21
  17. data/app/assets/stylesheets/application/releases.scss +32 -2
  18. data/app/assets/stylesheets/application/test.scss +34 -0
  19. data/app/assets/stylesheets/core/colors.scss.erb +33 -3
  20. data/app/assets/stylesheets/dashboard/dashboard.scss +11 -7
  21. data/app/assets/stylesheets/variables.scss +3 -0
  22. data/app/concerns/belongs_to_commit.rb +14 -0
  23. data/app/concerns/project_adapter.rb +24 -6
  24. data/app/controllers/api/v1/projects_controller.rb +18 -0
  25. data/app/controllers/api/v1/sprint_tasks_controller.rb +1 -1
  26. data/app/controllers/deploys_controller.rb +1 -0
  27. data/app/controllers/project_tests_controller.rb +49 -19
  28. data/app/controllers/releases_controller.rb +5 -0
  29. data/app/controllers/test_runs_controller.rb +16 -1
  30. data/app/helpers/test_run_helper.rb +24 -0
  31. data/app/models/deploy.rb +13 -0
  32. data/app/models/github/pull_request.rb +39 -4
  33. data/app/models/release.rb +42 -0
  34. data/app/models/task.rb +3 -2
  35. data/app/models/test_run.rb +4 -0
  36. data/app/presenters/project_presenter.rb +28 -0
  37. data/app/views/deploys/show.html.erb +4 -0
  38. data/app/views/github/pulls/index.html.erb +4 -1
  39. data/app/views/layouts/_mobile_navigation.html.erb +14 -17
  40. data/app/views/layouts/_navigation.html.erb +87 -87
  41. data/app/views/layouts/dashboard.html.erb +2 -2
  42. data/app/views/project_tests/index.html.erb +22 -7
  43. data/app/views/releases/_index.html.erb +65 -0
  44. data/app/views/releases/_results.html.erb +47 -0
  45. data/app/views/releases/index.html.erb +29 -65
  46. data/app/views/sprints/dashboard.html.erb +4 -2
  47. data/config/environments/production.rb +1 -1
  48. data/config/environments/test.rb +4 -1
  49. data/config/initializers/add_navigation_renderers.rb +6 -0
  50. data/config/initializers/requirements.rb +1 -0
  51. data/config/routes.rb +3 -0
  52. data/db/migrate/20151226154901_add_search_vector_to_releases.rb +6 -0
  53. data/db/migrate/20151226155305_generate_index_on_releases.rb +5 -0
  54. data/db/migrate/20151228183704_drop_unused_tables.rb +35 -0
  55. data/db/migrate/20160120145757_add_successful_to_deploys.rb +10 -0
  56. data/db/structure.sql +19 -67
  57. data/houston.gemspec +3 -3
  58. data/lib/configuration.rb +4 -2
  59. data/lib/core_ext/array.rb +37 -0
  60. data/lib/houston/version.rb +1 -1
  61. data/test/integration/ci_integration_test.rb +14 -13
  62. data/test/unit/models/project_test.rb +33 -0
  63. data/test/unit/models/pull_request_test.rb +71 -1
  64. metadata +24 -14
  65. data/app/models/historical_head.rb +0 -5
@@ -12,69 +12,33 @@
12
12
 
13
13
  <%= link_to "New Release", new_release_path(@project, @environment), :class => 'btn btn-primary' if @environment && can?(:create, Release) %>
14
14
 
15
-
16
- <% if @deploys.none? %>
17
-
18
- <div class="alert alert-info">
19
- There have been no deploys of <b><%= @project.name %></b> to <b><%= @environment %></b> recorded.
20
- </div>
21
-
22
- <% else %>
23
-
24
- <% date = nil %>
25
- <div id="<%= @project.slug %>_changelog" class="-houston-changelog">
26
- <% @deploys.each do |deploy| %>
27
- <% deploy.project = @project; release = deploy.release %>
28
- <% next if release.nil? && deploy.commit.nil? %>
29
-
30
- <% if date.nil? || date != deploy.date %>
31
- <% if date %></div><% end %><%# end .-houston-changelog-day %>
32
- <div class="-houston-changelog-day">
33
- <h4><%= format_release_date(date = deploy.date) %></h4>
34
- <% end %>
35
-
36
- <% unless release %>
37
- <div class="release release-deploy">
38
- <p class="release-header">
39
- <%= deploy.completed_at.strftime("%l:%M %p") %>&nbsp;&nbsp;
40
- <% deploy.commit.project = @project %>
41
- Deploy to <%= link_to_commit deploy.commit, style: "float: none;" %>
42
-
43
- <span style="float: right;">
44
- <%= link_to "New Release", new_release_path(slug: @project.slug, environment: @environment, deploy_id: deploy.id), class: "btn btn-mini btn-default" %>
45
- </span>
46
- </div>
47
- <% else %>
48
- <%= div_for(release) do %>
49
- <% release.project = @project %>
50
- <p class="release-header">
51
- <%= release.released_at.strftime("%l:%M %p") %>&nbsp;&nbsp;
52
- <%= link_to "details &rarr;".html_safe, release_url(release) %>
53
-
54
- <% if can?(:read, @project.commits.build) %>
55
- <span class="commit-range"><%= link_to_release_commit_range(release) %></span>
56
- <% end %>
57
- </p>
58
-
59
- <% if release.release_changes.any? %>
60
- <div class="release-changes">
61
- <% ordered_by_tag(release.release_changes).each do |change| %>
62
- <% if can?(:read, change) %>
63
- <div class="change">
64
- <%= format_change_tag change.tag %>
65
- <div class="change-summary"><%= format_change(change) %></div>
66
- </div>
67
- <% end %>
68
- <% end %>
69
- </div>
70
- <% else %>
71
- <div class="release-no-changes">No changes</div>
72
- <% end %>
73
- <% end %>
74
- <% end %>
75
-
76
- <% end %>
77
- <% if date %></div><% end %><%# end .-houston-changelog-day %>
78
- </div>
79
-
15
+ <form id="search_releases" method="get" class="input-group pull-right">
16
+ <%= search_field_tag :q, @q, autofocus: true %><%=
17
+ hidden_field_tag :environment, @environment %><%=
18
+ submit_tag "Search", class: "btn btn-default" -%>
19
+ </form>
20
+
21
+
22
+ <div id="releases" class="release-search-result">
23
+ <%= render partial: (@q ? "releases/results" : "releases/index") %>
24
+ </div>
25
+
26
+ <% content_for :javascripts do %>
27
+ <script type="text/javascript">
28
+ $(function() {
29
+ var $form = $('#search_releases');
30
+ $form.submit(function(e) {
31
+ e.preventDefault();
32
+ var url = window.location.pathname + '?' + $form.serialize();
33
+ $form.find('input[type="submit"]').prop('disabled', true);
34
+ $.get(url)
35
+ .success(function(html) {
36
+ $('#releases').html(html);
37
+ })
38
+ .complete(function() {
39
+ $form.find('input[type="submit"]').prop('disabled', false);
40
+ });
41
+ });
42
+ });
43
+ </script>
80
44
  <% end %>
@@ -10,9 +10,11 @@
10
10
  sprintStart: new Date(<%= @sprint.start_date.year %>, <%= @sprint.start_date.month - 1 %>, <%= @sprint.start_date.day %>),
11
11
  sprintTasks: <%= raw SprintTaskPresenter.new(@sprint).to_json %>
12
12
  });
13
-
13
+
14
14
  view.render();
15
-
15
+
16
+ $('body').toggleClass('green', view.totalEffort > 0 && (view.toCommit == 0 || view.toComplete == 0));
17
+
16
18
  new Refresher()
17
19
  .container('#container')
18
20
  .interval(10 * 60 * 1000) // 10 minutes
@@ -20,7 +20,7 @@ Rails.application.configure do
20
20
  # config.action_dispatch.rack_cache = true
21
21
 
22
22
  # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_assets = false
23
+ config.serve_static_files = false
24
24
 
25
25
  # Compress JavaScripts and CSS.
26
26
  config.assets.js_compressor = :uglifier
@@ -13,7 +13,7 @@ Rails.application.configure do
13
13
  config.eager_load = false
14
14
 
15
15
  # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_assets = true
16
+ config.serve_static_files = true
17
17
  config.static_cache_control = 'public, max-age=3600'
18
18
 
19
19
  # Show full error reports and disable caching.
@@ -42,4 +42,7 @@ Rails.application.configure do
42
42
 
43
43
  # Do not dump schema after migrations.
44
44
  config.active_record.dump_schema_after_migration = false
45
+
46
+ # Specify test order
47
+ config.active_support.test_order = :random
45
48
  end
@@ -4,6 +4,12 @@ Houston.config.add_navigation_renderer :sprint do
4
4
  end
5
5
  end
6
6
 
7
+ Houston.config.add_navigation_renderer :pulls do
8
+ if can?(:read, Github::PullRequest)
9
+ render_nav_link "Pulls", main_app.pulls_path
10
+ end
11
+ end
12
+
7
13
 
8
14
 
9
15
  Houston.config.add_project_feature :ideas do
@@ -1,4 +1,5 @@
1
1
  require "core_ext/duration"
2
+ require "core_ext/array"
2
3
  require "parallel_enumerable"
3
4
  require "unexpected_response"
4
5
  require "pg_search"
@@ -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
+ put "projects/:slug/test_runs/:commit/results", to: "test_runs#save_results"
40
41
 
41
42
  get "projects/:slug/tests", to: "project_tests#index", as: :project_tests
42
43
  get "projects/:slug/tests/:id", to: "project_tests#show", as: :project_test
@@ -189,6 +190,8 @@ Rails.application.routes.draw do
189
190
 
190
191
  namespace "api" do
191
192
  namespace "v1" do
193
+ get "projects", to: "projects#index"
194
+
192
195
  scope "projects/:slug" do
193
196
  scope "tickets/by_number/:number" do
194
197
  get "tasks", to: "ticket_tasks#index"
@@ -0,0 +1,6 @@
1
+ class AddSearchVectorToReleases < ActiveRecord::Migration
2
+ def change
3
+ add_column :releases, :search_vector, :tsvector
4
+ add_index :releases, :search_vector, using: :gin
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class GenerateIndexOnReleases < ActiveRecord::Migration
2
+ def change
3
+ Release.reindex!
4
+ end
5
+ end
@@ -0,0 +1,35 @@
1
+ class DropUnusedTables < ActiveRecord::Migration
2
+ def up
3
+ remove_column :deploys, :environment_id
4
+ drop_table :historical_heads
5
+ remove_column :projects, :gemnasium_slug
6
+ remove_column :pull_requests, :labels
7
+ remove_column :pull_requests, :old_labels
8
+ remove_column :releases, :environment_id
9
+ remove_column :tasks, :checked_out_at
10
+ remove_column :tasks, :checked_out_by_id
11
+ remove_column :tickets, :sprint_id
12
+ remove_column :tickets, :checked_out_at
13
+ remove_column :tickets, :checked_out_by_id
14
+ remove_column :users, :old_environments_subscribed_to
15
+ end
16
+
17
+ def down
18
+ add_column :deploys, :environment_id, :integer
19
+ create_table :historical_heads do |t|
20
+ t.integer :project_id, null: false
21
+ t.hstore :branches, null: false, default: {}
22
+ t.timestamps
23
+ end
24
+ add_column :projects, :gemnasium_slug, :string
25
+ add_column :pull_requests, :old_labels, :text, default: "", null: false
26
+ add_column :pull_requests, :labels, :text, array: true, default: [], null: false
27
+ add_column :releases, :environment_id, :integer
28
+ add_column :tasks, :checked_out_at, :timestamp
29
+ add_column :tasks, :checked_out_by_id, :integer
30
+ add_column :tickets, :sprint_id, :integer
31
+ add_column :tickets, :checked_out_at, :timestampd
32
+ add_column :tickets, :checked_out_by_id, :integer
33
+ add_column :users, :old_environments_subscribed_to, :string, default: "", null: false
34
+ end
35
+ end
@@ -0,0 +1,10 @@
1
+ class AddSuccessfulToDeploys < ActiveRecord::Migration
2
+ def up
3
+ add_column :deploys, :successful, :boolean, null: false, default: false
4
+ execute "UPDATE deploys SET successful='t'"
5
+ end
6
+
7
+ def down
8
+ remove_column :deploys, :successful
9
+ end
10
+ end
@@ -188,7 +188,6 @@ ALTER SEQUENCE consumer_tokens_id_seq OWNED BY consumer_tokens.id;
188
188
  CREATE TABLE deploys (
189
189
  id integer NOT NULL,
190
190
  project_id integer,
191
- environment_id integer,
192
191
  sha character varying(255) NOT NULL,
193
192
  created_at timestamp without time zone,
194
193
  updated_at timestamp without time zone,
@@ -199,7 +198,8 @@ CREATE TABLE deploys (
199
198
  branch character varying(255),
200
199
  output text,
201
200
  user_id integer,
202
- completed_at timestamp without time zone
201
+ completed_at timestamp without time zone,
202
+ successful boolean DEFAULT false NOT NULL
203
203
  );
204
204
 
205
205
 
@@ -222,38 +222,6 @@ CREATE SEQUENCE deploys_id_seq
222
222
  ALTER SEQUENCE deploys_id_seq OWNED BY deploys.id;
223
223
 
224
224
 
225
- --
226
- -- Name: historical_heads; Type: TABLE; Schema: public; Owner: -; Tablespace:
227
- --
228
-
229
- CREATE TABLE historical_heads (
230
- id integer NOT NULL,
231
- project_id integer NOT NULL,
232
- branches hstore DEFAULT ''::hstore NOT NULL,
233
- created_at timestamp without time zone,
234
- updated_at timestamp without time zone
235
- );
236
-
237
-
238
- --
239
- -- Name: historical_heads_id_seq; Type: SEQUENCE; Schema: public; Owner: -
240
- --
241
-
242
- CREATE SEQUENCE historical_heads_id_seq
243
- START WITH 1
244
- INCREMENT BY 1
245
- NO MINVALUE
246
- NO MAXVALUE
247
- CACHE 1;
248
-
249
-
250
- --
251
- -- Name: historical_heads_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
252
- --
253
-
254
- ALTER SEQUENCE historical_heads_id_seq OWNED BY historical_heads.id;
255
-
256
-
257
225
  --
258
226
  -- Name: measurements; Type: TABLE; Schema: public; Owner: -; Tablespace:
259
227
  --
@@ -382,7 +350,6 @@ CREATE TABLE projects (
382
350
  last_ticket_tracker_sync_at timestamp without time zone,
383
351
  ticket_tracker_sync_started_at timestamp without time zone,
384
352
  view_options hstore DEFAULT ''::hstore NOT NULL,
385
- gemnasium_slug character varying(255),
386
353
  feature_states hstore DEFAULT ''::hstore NOT NULL,
387
354
  selected_features text[],
388
355
  head_sha character varying(255)
@@ -425,8 +392,6 @@ CREATE TABLE pull_requests (
425
392
  base_sha character varying(255) NOT NULL,
426
393
  head_ref character varying(255) NOT NULL,
427
394
  head_sha character varying(255) NOT NULL,
428
- old_labels text DEFAULT ''::text NOT NULL,
429
- labels text[] DEFAULT '{}'::text[],
430
395
  body text,
431
396
  props jsonb DEFAULT '{}'::jsonb,
432
397
  avatar_url character varying(255),
@@ -461,7 +426,6 @@ ALTER SEQUENCE pull_requests_id_seq OWNED BY pull_requests.id;
461
426
 
462
427
  CREATE TABLE releases (
463
428
  id integer NOT NULL,
464
- environment_id integer,
465
429
  name character varying(255),
466
430
  commit0 character varying(255),
467
431
  commit1 character varying(255),
@@ -474,7 +438,8 @@ CREATE TABLE releases (
474
438
  environment_name character varying(255) DEFAULT 'Production'::character varying NOT NULL,
475
439
  release_changes text DEFAULT ''::text NOT NULL,
476
440
  commit_before_id integer,
477
- commit_after_id integer
441
+ commit_after_id integer,
442
+ search_vector tsvector
478
443
  );
479
444
 
480
445
 
@@ -646,8 +611,6 @@ CREATE TABLE tasks (
646
611
  first_release_at timestamp without time zone,
647
612
  first_commit_at timestamp without time zone,
648
613
  sprint_id integer,
649
- checked_out_at timestamp without time zone,
650
- checked_out_by_id integer,
651
614
  created_at timestamp without time zone,
652
615
  updated_at timestamp without time zone,
653
616
  project_id integer NOT NULL,
@@ -917,9 +880,6 @@ CREATE TABLE tickets (
917
880
  destroyed_at timestamp without time zone,
918
881
  resolution character varying(255) DEFAULT ''::character varying NOT NULL,
919
882
  first_release_at timestamp without time zone,
920
- sprint_id integer,
921
- checked_out_at timestamp without time zone,
922
- checked_out_by_id integer,
923
883
  priority character varying(255) DEFAULT 'normal'::character varying NOT NULL,
924
884
  reopened_at timestamp without time zone,
925
885
  prerequisites integer[]
@@ -1011,7 +971,6 @@ CREATE TABLE users (
1011
971
  unfuddle_id integer,
1012
972
  first_name character varying(255),
1013
973
  last_name character varying(255),
1014
- old_environments_subscribed_to character varying(255) DEFAULT ''::character varying NOT NULL,
1015
974
  retired_at timestamp without time zone,
1016
975
  view_options hstore DEFAULT ''::hstore NOT NULL,
1017
976
  email_addresses text[],
@@ -1133,13 +1092,6 @@ ALTER TABLE ONLY consumer_tokens ALTER COLUMN id SET DEFAULT nextval('consumer_t
1133
1092
  ALTER TABLE ONLY deploys ALTER COLUMN id SET DEFAULT nextval('deploys_id_seq'::regclass);
1134
1093
 
1135
1094
 
1136
- --
1137
- -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1138
- --
1139
-
1140
- ALTER TABLE ONLY historical_heads ALTER COLUMN id SET DEFAULT nextval('historical_heads_id_seq'::regclass);
1141
-
1142
-
1143
1095
  --
1144
1096
  -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1145
1097
  --
@@ -1311,14 +1263,6 @@ ALTER TABLE ONLY deploys
1311
1263
  ADD CONSTRAINT deploys_pkey PRIMARY KEY (id);
1312
1264
 
1313
1265
 
1314
- --
1315
- -- Name: historical_heads_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1316
- --
1317
-
1318
- ALTER TABLE ONLY historical_heads
1319
- ADD CONSTRAINT historical_heads_pkey PRIMARY KEY (id);
1320
-
1321
-
1322
1266
  --
1323
1267
  -- Name: measurements_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1324
1268
  --
@@ -1678,6 +1622,13 @@ CREATE INDEX index_releases_on_project_id ON releases USING btree (project_id);
1678
1622
  CREATE INDEX index_releases_on_project_id_and_environment_name ON releases USING btree (project_id, environment_name);
1679
1623
 
1680
1624
 
1625
+ --
1626
+ -- Name: index_releases_on_search_vector; Type: INDEX; Schema: public; Owner: -; Tablespace:
1627
+ --
1628
+
1629
+ CREATE INDEX index_releases_on_search_vector ON releases USING gin (search_vector);
1630
+
1631
+
1681
1632
  --
1682
1633
  -- Name: index_releases_tasks_on_release_id_and_task_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1683
1634
  --
@@ -1825,13 +1776,6 @@ CREATE INDEX index_tickets_on_milestone_id ON tickets USING btree (milestone_id)
1825
1776
  CREATE INDEX index_tickets_on_resolution ON tickets USING btree (resolution);
1826
1777
 
1827
1778
 
1828
- --
1829
- -- Name: index_tickets_on_sprint_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1830
- --
1831
-
1832
- CREATE INDEX index_tickets_on_sprint_id ON tickets USING btree (sprint_id);
1833
-
1834
-
1835
1779
  --
1836
1780
  -- Name: index_users_on_authentication_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
1837
1781
  --
@@ -2315,3 +2259,11 @@ INSERT INTO schema_migrations (version) VALUES ('20151209004458');
2315
2259
 
2316
2260
  INSERT INTO schema_migrations (version) VALUES ('20151209030113');
2317
2261
 
2262
+ INSERT INTO schema_migrations (version) VALUES ('20151226154901');
2263
+
2264
+ INSERT INTO schema_migrations (version) VALUES ('20151226155305');
2265
+
2266
+ INSERT INTO schema_migrations (version) VALUES ('20151228183704');
2267
+
2268
+ INSERT INTO schema_migrations (version) VALUES ('20160120145757');
2269
+
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
 
22
22
  # For Houston as a Web Application
23
- spec.add_dependency "rails", "~> 4.2.5"
23
+ spec.add_dependency "rails", "~> 4.2.5.1"
24
24
  spec.add_dependency "sprockets", "~> 2.8" # update this when updating Rails
25
25
  spec.add_dependency "pg", "~> 0.18.3"
26
26
  # --------------------------------
@@ -33,14 +33,14 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "devise", "~> 3.5.0"
34
34
  spec.add_dependency "devise_invitable", "~> 1.5.3"
35
35
  spec.add_dependency "houston-devise_ldap_authenticatable"
36
- spec.add_dependency "faraday", "~> 0.8.10"
36
+ spec.add_dependency "faraday", "~> 0.9.2"
37
37
  spec.add_dependency "faraday-http-cache", "~> 1.2.2"
38
38
  spec.add_dependency "faraday-raise-errors", "~> 0.2.0"
39
39
  spec.add_dependency "gemoji", "~> 2.1.0"
40
40
  spec.add_dependency "handlebars_assets", "~> 0.21.0"
41
41
  spec.add_dependency "hpricot", "~> 0.8.6"
42
42
  spec.add_dependency "neat-rails"
43
- spec.add_dependency "nokogiri", "~> 1.6.6.2"
43
+ spec.add_dependency "nokogiri"
44
44
  spec.add_dependency "houston-oauth-plugin"
45
45
  spec.add_dependency "oj", "~> 2.13"
46
46
  spec.add_dependency "openxml-xlsx", ">= 0.2.0"