Commit 01732b54bd88819ed110c817730ac7c23a2393a4
1 parent
d138bf33
Exists in
master
and in
1 other branch
updating repo
Showing
7 changed files
with
40 additions
and
64 deletions
Show diff stats
app/helpers/apps_helper.rb
| ... | ... | @@ -16,6 +16,11 @@ module AppsHelper |
| 16 | 16 | @any_github_repos |
| 17 | 17 | end |
| 18 | 18 | |
| 19 | + def any_bitbucket_repos? | |
| 20 | + detect_any_apps_with_attributes unless @any_bitbucket_repos | |
| 21 | + @any_bitbucket_repos | |
| 22 | + end | |
| 23 | + | |
| 19 | 24 | def any_issue_trackers? |
| 20 | 25 | detect_any_apps_with_attributes unless @any_issue_trackers |
| 21 | 26 | @any_issue_trackers |
| ... | ... | @@ -29,9 +34,10 @@ module AppsHelper |
| 29 | 34 | private |
| 30 | 35 | |
| 31 | 36 | def detect_any_apps_with_attributes |
| 32 | - @any_github_repos = @any_issue_trackers = @any_deploys = false | |
| 37 | + @any_github_repos = @any_issue_trackers = @any_deploys = @any_bitbucket_repos = false | |
| 33 | 38 | @apps.each do |app| |
| 34 | 39 | @any_github_repos ||= app.github_repo? |
| 40 | + @any_bitbucket_repos ||= app.bitbucket_repo? | |
| 35 | 41 | @any_issue_trackers ||= app.issue_tracker_configured? |
| 36 | 42 | @any_deploys ||= !!app.last_deploy_at |
| 37 | 43 | end | ... | ... |
app/helpers/notices_helper.rb
| ... | ... | @@ -12,6 +12,7 @@ module NoticesHelper |
| 12 | 12 | text = capture_haml(&block) |
| 13 | 13 | if in_app_backtrace_line?(line) |
| 14 | 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 | 16 | if app.issue_tracker && app.issue_tracker.respond_to?(:url_to_file) |
| 16 | 17 | # Return link to file on tracker if issue tracker supports this |
| 17 | 18 | return link_to_issue_tracker_file(app, line, text) |
| ... | ... | @@ -30,6 +31,12 @@ module NoticesHelper |
| 30 | 31 | link_to(text || file_name, href, :target => '_blank') |
| 31 | 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#L%s" % [app.bitbucket_url_to_file(file_path), line['number']] | |
| 37 | + link_to(text || file_name, href, :target => '_blank') | |
| 38 | + end | |
| 39 | + | |
| 33 | 40 | def link_to_issue_tracker_file(app, line, text = nil) |
| 34 | 41 | file_name, file_path = filepath_parts(line['file']) |
| 35 | 42 | href = app.issue_tracker.url_to_file(file_path, line['number']) | ... | ... |
app/models/app.rb
| ... | ... | @@ -5,6 +5,7 @@ class App |
| 5 | 5 | field :name, :type => String |
| 6 | 6 | field :api_key |
| 7 | 7 | field :github_repo |
| 8 | + field :bitbucket_repo | |
| 8 | 9 | field :resolve_errs_on_deploy, :type => Boolean, :default => false |
| 9 | 10 | field :notify_all_users, :type => Boolean, :default => false |
| 10 | 11 | field :notify_on_errs, :type => Boolean, :default => true |
| ... | ... | @@ -116,6 +117,18 @@ class App |
| 116 | 117 | "#{github_url}/blob/master#{file}" |
| 117 | 118 | end |
| 118 | 119 | |
| 120 | + def bitbucket_repo? | |
| 121 | + self.bitbucket_repo.present? | |
| 122 | + end | |
| 123 | + | |
| 124 | + def bitbucket_url | |
| 125 | + "https://bitbucket.org/#{bitbucket_repo}" if bitbucket_repo? | |
| 126 | + end | |
| 127 | + | |
| 128 | + def bitbucket_url_to_file(file) | |
| 129 | + "#{bitbucket_url}/src/master#{file}" | |
| 130 | + end | |
| 131 | + | |
| 119 | 132 | |
| 120 | 133 | def issue_tracker_configured? |
| 121 | 134 | !!(issue_tracker && issue_tracker.class < IssueTracker && issue_tracker.project_id.present?) | ... | ... |
app/views/apps/_fields.html.haml
| ... | ... | @@ -7,6 +7,9 @@ |
| 7 | 7 | %div |
| 8 | 8 | = f.label :github_repo |
| 9 | 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 | 14 | %fieldset |
| 12 | 15 | %legend Notifications | ... | ... |
app/views/apps/index.html.haml
| ... | ... | @@ -8,6 +8,8 @@ |
| 8 | 8 | %th Name |
| 9 | 9 | - if any_github_repos? |
| 10 | 10 | %th GitHub Repo |
| 11 | + - if any_bitbucket_repos? | |
| 12 | + %th Bitbucket Repo | |
| 11 | 13 | - if any_issue_trackers? |
| 12 | 14 | %th Tracker |
| 13 | 15 | - if any_deploys? |
| ... | ... | @@ -21,6 +23,10 @@ |
| 21 | 23 | %td.github_repo |
| 22 | 24 | - if app.github_repo? |
| 23 | 25 | = link_to(app.github_repo, app.github_url, :target => '_blank') |
| 26 | + - if any_bitbucket_repos? | |
| 27 | + %td.github_repo | |
| 28 | + - if app.bitbucket_repo? | |
| 29 | + = link_to(app.bitbucket_repo, app.bitbucket_url, :target => '_blank') | |
| 24 | 30 | - if any_issue_trackers? |
| 25 | 31 | %td.issue_tracker |
| 26 | 32 | - if app.issue_tracker_configured? | ... | ... |
config/config.yml
| ... | ... | @@ -1,63 +0,0 @@ |
| 1 | -# Errbit Config | |
| 2 | -# ============= | |
| 3 | -# | |
| 4 | -# Copy this file to config/config.yml and | |
| 5 | -# modify it accordingly. This file will automatically | |
| 6 | -# be copied to shared/config on the server when | |
| 7 | -# `cap deploy:setup` is ran the first time. Be sure | |
| 8 | -# to place production specific settings there | |
| 9 | -# You will need to restart the server after changing any settings. | |
| 10 | - | |
| 11 | -# The host of your errbit server | |
| 12 | -host: errbit.quick-tips.net | |
| 13 | - | |
| 14 | -# Enforce SSL connections | |
| 15 | -enforce_ssl: false | |
| 16 | - | |
| 17 | -# The email address which email notifications | |
| 18 | -# will be sent from. | |
| 19 | -email_from: errbit@errbit.quick-tips.net | |
| 20 | - | |
| 21 | -# If you turn on this option, email_at_notices can be | |
| 22 | -# configured on a per app basis, at the App edit page | |
| 23 | -per_app_email_at_notices: false | |
| 24 | - | |
| 25 | -# Configure when emails are sent for an error. | |
| 26 | -# [1,3,7] = 1st, 3rd, and 7th occurence triggers | |
| 27 | -# an email notification. | |
| 28 | -email_at_notices: [1, 10, 100] | |
| 29 | - | |
| 30 | -# Configure whether or not the user should be prompted before resolving an error. | |
| 31 | -confirm_resolve_err: false | |
| 32 | - | |
| 33 | -# Add an optional 'username' field to Users. | |
| 34 | -# Helpful when you need to plug in a custom authentication strategy, such as LDAP. | |
| 35 | -user_has_username: false | |
| 36 | - | |
| 37 | -# Allow comments while an issue tracker is configured. | |
| 38 | -# This is useful if the err is not critical enough to create a ticket, | |
| 39 | -# but you want to leave a short comment. | |
| 40 | -allow_comments_with_issue_tracker: true | |
| 41 | - | |
| 42 | -# Setup your deploy options | |
| 43 | -# deployment: | |
| 44 | -# hosts: | |
| 45 | -# web: errbit.example.com | |
| 46 | -# app: errbit.example.com | |
| 47 | -# db: errbit.example.com | |
| 48 | -# repository: http://github.com/errbit/errbit.git | |
| 49 | -# user: deploy | |
| 50 | -# deploy_to: /var/www/apps/errbit | |
| 51 | - | |
| 52 | -# Configure SMTP settings. If you are running Errbit on Heroku, | |
| 53 | -# sendgrid will be configured by default. | |
| 54 | -# ------------------------------------------------------------------------ | |
| 55 | -#smtp_settings: | |
| 56 | -# :address: ADDRESS | |
| 57 | -# :domain: DOMAIN | |
| 58 | -# :port: "25" | |
| 59 | -# :authentication: :plain, :login, :cram_md5 | |
| 60 | -# :enable_starttls_auto: true | |
| 61 | -# :user_name: USERNAME | |
| 62 | -# :password: PASSWORD | |
| 63 | - |