Commit 4a4ad098fcfc7fdd2176bf19bb2b4435fa9d2f28
Exists in
master
and in
1 other branch
Merge branch 'master' of https://github.com/shukydvir/errbit into shukydvir-master
Conflicts: app/helpers/apps_helper.rb app/views/apps/index.html.haml
Showing
6 changed files
with
38 additions
and
5 deletions
Show diff stats
app/helpers/apps_helper.rb
@@ -21,6 +21,11 @@ module AppsHelper | @@ -21,6 +21,11 @@ module AppsHelper | ||
21 | @any_notification_services | 21 | @any_notification_services |
22 | end | 22 | end |
23 | 23 | ||
24 | + def any_bitbucket_repos? | ||
25 | + detect_any_apps_with_attributes unless @any_bitbucket_repos | ||
26 | + @any_bitbucket_repos | ||
27 | + end | ||
28 | + | ||
24 | def any_issue_trackers? | 29 | def any_issue_trackers? |
25 | detect_any_apps_with_attributes unless @any_issue_trackers | 30 | detect_any_apps_with_attributes unless @any_issue_trackers |
26 | @any_issue_trackers | 31 | @any_issue_trackers |
@@ -34,9 +39,11 @@ module AppsHelper | @@ -34,9 +39,11 @@ module AppsHelper | ||
34 | private | 39 | private |
35 | 40 | ||
36 | def detect_any_apps_with_attributes | 41 | def detect_any_apps_with_attributes |
37 | - @any_github_repos = @any_issue_trackers = @any_deploys = @any_notification_services = false | 42 | + @any_github_repos = @any_issue_trackers = @any_deploys = @any_bitbucket_repos = @any_notification_services = false |
43 | + | ||
38 | @apps.each do |app| | 44 | @apps.each do |app| |
39 | @any_github_repos ||= app.github_repo? | 45 | @any_github_repos ||= app.github_repo? |
46 | + @any_bitbucket_repos ||= app.bitbucket_repo? | ||
40 | @any_issue_trackers ||= app.issue_tracker_configured? | 47 | @any_issue_trackers ||= app.issue_tracker_configured? |
41 | @any_deploys ||= !!app.last_deploy_at | 48 | @any_deploys ||= !!app.last_deploy_at |
42 | @any_notification_services ||= app.notification_service_configured? | 49 | @any_notification_services ||= app.notification_service_configured? |
app/helpers/notices_helper.rb
@@ -12,6 +12,7 @@ module NoticesHelper | @@ -12,6 +12,7 @@ module NoticesHelper | ||
12 | text = capture_haml(&block) | 12 | text = capture_haml(&block) |
13 | if in_app_backtrace_line?(line) | 13 | if in_app_backtrace_line?(line) |
14 | return link_to_github(app, line, text) if app.github_repo? | 14 | return link_to_github(app, line, text) if app.github_repo? |
15 | + return link_to_bitbucket(app, line, text) if app.bitbucket_repo? | ||
15 | if app.issue_tracker && app.issue_tracker.respond_to?(:url_to_file) | 16 | if app.issue_tracker && app.issue_tracker.respond_to?(:url_to_file) |
16 | # Return link to file on tracker if issue tracker supports this | 17 | # Return link to file on tracker if issue tracker supports this |
17 | return link_to_issue_tracker_file(app, line, text) | 18 | return link_to_issue_tracker_file(app, line, text) |
@@ -30,6 +31,12 @@ module NoticesHelper | @@ -30,6 +31,12 @@ module NoticesHelper | ||
30 | link_to(text || file_name, href, :target => '_blank') | 31 | link_to(text || file_name, href, :target => '_blank') |
31 | end | 32 | end |
32 | 33 | ||
34 | + def link_to_bitbucket(app, line, text = nil) | ||
35 | + file_name, file_path = filepath_parts(line['file']) | ||
36 | + href = "%s#cl-%s" % [app.bitbucket_url_to_file(file_path), line['number']] | ||
37 | + link_to(text || file_name, href, :target => '_blank') | ||
38 | + end | ||
39 | + | ||
33 | def link_to_issue_tracker_file(app, line, text = nil) | 40 | def link_to_issue_tracker_file(app, line, text = nil) |
34 | file_name, file_path = filepath_parts(line['file']) | 41 | file_name, file_path = filepath_parts(line['file']) |
35 | href = app.issue_tracker.url_to_file(file_path, line['number']) | 42 | href = app.issue_tracker.url_to_file(file_path, line['number']) |
app/models/app.rb
@@ -5,6 +5,7 @@ class App | @@ -5,6 +5,7 @@ class App | ||
5 | field :name, :type => String | 5 | field :name, :type => String |
6 | field :api_key | 6 | field :api_key |
7 | field :github_repo | 7 | field :github_repo |
8 | + field :bitbucket_repo | ||
8 | field :resolve_errs_on_deploy, :type => Boolean, :default => false | 9 | field :resolve_errs_on_deploy, :type => Boolean, :default => false |
9 | field :notify_all_users, :type => Boolean, :default => false | 10 | field :notify_all_users, :type => Boolean, :default => false |
10 | field :notify_on_errs, :type => Boolean, :default => true | 11 | field :notify_on_errs, :type => Boolean, :default => true |
@@ -118,6 +119,18 @@ class App | @@ -118,6 +119,18 @@ class App | ||
118 | "#{github_url}/blob/master#{file}" | 119 | "#{github_url}/blob/master#{file}" |
119 | end | 120 | end |
120 | 121 | ||
122 | + def bitbucket_repo? | ||
123 | + self.bitbucket_repo.present? | ||
124 | + end | ||
125 | + | ||
126 | + def bitbucket_url | ||
127 | + "https://bitbucket.org/#{bitbucket_repo}" if bitbucket_repo? | ||
128 | + end | ||
129 | + | ||
130 | + def bitbucket_url_to_file(file) | ||
131 | + "#{bitbucket_url}/src/master#{file}" | ||
132 | + end | ||
133 | + | ||
121 | 134 | ||
122 | def issue_tracker_configured? | 135 | def issue_tracker_configured? |
123 | !!(issue_tracker && issue_tracker.class < IssueTracker && issue_tracker.project_id.present?) | 136 | !!(issue_tracker && issue_tracker.class < IssueTracker && issue_tracker.project_id.present?) |
app/views/apps/_fields.html.haml
@@ -7,6 +7,9 @@ | @@ -7,6 +7,9 @@ | ||
7 | %div | 7 | %div |
8 | = f.label :github_repo | 8 | = f.label :github_repo |
9 | = f.text_field :github_repo, :placeholder => "errbit/errbit from https://github.com/errbit/errbit" | 9 | = f.text_field :github_repo, :placeholder => "errbit/errbit from https://github.com/errbit/errbit" |
10 | +%div | ||
11 | + = f.label :bitbucket_repo | ||
12 | + = f.text_field :bitbucket_repo, :placeholder => "errbit/errbit from https://bitbucket.org/errbit/errbit" | ||
10 | 13 | ||
11 | %fieldset | 14 | %fieldset |
12 | %legend Notifications | 15 | %legend Notifications |
app/views/apps/index.html.haml
@@ -6,8 +6,8 @@ | @@ -6,8 +6,8 @@ | ||
6 | %thead | 6 | %thead |
7 | %tr | 7 | %tr |
8 | %th Name | 8 | %th Name |
9 | - - if any_github_repos? | ||
10 | - %th GitHub Repo | 9 | + - if any_github_repos? || any_bitbucket_repos? |
10 | + %th Repository | ||
11 | - if any_notification_services? | 11 | - if any_notification_services? |
12 | %th Notification Service | 12 | %th Notification Service |
13 | - if any_issue_trackers? | 13 | - if any_issue_trackers? |
@@ -19,10 +19,12 @@ | @@ -19,10 +19,12 @@ | ||
19 | - @apps.each do |app| | 19 | - @apps.each do |app| |
20 | %tr | 20 | %tr |
21 | %td.name= link_to app.name, app_path(app) | 21 | %td.name= link_to app.name, app_path(app) |
22 | - - if any_github_repos? | 22 | + - if any_github_repos? or any_bitbucket_repos? |
23 | %td.github_repo | 23 | %td.github_repo |
24 | - if app.github_repo? | 24 | - if app.github_repo? |
25 | = link_to(app.github_repo, app.github_url, :target => '_blank') | 25 | = link_to(app.github_repo, app.github_url, :target => '_blank') |
26 | + - if app.bitbucket_repo? | ||
27 | + = link_to(app.bitbucket_repo, app.bitbucket_url, :target => '_blank') | ||
26 | - if any_notification_services? | 28 | - if any_notification_services? |
27 | %td.notification_service | 29 | %td.notification_service |
28 | - if app.notification_service_configured? | 30 | - if app.notification_service_configured? |
config/unicorn.rb
1 | # http://michaelvanrooijen.com/articles/2011/06/01-more-concurrency-on-a-single-heroku-dyno-with-the-new-celadon-cedar-stack/ | 1 | # http://michaelvanrooijen.com/articles/2011/06/01-more-concurrency-on-a-single-heroku-dyno-with-the-new-celadon-cedar-stack/ |
2 | 2 | ||
3 | worker_processes 3 # amount of unicorn workers to spin up | 3 | worker_processes 3 # amount of unicorn workers to spin up |
4 | -timeout 30 # restarts workers that hang for 30 seconds | ||
5 | \ No newline at end of file | 4 | \ No newline at end of file |
5 | +timeout 30 # restarts workers that hang for 30 seconds | ||
6 | +preload_app true | ||
6 | \ No newline at end of file | 7 | \ No newline at end of file |