From 01732b54bd88819ed110c817730ac7c23a2393a4 Mon Sep 17 00:00:00 2001 From: Shuky Dvir Date: Tue, 11 Sep 2012 00:02:09 +0300 Subject: [PATCH] updating repo --- app/helpers/apps_helper.rb | 8 +++++++- app/helpers/notices_helper.rb | 7 +++++++ app/models/app.rb | 13 +++++++++++++ app/views/apps/_fields.html.haml | 3 +++ app/views/apps/index.html.haml | 6 ++++++ config/config.yml | 63 --------------------------------------------------------------- config/mongoid.yml | 4 ++++ 7 files changed, 40 insertions(+), 64 deletions(-) delete mode 100644 config/config.yml diff --git a/app/helpers/apps_helper.rb b/app/helpers/apps_helper.rb index c9ed6d2..ab17d25 100644 --- a/app/helpers/apps_helper.rb +++ b/app/helpers/apps_helper.rb @@ -16,6 +16,11 @@ module AppsHelper @any_github_repos end + def any_bitbucket_repos? + detect_any_apps_with_attributes unless @any_bitbucket_repos + @any_bitbucket_repos + end + def any_issue_trackers? detect_any_apps_with_attributes unless @any_issue_trackers @any_issue_trackers @@ -29,9 +34,10 @@ module AppsHelper private def detect_any_apps_with_attributes - @any_github_repos = @any_issue_trackers = @any_deploys = false + @any_github_repos = @any_issue_trackers = @any_deploys = @any_bitbucket_repos = false @apps.each do |app| @any_github_repos ||= app.github_repo? + @any_bitbucket_repos ||= app.bitbucket_repo? @any_issue_trackers ||= app.issue_tracker_configured? @any_deploys ||= !!app.last_deploy_at end diff --git a/app/helpers/notices_helper.rb b/app/helpers/notices_helper.rb index 1c2e8f8..5240f5f 100644 --- a/app/helpers/notices_helper.rb +++ b/app/helpers/notices_helper.rb @@ -12,6 +12,7 @@ module NoticesHelper text = capture_haml(&block) if in_app_backtrace_line?(line) return link_to_github(app, line, text) if app.github_repo? + return link_to_bitbucket(app, line, text) if app.bitbucket_repo? if app.issue_tracker && app.issue_tracker.respond_to?(:url_to_file) # Return link to file on tracker if issue tracker supports this return link_to_issue_tracker_file(app, line, text) @@ -30,6 +31,12 @@ module NoticesHelper link_to(text || file_name, href, :target => '_blank') end + def link_to_bitbucket(app, line, text = nil) + file_name, file_path = filepath_parts(line['file']) + href = "%s#L%s" % [app.bitbucket_url_to_file(file_path), line['number']] + link_to(text || file_name, href, :target => '_blank') + end + def link_to_issue_tracker_file(app, line, text = nil) file_name, file_path = filepath_parts(line['file']) href = app.issue_tracker.url_to_file(file_path, line['number']) diff --git a/app/models/app.rb b/app/models/app.rb index b87f7d8..bce2d1d 100644 --- a/app/models/app.rb +++ b/app/models/app.rb @@ -5,6 +5,7 @@ class App field :name, :type => String field :api_key field :github_repo + field :bitbucket_repo field :resolve_errs_on_deploy, :type => Boolean, :default => false field :notify_all_users, :type => Boolean, :default => false field :notify_on_errs, :type => Boolean, :default => true @@ -116,6 +117,18 @@ class App "#{github_url}/blob/master#{file}" end + def bitbucket_repo? + self.bitbucket_repo.present? + end + + def bitbucket_url + "https://bitbucket.org/#{bitbucket_repo}" if bitbucket_repo? + end + + def bitbucket_url_to_file(file) + "#{bitbucket_url}/src/master#{file}" + end + def issue_tracker_configured? !!(issue_tracker && issue_tracker.class < IssueTracker && issue_tracker.project_id.present?) diff --git a/app/views/apps/_fields.html.haml b/app/views/apps/_fields.html.haml index 0dd8a33..d50c545 100644 --- a/app/views/apps/_fields.html.haml +++ b/app/views/apps/_fields.html.haml @@ -7,6 +7,9 @@ %div = f.label :github_repo = f.text_field :github_repo, :placeholder => "errbit/errbit from https://github.com/errbit/errbit" +%div + = f.label :bitbucket_repo + = f.text_field :bitbucket_repo, :placeholder => "errbit/errbit from https://bitbucket.org/errbit/errbit" %fieldset %legend Notifications diff --git a/app/views/apps/index.html.haml b/app/views/apps/index.html.haml index fb7ab76..13cc749 100644 --- a/app/views/apps/index.html.haml +++ b/app/views/apps/index.html.haml @@ -8,6 +8,8 @@ %th Name - if any_github_repos? %th GitHub Repo + - if any_bitbucket_repos? + %th Bitbucket Repo - if any_issue_trackers? %th Tracker - if any_deploys? @@ -21,6 +23,10 @@ %td.github_repo - if app.github_repo? = link_to(app.github_repo, app.github_url, :target => '_blank') + - if any_bitbucket_repos? + %td.github_repo + - if app.bitbucket_repo? + = link_to(app.bitbucket_repo, app.bitbucket_url, :target => '_blank') - if any_issue_trackers? %td.issue_tracker - if app.issue_tracker_configured? diff --git a/config/config.yml b/config/config.yml deleted file mode 100644 index edede80..0000000 --- a/config/config.yml +++ /dev/null @@ -1,63 +0,0 @@ -# Errbit Config -# ============= -# -# Copy this file to config/config.yml and -# modify it accordingly. This file will automatically -# be copied to shared/config on the server when -# `cap deploy:setup` is ran the first time. Be sure -# to place production specific settings there -# You will need to restart the server after changing any settings. - -# The host of your errbit server -host: errbit.quick-tips.net - -# Enforce SSL connections -enforce_ssl: false - -# The email address which email notifications -# will be sent from. -email_from: errbit@errbit.quick-tips.net - -# If you turn on this option, email_at_notices can be -# configured on a per app basis, at the App edit page -per_app_email_at_notices: false - -# Configure when emails are sent for an error. -# [1,3,7] = 1st, 3rd, and 7th occurence triggers -# an email notification. -email_at_notices: [1, 10, 100] - -# Configure whether or not the user should be prompted before resolving an error. -confirm_resolve_err: false - -# Add an optional 'username' field to Users. -# Helpful when you need to plug in a custom authentication strategy, such as LDAP. -user_has_username: false - -# Allow comments while an issue tracker is configured. -# This is useful if the err is not critical enough to create a ticket, -# but you want to leave a short comment. -allow_comments_with_issue_tracker: true - -# Setup your deploy options -# deployment: -# hosts: -# web: errbit.example.com -# app: errbit.example.com -# db: errbit.example.com -# repository: http://github.com/errbit/errbit.git -# user: deploy -# deploy_to: /var/www/apps/errbit - -# Configure SMTP settings. If you are running Errbit on Heroku, -# sendgrid will be configured by default. -# ------------------------------------------------------------------------ -#smtp_settings: -# :address: ADDRESS -# :domain: DOMAIN -# :port: "25" -# :authentication: :plain, :login, :cram_md5 -# :enable_starttls_auto: true -# :user_name: USERNAME -# :password: PASSWORD - diff --git a/config/mongoid.yml b/config/mongoid.yml index aab95f2..6651480 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -6,3 +6,7 @@ production: uri: <%= ENV['MONGOHQ_URL'] %> + +development: + host: localhost + database: errbit_development -- libgit2 0.21.2