houston-core 0.5.6 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +94 -69
- data/app/adapters/houston/adapters/deployment/engineyard.rb +4 -3
- data/app/adapters/houston/adapters/version_control/git_adapter.rb +36 -42
- data/app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb +2 -2
- data/app/adapters/houston/adapters/version_control/git_adapter/remote_repo.rb +23 -11
- data/app/adapters/houston/adapters/version_control/git_adapter/repo.rb +18 -8
- data/app/adapters/houston/adapters/version_control/null_repo.rb +8 -0
- data/app/assets/javascripts/core/handlebars_helpers.coffee +3 -3
- data/app/assets/stylesheets/application/github_repos.scss +77 -0
- data/app/assets/stylesheets/application/navigation.scss +2 -0
- data/app/assets/stylesheets/application/pull_requests.scss +44 -58
- data/app/assets/stylesheets/core/avatars.scss +5 -0
- data/app/assets/stylesheets/core/colors.scss.erb +10 -7
- data/app/concerns/commit_synchronizer.rb +3 -0
- data/app/controllers/github/pulls_controller.rb +12 -0
- data/app/controllers/project_tests_controller.rb +3 -3
- data/app/controllers/projects_controller.rb +45 -1
- data/app/controllers/releases_controller.rb +42 -26
- data/app/helpers/application_helper.rb +8 -0
- data/app/helpers/avatar_helper.rb +2 -2
- data/app/helpers/commit_helper.rb +2 -2
- data/app/helpers/oembed_helper.rb +8 -0
- data/app/helpers/project_helper.rb +4 -5
- data/app/helpers/release_helper.rb +11 -0
- data/app/helpers/timeline_helper.rb +1 -1
- data/app/helpers/url_helper.rb +0 -18
- data/app/interactors/cache_key_dependencies.rb +28 -0
- data/app/jobs/sync_all_tickets_job.rb +1 -0
- data/app/mailers/view_mailer.rb +0 -1
- data/app/models/commit.rb +1 -1
- data/app/models/github/pull_request.rb +82 -26
- data/app/models/github/pull_request_event.rb +2 -2
- data/app/models/milestone.rb +1 -0
- data/app/models/project.rb +14 -0
- data/app/models/project_dependencies.rb +5 -3
- data/app/models/task.rb +1 -1
- data/app/models/user.rb +41 -0
- data/app/views/commits/show.html.erb +9 -1
- data/app/views/github/pulls/index.html.erb +102 -0
- data/app/views/project_notification/new_release.html.erb +6 -0
- data/app/views/project_tickets/index.xls.erb +0 -7
- data/app/views/projects/_form.html.erb +29 -17
- data/app/views/projects/index.html.erb +3 -3
- data/app/views/projects/new_from_github.html.erb +67 -0
- data/app/views/releases/_commits.html.erb +1 -1
- data/app/views/releases/show.html.erb +9 -0
- data/app/views/users/_form.html.erb +35 -19
- data/config/application.rb +12 -0
- data/config/initializers/mime_types.rb +1 -0
- data/config/routes.rb +17 -3
- data/db/migrate/20151201042126_require_projects_to_have_name_and_slug.rb +6 -0
- data/db/migrate/20151202005557_add_head_sha_to_projects.rb +24 -0
- data/db/migrate/20151202011812_require_projects_to_have_color.rb +13 -0
- data/db/migrate/20151205204922_require_project_slugs_to_be_unique.rb +5 -0
- data/db/migrate/20151205214647_add_avatar_url_to_pull_requests.rb +5 -0
- data/db/migrate/20151209004458_add_json_labels_to_pull_requests.rb +5 -0
- data/db/migrate/20151209030113_add_timestamps_to_pull_requests.rb +6 -0
- data/db/structure.sql +31 -5
- data/houston.gemspec +7 -7
- data/lib/configuration.rb +3 -2
- data/lib/houston/version.rb +1 -1
- data/lib/rack/oembed.rb +23 -0
- data/templates/new-instance/config/jobs/cache_key_dependencies.rb +3 -0
- data/templates/new-instance/config/triggers/tests/slack_when_analyzed.rb +1 -4
- data/templates/new-instance/config/triggers/tests/slack_when_completed.rb +1 -1
- data/templates/new-instance/lib/slack_helpers.rb +1 -1
- data/test/integration/ticket_tasks_api_test.rb +1 -1
- data/test/unit/adapters/git_adapter_test.rb +29 -8
- data/test/unit/adapters/version_control_adapters_api_test.rb +2 -0
- data/test/unit/controllers/hooks_controller_test.rb +4 -4
- data/test/unit/models/commit_test.rb +2 -2
- data/test/unit/models/project_test.rb +2 -2
- data/test/unit/models/pull_request_test.rb +9 -4
- data/test/unit/models/task_test.rb +1 -1
- data/test/unit/models/ticket_test.rb +1 -1
- metadata +31 -16
@@ -7,7 +7,7 @@
|
|
7
7
|
<% end %>
|
8
8
|
</h5>
|
9
9
|
<ul class="commits">
|
10
|
-
<% commits.each do |commit
|
10
|
+
<% commits.each do |commit|; commit.project = @project %>
|
11
11
|
<%= content_tag :li, :id => "commit_#{commit.id}" do %>
|
12
12
|
<%= link_to_commit(commit) if github_url?(@project) && !for_email? && can?(:read, commit) %>
|
13
13
|
<%= format_commit(commit) %>
|
@@ -1,3 +1,12 @@
|
|
1
|
+
<% content_for :meta do %>
|
2
|
+
<%= link_to_oembed release_url(@release) %>
|
3
|
+
<%= tag "meta", property: "og:type", content: "website" %>
|
4
|
+
<%= tag "meta", property: "og:site_name", content: "#{@project.slug} / #{@release.environment_name}" %>
|
5
|
+
<%= tag "meta", property: "og:title", content: format_release_subject(@release) %>
|
6
|
+
<%= tag "meta", property: "og:description", content: format_release_description(@release) %>
|
7
|
+
<%= tag "meta", property: "og:url", content: release_url(@release) %>
|
8
|
+
<% end %>
|
9
|
+
|
1
10
|
<%= render partial: "projects/header", locals: {project: @project, subtitle: "Release of"} %>
|
2
11
|
|
3
12
|
<%= render partial: "releases/changelog" %>
|
@@ -1,55 +1,55 @@
|
|
1
|
-
<%= form_for @user, :html => { :class =>
|
1
|
+
<%= form_for @user, :html => { :class => "form-horizontal" } do |f| %>
|
2
2
|
<fieldset>
|
3
3
|
|
4
4
|
<div class="control-group">
|
5
|
-
<%= f.label :first_name, :class =>
|
5
|
+
<%= f.label :first_name, :class => "control-label" %>
|
6
6
|
<div class="controls">
|
7
|
-
<%= f.text_field :first_name, :class =>
|
7
|
+
<%= f.text_field :first_name, :class => "text_field" %>
|
8
8
|
</div>
|
9
9
|
</div>
|
10
10
|
|
11
11
|
<div class="control-group">
|
12
|
-
<%= f.label :last_name, :class =>
|
12
|
+
<%= f.label :last_name, :class => "control-label" %>
|
13
13
|
<div class="controls">
|
14
|
-
<%= f.text_field :last_name, :class =>
|
14
|
+
<%= f.text_field :last_name, :class => "text_field" %>
|
15
15
|
</div>
|
16
16
|
</div>
|
17
17
|
|
18
18
|
<div class="control-group">
|
19
|
-
<%= f.label :nickname, "Nickname", :class =>
|
19
|
+
<%= f.label :nickname, "Nickname", :class => "control-label" %>
|
20
20
|
<div class="controls">
|
21
|
-
<%= f.text_field :nickname, :class =>
|
21
|
+
<%= f.text_field :nickname, :class => "text_field" %>
|
22
22
|
</div>
|
23
23
|
</div>
|
24
24
|
|
25
25
|
<div class="control-group">
|
26
|
-
<%= f.label :email, "Primary Email Address", :class =>
|
26
|
+
<%= f.label :email, "Primary Email Address", :class => "control-label" %>
|
27
27
|
<div class="controls">
|
28
|
-
<%= f.text_field :email, :class =>
|
28
|
+
<%= f.text_field :email, :class => "text_field" %>
|
29
29
|
</div>
|
30
30
|
</div>
|
31
31
|
|
32
32
|
<div class="control-group">
|
33
|
-
<%= f.label :alias_emails, "Other Email Addresses", :class =>
|
33
|
+
<%= f.label :alias_emails, "Other Email Addresses", :class => "control-label" %>
|
34
34
|
<div class="controls">
|
35
|
-
<%= f.text_area :alias_emails, :class =>
|
35
|
+
<%= f.text_area :alias_emails, :class => "text_field", rows: 3, value: @user.alias_emails.join("\n") %>
|
36
36
|
</div>
|
37
37
|
</div>
|
38
38
|
|
39
39
|
<% if can?(:manage, @user) %>
|
40
40
|
<div class="control-group">
|
41
|
-
<%= f.label :role, :class =>
|
41
|
+
<%= f.label :role, :class => "control-label" %>
|
42
42
|
<div class="controls">
|
43
|
-
<%= f.select :role, Houston.config.roles, :class =>
|
43
|
+
<%= f.select :role, Houston.config.roles, :class => "select_field" %>
|
44
44
|
</div>
|
45
45
|
</div>
|
46
46
|
<% end %>
|
47
47
|
|
48
48
|
<% if can?(:manage, @user) %>
|
49
49
|
<div class="control-group">
|
50
|
-
<%= f.label :administrator, :class =>
|
50
|
+
<%= f.label :administrator, :class => "control-label" %>
|
51
51
|
<div class="controls">
|
52
|
-
<%= f.check_box :administrator, :class =>
|
52
|
+
<%= f.check_box :administrator, :class => "checkbox" %>
|
53
53
|
</div>
|
54
54
|
</div>
|
55
55
|
<% end %>
|
@@ -105,11 +105,27 @@
|
|
105
105
|
<% end %>
|
106
106
|
|
107
107
|
<div class="form-actions">
|
108
|
-
<%= f.submit nil, :class =>
|
109
|
-
<%= link_to
|
110
|
-
<%= link_to
|
111
|
-
|
108
|
+
<%= f.submit nil, :class => "btn btn-primary" %>
|
109
|
+
<%= link_to "Invite", invite_user_path(@user), :method => "post", :class => "btn btn-primary" if @user.persisted? && @user.encrypted_password.blank? && !@user.invited? && can?(:create, User) %>
|
110
|
+
<%= link_to "Cancel", users_path, :class => "btn" %>
|
111
|
+
|
112
|
+
<% if @user.persisted? && can?(:destroy, @user) %>
|
113
|
+
<button class="btn btn-delete btn-danger" id="retire_user_button">Retire</button>
|
114
|
+
<% end %>
|
112
115
|
</div>
|
113
116
|
|
114
117
|
</fieldset>
|
115
118
|
<% end %>
|
119
|
+
|
120
|
+
<% content_for :javascripts do %>
|
121
|
+
<script type="text/javascript">
|
122
|
+
$(function() {
|
123
|
+
$('#retire_user_button').click(function(e) {
|
124
|
+
e.preventDefault();
|
125
|
+
$.destroy('<%= user_path(@user) %>')
|
126
|
+
.success(function() { window.location = '/users'; })
|
127
|
+
.error(function() { console.log(arguments); });
|
128
|
+
});
|
129
|
+
});
|
130
|
+
</script>
|
131
|
+
<% end %>
|
data/config/application.rb
CHANGED
@@ -82,8 +82,20 @@ module Houston
|
|
82
82
|
# Automatically compress responses that accept gzip encoding
|
83
83
|
config.middleware.use Rack::Deflater
|
84
84
|
|
85
|
+
# Support the oEmbed protocol
|
86
|
+
require "rack/oembed"
|
87
|
+
config.middleware.use Rack::Oembed, path: "oembed/1.0"
|
88
|
+
|
85
89
|
# Respond with a 400 when requests are malformed
|
86
90
|
# http://stackoverflow.com/a/24727310/731300
|
87
91
|
config.middleware.insert 0, Rack::UTF8Sanitizer
|
92
|
+
|
93
|
+
# DEPRECATION WARNING: Currently, Active Record suppresses errors raised within
|
94
|
+
# `after_rollback`/`after_commit` callbacks and only print them to the logs.
|
95
|
+
# In the next version, these errors will no longer be suppressed. Instead, the
|
96
|
+
# errors will propagate normally just like in other Active Record callbacks.
|
97
|
+
#
|
98
|
+
# You can opt into the new behavior and remove this warning by setting:
|
99
|
+
config.active_record.raise_in_transactional_callbacks = true
|
88
100
|
end
|
89
101
|
end
|
data/config/routes.rb
CHANGED
@@ -73,6 +73,9 @@ Rails.application.routes.draw do
|
|
73
73
|
post "deploy/:environment", to: "deploys#create"
|
74
74
|
end
|
75
75
|
|
76
|
+
get "projects/new/github", to: "projects#new_from_github", as: :add_github_projects
|
77
|
+
post "projects/new/github", to: "projects#create_from_github"
|
78
|
+
|
76
79
|
|
77
80
|
|
78
81
|
# Web Hooks
|
@@ -92,12 +95,21 @@ Rails.application.routes.draw do
|
|
92
95
|
# Releases
|
93
96
|
|
94
97
|
scope "projects/:project_id" do
|
95
|
-
get "releases", to: "releases#index"
|
98
|
+
get "releases", to: "releases#index", as: :releases
|
99
|
+
|
96
100
|
scope "environments/:environment" do
|
97
|
-
|
101
|
+
get "releases", to: "releases#index"
|
102
|
+
post "releases", to: "releases#create"
|
103
|
+
get "releases/new", to: "releases#new", as: :new_release
|
104
|
+
get "releases/:id", to: "releases#show"
|
98
105
|
end
|
99
106
|
end
|
100
107
|
|
108
|
+
get "releases/:id", to: "releases#show", as: :release
|
109
|
+
get "releases/:id/edit", to: "releases#edit", as: :edit_release
|
110
|
+
put "releases/:id", to: "releases#update"
|
111
|
+
delete "releases/:id", to: "releases#destroy"
|
112
|
+
|
101
113
|
|
102
114
|
|
103
115
|
# Teammates
|
@@ -173,7 +185,7 @@ Rails.application.routes.draw do
|
|
173
185
|
get "commits", to: "commits#self"
|
174
186
|
end
|
175
187
|
|
176
|
-
get "commits/:sha", to: "commits#show"
|
188
|
+
get "commits/:sha", to: "commits#show", as: :commit
|
177
189
|
|
178
190
|
namespace "api" do
|
179
191
|
namespace "v1" do
|
@@ -248,6 +260,8 @@ Rails.application.routes.draw do
|
|
248
260
|
|
249
261
|
get "sprint/reports", to: "reports#sprint"
|
250
262
|
|
263
|
+
get "pulls", to: "github/pulls#index"
|
264
|
+
|
251
265
|
# Tester Bar
|
252
266
|
match "tester_bar/:action", :controller => "tester_bar", via: [:get, :post] if Rails.env.development?
|
253
267
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "progressbar"
|
2
|
+
|
3
|
+
class AddHeadShaToProjects < ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
add_column :projects, :head_sha, :string
|
6
|
+
|
7
|
+
projects = Project.unretired
|
8
|
+
pbar = ProgressBar.new "projects", projects.count
|
9
|
+
|
10
|
+
projects.find_each do |project|
|
11
|
+
pbar.inc
|
12
|
+
next unless project.repo.exists?
|
13
|
+
|
14
|
+
sha = project.repo.branch("master")
|
15
|
+
project.update_column :head_sha, sha
|
16
|
+
end
|
17
|
+
|
18
|
+
pbar.finish
|
19
|
+
end
|
20
|
+
|
21
|
+
def down
|
22
|
+
remove_column :projects, :head_sha
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class RequireProjectsToHaveColor < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
execute "UPDATE projects SET color='default' WHERE color IS NULL"
|
4
|
+
change_column_default :projects, :color, "default"
|
5
|
+
change_column_null :projects, :color, false
|
6
|
+
end
|
7
|
+
|
8
|
+
def down
|
9
|
+
change_column_null :projects, :color, true
|
10
|
+
change_column_default :projects, :color, nil
|
11
|
+
execute "UPDATE projects SET color=NULL WHERE color='default'"
|
12
|
+
end
|
13
|
+
end
|
data/db/structure.sql
CHANGED
@@ -365,11 +365,11 @@ ALTER SEQUENCE project_quotas_id_seq OWNED BY project_quotas.id;
|
|
365
365
|
|
366
366
|
CREATE TABLE projects (
|
367
367
|
id integer NOT NULL,
|
368
|
-
name character varying(255),
|
369
|
-
slug character varying(255),
|
368
|
+
name character varying(255) NOT NULL,
|
369
|
+
slug character varying(255) NOT NULL,
|
370
370
|
created_at timestamp without time zone,
|
371
371
|
updated_at timestamp without time zone,
|
372
|
-
color character varying(255),
|
372
|
+
color character varying(255) DEFAULT 'default'::character varying NOT NULL,
|
373
373
|
retired_at timestamp without time zone,
|
374
374
|
category character varying(255),
|
375
375
|
version_control_name character varying(255) DEFAULT 'None'::character varying NOT NULL,
|
@@ -384,7 +384,8 @@ CREATE TABLE projects (
|
|
384
384
|
view_options hstore DEFAULT ''::hstore NOT NULL,
|
385
385
|
gemnasium_slug character varying(255),
|
386
386
|
feature_states hstore DEFAULT ''::hstore NOT NULL,
|
387
|
-
selected_features text[]
|
387
|
+
selected_features text[],
|
388
|
+
head_sha character varying(255)
|
388
389
|
);
|
389
390
|
|
390
391
|
|
@@ -427,7 +428,11 @@ CREATE TABLE pull_requests (
|
|
427
428
|
old_labels text DEFAULT ''::text NOT NULL,
|
428
429
|
labels text[] DEFAULT '{}'::text[],
|
429
430
|
body text,
|
430
|
-
props jsonb DEFAULT '{}'::jsonb
|
431
|
+
props jsonb DEFAULT '{}'::jsonb,
|
432
|
+
avatar_url character varying(255),
|
433
|
+
json_labels jsonb DEFAULT '[]'::jsonb,
|
434
|
+
created_at timestamp without time zone,
|
435
|
+
updated_at timestamp without time zone
|
431
436
|
);
|
432
437
|
|
433
438
|
|
@@ -1631,6 +1636,13 @@ CREATE UNIQUE INDEX index_project_quotas_on_project_id_and_week ON project_quota
|
|
1631
1636
|
CREATE INDEX index_project_quotas_on_week ON project_quotas USING btree (week);
|
1632
1637
|
|
1633
1638
|
|
1639
|
+
--
|
1640
|
+
-- Name: index_projects_on_slug; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
1641
|
+
--
|
1642
|
+
|
1643
|
+
CREATE UNIQUE INDEX index_projects_on_slug ON projects USING btree (slug);
|
1644
|
+
|
1645
|
+
|
1634
1646
|
--
|
1635
1647
|
-- Name: index_pull_requests_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
1636
1648
|
--
|
@@ -2289,3 +2301,17 @@ INSERT INTO schema_migrations (version) VALUES ('20151108223154');
|
|
2289
2301
|
|
2290
2302
|
INSERT INTO schema_migrations (version) VALUES ('20151108233510');
|
2291
2303
|
|
2304
|
+
INSERT INTO schema_migrations (version) VALUES ('20151201042126');
|
2305
|
+
|
2306
|
+
INSERT INTO schema_migrations (version) VALUES ('20151202005557');
|
2307
|
+
|
2308
|
+
INSERT INTO schema_migrations (version) VALUES ('20151202011812');
|
2309
|
+
|
2310
|
+
INSERT INTO schema_migrations (version) VALUES ('20151205204922');
|
2311
|
+
|
2312
|
+
INSERT INTO schema_migrations (version) VALUES ('20151205214647');
|
2313
|
+
|
2314
|
+
INSERT INTO schema_migrations (version) VALUES ('20151209004458');
|
2315
|
+
|
2316
|
+
INSERT INTO schema_migrations (version) VALUES ('20151209030113');
|
2317
|
+
|
data/houston.gemspec
CHANGED
@@ -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.
|
23
|
+
spec.add_dependency "rails", "~> 4.2.5"
|
24
24
|
spec.add_dependency "sprockets", "~> 2.8" # update this when updating Rails
|
25
25
|
spec.add_dependency "pg", "~> 0.18.3"
|
26
26
|
# --------------------------------
|
@@ -29,9 +29,9 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_dependency "addressable"
|
30
30
|
spec.add_dependency "browser"
|
31
31
|
spec.add_dependency "cancan", "~> 1.6.10"
|
32
|
-
spec.add_dependency "default_value_for", "3.0.
|
33
|
-
spec.add_dependency "devise", "~> 3.
|
34
|
-
spec.add_dependency "devise_invitable", "~> 1.
|
32
|
+
spec.add_dependency "default_value_for", "3.0.1"
|
33
|
+
spec.add_dependency "devise", "~> 3.5.0"
|
34
|
+
spec.add_dependency "devise_invitable", "~> 1.5.3"
|
35
35
|
spec.add_dependency "houston-devise_ldap_authenticatable"
|
36
36
|
spec.add_dependency "faraday", "~> 0.8.10"
|
37
37
|
spec.add_dependency "faraday-http-cache", "~> 1.2.2"
|
@@ -55,9 +55,9 @@ Gem::Specification.new do |spec|
|
|
55
55
|
spec.add_dependency "houston-vestal_versions"
|
56
56
|
|
57
57
|
# The Asset Pipeline
|
58
|
-
spec.add_dependency "sass-rails", "~>
|
59
|
-
spec.add_dependency "uglifier", ">=
|
60
|
-
spec.add_dependency "coffee-rails", "~> 4.
|
58
|
+
spec.add_dependency "sass-rails", "~> 5.0"
|
59
|
+
spec.add_dependency "uglifier", ">= 2.7.2"
|
60
|
+
spec.add_dependency "coffee-rails", "~> 4.1.0"
|
61
61
|
|
62
62
|
# Houston's background jobs daemon
|
63
63
|
spec.add_dependency "rufus-scheduler", "~> 3.1.7"
|
data/lib/configuration.rb
CHANGED
@@ -187,7 +187,7 @@ module Houston
|
|
187
187
|
|
188
188
|
def project_colors(*args)
|
189
189
|
@project_colors = args.first.each_with_object({}) { |(key, hex), hash| hash[key] = ColorValue.new(hex) } if args.any?
|
190
|
-
@project_colors ||=
|
190
|
+
@project_colors ||= {}
|
191
191
|
end
|
192
192
|
|
193
193
|
def environments(*args)
|
@@ -264,7 +264,7 @@ module Houston
|
|
264
264
|
# :timeoutable,
|
265
265
|
# :omniauthable
|
266
266
|
|
267
|
-
configuration = [:database_authenticatable
|
267
|
+
configuration = [:database_authenticatable]
|
268
268
|
unless Rails.env.test? # <-- !todo: control when custom strategies are employed in the test suite
|
269
269
|
configuration << :ldap_authenticatable if authentication_strategy == :ldap
|
270
270
|
end
|
@@ -655,6 +655,7 @@ module Houston
|
|
655
655
|
Faraday::HTTP::ServerError,
|
656
656
|
Rugged::NetworkError,
|
657
657
|
Unfuddle::ConnectionError,
|
658
|
+
Octokit::BadGateway,
|
658
659
|
exceptions_wrapping(PG::ConnectionBad)
|
659
660
|
Rails.logger.error "\e[31m[#{tag}] #{$!.class}: #{$!.message} [ignored]\e[0m"
|
660
661
|
rescue Exception # rescues StandardError by default; but we want to rescue and report all errors
|
data/lib/houston/version.rb
CHANGED
data/lib/rack/oembed.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Rack
|
2
|
+
class Oembed
|
3
|
+
attr_reader :app, :oembed_path
|
4
|
+
|
5
|
+
def initialize(app, options={})
|
6
|
+
@app = app
|
7
|
+
@oembed_path = options.fetch :path
|
8
|
+
@oembed_path = "/#{oembed_path}" unless oembed_path.starts_with? "/"
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
if env["REQUEST_METHOD"] == "GET" && env["PATH_INFO"] == oembed_path
|
13
|
+
url = Rack::Request.new(env).params.fetch("url")
|
14
|
+
path = Addressable::URI.parse(url).path
|
15
|
+
env["PATH_INFO"] = path
|
16
|
+
env["HTTP_ACCEPT"] = "application/json+oembed"
|
17
|
+
end
|
18
|
+
|
19
|
+
app.call(env)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -17,10 +17,7 @@ Houston.config do
|
|
17
17
|
|
18
18
|
project_channel = "##{test_run.project.slug}"
|
19
19
|
channels = [project_channel] if Houston::Slack.connection.channels.include? project_channel
|
20
|
-
channels ||= test_run.commit.committers
|
21
|
-
.pluck(:email)
|
22
|
-
.map { |email| SLACK_USERNAME_FOR_USER[email] }
|
23
|
-
.reject(&:nil?)
|
20
|
+
channels ||= test_run.commit.committers.map(&:slack_username)
|
24
21
|
channels = %w{general} if Array(channel).empty?
|
25
22
|
|
26
23
|
channels.each do |channel|
|