From ae54c66cb8e19bcd9e548f14e79ee1df3c95372a Mon Sep 17 00:00:00 2001 From: Julio Monteiro Date: Wed, 22 Aug 2012 21:03:38 -0300 Subject: [PATCH 01/12] Added capistrano to the mix --- Gemfile | 1 + Gemfile.lock | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Gemfile b/Gemfile index a6d9363a9..afa5c4ab1 100644 --- a/Gemfile +++ b/Gemfile @@ -49,6 +49,7 @@ group :development, :test do end # gem 'rpm_contrib' # gem 'newrelic_rpm' + gem 'capistrano' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index cbf5e0bdd..2bf4d134c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -40,6 +40,12 @@ GEM bson_ext (1.6.2) bson (~> 1.6.2) builder (3.0.0) + capistrano (2.13.3) + highline + net-scp (>= 1.0.0) + net-sftp (>= 2.0.0) + net-ssh (>= 2.0.14) + net-ssh-gateway (>= 1.1.0) capybara (1.1.2) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -86,6 +92,7 @@ GEM libxml-ruby (~> 2.0) has_scope (0.5.1) hashie (1.2.0) + highline (1.6.13) hike (1.2.1) hoptoad_notifier (2.4.11) activesupport @@ -134,6 +141,13 @@ GEM railties (>= 3.0.0) multi_json (1.3.6) multipart-post (1.1.5) + net-scp (1.0.4) + net-ssh (>= 1.99.1) + net-sftp (2.0.5) + net-ssh (>= 2.0.9) + net-ssh (2.5.2) + net-ssh-gateway (1.1.0) + net-ssh (>= 1.99.1) nokogiri (1.5.5) oa-core (0.3.2) oauth2 (0.8.0) @@ -275,6 +289,7 @@ DEPENDENCIES actionmailer_inline_css (~> 1.3.0) bson (= 1.6.2) bson_ext (= 1.6.2) + capistrano capybara database_cleaner (~> 0.6.0) debugger From 717faee79a87868cca4add5dc889fe9edd542d86 Mon Sep 17 00:00:00 2001 From: blackfoks Date: Tue, 28 Aug 2012 14:52:19 +0700 Subject: [PATCH 02/12] Add gravatars to comments --- app/assets/stylesheets/errbit.css | 3 ++ app/helpers/errs_helper.rb | 12 ++++++++ app/views/errs/show.html.haml | 2 ++ spec/helpers/errs_helper_spec.rb | 39 ++++++++++++++++++++++++++ spec/views/errs/show.html.haml_spec.rb | 3 ++ 5 files changed, 59 insertions(+) diff --git a/app/assets/stylesheets/errbit.css b/app/assets/stylesheets/errbit.css index 462384166..46bea7290 100644 --- a/app/assets/stylesheets/errbit.css +++ b/app/assets/stylesheets/errbit.css @@ -841,6 +841,9 @@ table.comment tbody th { height: 20px; line-height: 0.5em; } +table.comment tbody th img { + float: right; +} table.comment tbody td { background-color: #F9F9F9; } diff --git a/app/helpers/errs_helper.rb b/app/helpers/errs_helper.rb index 210fd6409..7cbf79cf3 100644 --- a/app/helpers/errs_helper.rb +++ b/app/helpers/errs_helper.rb @@ -13,5 +13,17 @@ def truncated_err_message(problem) truncate(msg, :length => 300).scan(/.{1,5}/).map { |s| h(s) }.join("​").html_safe end end + + def gravatar_tag(email, options = {}) + default_options = { + :s => Errbit::Config.gravatar_size, + :d => Errbit::Config.gravatar_default, + :alt => email + } + options.reverse_merge! default_options + params = options.extract!(:s, :d).delete_if { |k, v| v.blank? } + email_hash = Digest::MD5.hexdigest(email) + image_tag "http://www.gravatar.com/avatar/#{email_hash}?#{params.to_query}", options + end end diff --git a/app/views/errs/show.html.haml b/app/views/errs/show.html.haml index e07987865..c127e671b 100644 --- a/app/views/errs/show.html.haml +++ b/app/views/errs/show.html.haml @@ -31,6 +31,8 @@ %span= link_to '✘'.html_safe, app_err_comment_path(@app, @problem, comment), :method => :delete, :data => { :confirm => "Are sure you don't need this comment?" }, :class => "destroy-comment" = time_ago_in_words(comment.created_at, true) << " ago by " = link_to comment.user.email, user_path(comment.user) + - if Errbit::Config.use_gravatar + = gravatar_tag comment.user.email %tr %td= comment.body.gsub("\n", "
").html_safe - if Errbit::Config.allow_comments_with_issue_tracker || !@app.issue_tracker_configured? diff --git a/spec/helpers/errs_helper_spec.rb b/spec/helpers/errs_helper_spec.rb index 2eaa92125..3f710845a 100644 --- a/spec/helpers/errs_helper_spec.rb +++ b/spec/helpers/errs_helper_spec.rb @@ -9,4 +9,43 @@ truncated.should_not include('<', '>') end end + + describe "#gravatar_tag" do + let(:email) { "gravatar@example.com" } + let(:email_hash) { Digest::MD5.hexdigest email } + let(:base_url) { "http://www.gravatar.com/avatar/#{email_hash}" } + + context "default config" do + before do + Errbit::Config.stub(:use_gravatar).and_return(true) + Errbit::Config.stub(:gravatar_size).and_return(48) + Errbit::Config.stub(:gravatar_default).and_return('identicon') + end + + it "should render image_tag with correct alt and src" do + expected = "\"#{email}\"" + helper.gravatar_tag(email).should eq(expected) + end + + it "should override :s" do + expected = "\"#{email}\"" + helper.gravatar_tag(email, :s => 64).should eq(expected) + end + + it "should override :d" do + expected = "\"#{email}\"" + helper.gravatar_tag(email, :d => 'retro').should eq(expected) + end + + it "should override alt" do + expected = "\"gravatar\"" + helper.gravatar_tag(email, :alt => 'gravatar').should eq(expected) + end + + it "should pass other options to image_tag" do + expected = "\"#{email}\"" + helper.gravatar_tag(email, :align => :left).should eq(expected) + end + end + end end diff --git a/spec/views/errs/show.html.haml_spec.rb b/spec/views/errs/show.html.haml_spec.rb index 69c4b7386..4f00bcce4 100644 --- a/spec/views/errs/show.html.haml_spec.rb +++ b/spec/views/errs/show.html.haml_spec.rb @@ -90,6 +90,7 @@ def action_bar describe "content_for :comments with comments disabled for configured issue tracker" do before do Errbit::Config.stub(:allow_comments_with_issue_tracker).and_return(false) + Errbit::Config.stub(:use_gravatar).and_return(true) end it 'should display comments and new comment form when no issue tracker' do @@ -99,6 +100,7 @@ def action_bar render view.content_for(:comments).should include('Test comment') + view.content_for(:comments).should have_selector('img[src^="http://www.gravatar.com/avatar"]') view.content_for(:comments).should include('Add a comment') end @@ -117,6 +119,7 @@ def action_bar render view.content_for(:comments).should include('Test comment') + view.content_for(:comments).should have_selector('img[src^="http://www.gravatar.com/avatar"]') view.content_for(:comments).should_not include('Add a comment') end end From b4cea2f93bfb92648ce08c522a427b39a93c3927 Mon Sep 17 00:00:00 2001 From: blackfoks Date: Tue, 28 Aug 2012 14:58:50 +0700 Subject: [PATCH 03/12] Add config example --- config/config.example.yml | 7 +++++++ config/initializers/_load_config.rb | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/config/config.example.yml b/config/config.example.yml index 09286a9c1..1ab3407f2 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -39,6 +39,13 @@ user_has_username: false # but you want to leave a short comment. allow_comments_with_issue_tracker: true +# Enable Gravatar. +use_gravatar: false +# Default Gravatar size. +gravatar_size: 40 +# Default Gravatar image, can be: mm, identicon, monsterid, wavatar, retro. +gravatar_default: identicon + # Setup your deploy options for capistrano. deployment: hosts: diff --git a/config/initializers/_load_config.rb b/config/initializers/_load_config.rb index 30eedcc7c..1fca55e48 100644 --- a/config/initializers/_load_config.rb +++ b/config/initializers/_load_config.rb @@ -14,6 +14,10 @@ Errbit::Config.user_has_username = ENV['ERRBIT_USER_HAS_USERNAME'] Errbit::Config.allow_comments_with_issue_tracker = ENV['ERRBIT_ALLOW_COMMENTS_WITH_ISSUE_TRACKER'] + Errbit::Config.use_gravatar = ENV['ERRBIT_USE_GRAVATAR'] + Errbit::Config.gravatar_size = ENV['ERRBIT_GRAVATAR_SIZE'] + Errbit::Config.gravatar_default = ENV['ERRBIT_GRAVATAR_DEFAULT'] + Errbit::Config.github_authentication = ENV['GITHUB_AUTHENTICATION'] Errbit::Config.github_client_id = ENV['GITHUB_CLIENT_ID'] Errbit::Config.github_secret = ENV['GITHUB_SECRET'] From e7edcb8f8f58ddca0018a125fabd9173b3821b64 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Wed, 29 Aug 2012 11:32:58 +1200 Subject: [PATCH 04/12] Set static gravatar size, made gravatar enabled by default, changed comment design to show delete 'X' at right, and gravatar at left --- app/assets/stylesheets/errbit.css | 16 ++++++++++++++-- app/helpers/errs_helper.rb | 4 ++-- app/views/errs/show.html.haml | 9 +++++---- config/config.example.yml | 4 +--- config/initializers/_load_config.rb | 1 - spec/helpers/errs_helper_spec.rb | 6 ------ 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/assets/stylesheets/errbit.css b/app/assets/stylesheets/errbit.css index 46bea7290..61aff8b87 100644 --- a/app/assets/stylesheets/errbit.css +++ b/app/assets/stylesheets/errbit.css @@ -841,18 +841,30 @@ table.comment tbody th { height: 20px; line-height: 0.5em; } -table.comment tbody th img { - float: right; +table.comment th span, table.comment th img { + vertical-align: middle; +} +table.comment th span.comment-info { + line-height: 21px; } +table.comment img.gravatar { + margin-right: 7px; +} + table.comment tbody td { background-color: #F9F9F9; } #content-comments a.destroy-comment { color: #EE0000; margin-right: 5px; + margin-top: 2px; + font-size: 21px; + line-height: 1; + float: right; } #content-comments a.destroy-comment:hover { text-decoration: none; + color: #AA0000; } #content-comments #comment_submit { margin-top: 15px; diff --git a/app/helpers/errs_helper.rb b/app/helpers/errs_helper.rb index 7cbf79cf3..f6a081388 100644 --- a/app/helpers/errs_helper.rb +++ b/app/helpers/errs_helper.rb @@ -16,9 +16,9 @@ def truncated_err_message(problem) def gravatar_tag(email, options = {}) default_options = { - :s => Errbit::Config.gravatar_size, :d => Errbit::Config.gravatar_default, - :alt => email + :alt => email, + :class => 'gravatar' } options.reverse_merge! default_options params = options.extract!(:s, :d).delete_if { |k, v| v.blank? } diff --git a/app/views/errs/show.html.haml b/app/views/errs/show.html.haml index c127e671b..bb5a5ddfd 100644 --- a/app/views/errs/show.html.haml +++ b/app/views/errs/show.html.haml @@ -28,11 +28,12 @@ %table.comment %tr %th - %span= link_to '✘'.html_safe, app_err_comment_path(@app, @problem, comment), :method => :delete, :data => { :confirm => "Are sure you don't need this comment?" }, :class => "destroy-comment" - = time_ago_in_words(comment.created_at, true) << " ago by " - = link_to comment.user.email, user_path(comment.user) - if Errbit::Config.use_gravatar - = gravatar_tag comment.user.email + = gravatar_tag comment.user.email, :s => 24 + %span.comment-info + = time_ago_in_words(comment.created_at, true) << " ago by " + = link_to comment.user.email, user_path(comment.user) + %span.delete= link_to '✘'.html_safe, app_err_comment_path(@app, @problem, comment), :method => :delete, :data => { :confirm => "Are sure you don't need this comment?" }, :class => "destroy-comment" %tr %td= comment.body.gsub("\n", "
").html_safe - if Errbit::Config.allow_comments_with_issue_tracker || !@app.issue_tracker_configured? diff --git a/config/config.example.yml b/config/config.example.yml index 1ab3407f2..86eb03fe5 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -40,9 +40,7 @@ user_has_username: false allow_comments_with_issue_tracker: true # Enable Gravatar. -use_gravatar: false -# Default Gravatar size. -gravatar_size: 40 +use_gravatar: true # Default Gravatar image, can be: mm, identicon, monsterid, wavatar, retro. gravatar_default: identicon diff --git a/config/initializers/_load_config.rb b/config/initializers/_load_config.rb index 1fca55e48..c92ee0b25 100644 --- a/config/initializers/_load_config.rb +++ b/config/initializers/_load_config.rb @@ -15,7 +15,6 @@ Errbit::Config.allow_comments_with_issue_tracker = ENV['ERRBIT_ALLOW_COMMENTS_WITH_ISSUE_TRACKER'] Errbit::Config.use_gravatar = ENV['ERRBIT_USE_GRAVATAR'] - Errbit::Config.gravatar_size = ENV['ERRBIT_GRAVATAR_SIZE'] Errbit::Config.gravatar_default = ENV['ERRBIT_GRAVATAR_DEFAULT'] Errbit::Config.github_authentication = ENV['GITHUB_AUTHENTICATION'] diff --git a/spec/helpers/errs_helper_spec.rb b/spec/helpers/errs_helper_spec.rb index 3f710845a..1b508bc75 100644 --- a/spec/helpers/errs_helper_spec.rb +++ b/spec/helpers/errs_helper_spec.rb @@ -18,7 +18,6 @@ context "default config" do before do Errbit::Config.stub(:use_gravatar).and_return(true) - Errbit::Config.stub(:gravatar_size).and_return(48) Errbit::Config.stub(:gravatar_default).and_return('identicon') end @@ -27,11 +26,6 @@ helper.gravatar_tag(email).should eq(expected) end - it "should override :s" do - expected = "\"#{email}\"" - helper.gravatar_tag(email, :s => 64).should eq(expected) - end - it "should override :d" do expected = "\"#{email}\"" helper.gravatar_tag(email, :d => 'retro').should eq(expected) From 02130572aa4dfa420d259b8a15cd26c88b538c45 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Wed, 29 Aug 2012 11:53:09 +1200 Subject: [PATCH 05/12] Show gravatar on users index table, and in heading bar of users show page --- app/assets/stylesheets/errbit.css | 9 +++++++++ app/helpers/errs_helper.rb | 8 +++++--- app/views/layouts/application.html.haml | 3 ++- app/views/users/index.html.haml | 6 +++++- app/views/users/show.html.haml | 6 +++++- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/errbit.css b/app/assets/stylesheets/errbit.css index 61aff8b87..a4423f181 100644 --- a/app/assets/stylesheets/errbit.css +++ b/app/assets/stylesheets/errbit.css @@ -893,3 +893,12 @@ table.errs tr td.message .inline_comment em.commenter { .current.asc:after { content: ' ↑'; } .current.desc:after { content: ' ↓'; } + + +table.users td { + vertical-align: middle; +} +table.users td img.gravatar { + vertical-align: middle; + margin-left: 3px; +} diff --git a/app/helpers/errs_helper.rb b/app/helpers/errs_helper.rb index f6a081388..d87a08891 100644 --- a/app/helpers/errs_helper.rb +++ b/app/helpers/errs_helper.rb @@ -15,15 +15,17 @@ def truncated_err_message(problem) end def gravatar_tag(email, options = {}) + image_tag gravatar_url(email, options), :alt => email, :class => 'gravatar' + end + + def gravatar_url(email, options = {}) default_options = { :d => Errbit::Config.gravatar_default, - :alt => email, - :class => 'gravatar' } options.reverse_merge! default_options params = options.extract!(:s, :d).delete_if { |k, v| v.blank? } email_hash = Digest::MD5.hexdigest(email) - image_tag "http://www.gravatar.com/avatar/#{email_hash}?#{params.to_query}", options + "http://www.gravatar.com/avatar/#{email_hash}?#{params.to_query}" end end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 8a6b127ce..a9d5e0fc7 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -18,7 +18,7 @@ = render 'shared/navigation' if current_user = render 'shared/session' #content-wrapper - #content-title{ :class => (yield :title_css_class).to_s } + #content-title{ :class => (yield :title_css_class).to_s, :style => (yield :title_style) } %h1= yield :title %span.meta= yield :meta - if (action_bar = yield(:action_bar)).present? @@ -33,3 +33,4 @@ #footer= "Powered by #{link_to 'Errbit', 'http://github.com/errbit/errbit', :target => '_blank'}: the open source error catcher.".html_safe = yield :scripts += yield :before_title \ No newline at end of file diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index 8f123f440..50102cd8e 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -2,9 +2,11 @@ - content_for :action_bar do %span= link_to('Add a New User', new_user_path, :class => 'add') -%table +%table.users %thead %tr + - if Errbit::Config.use_gravatar + %th %th Name - if Errbit::Config.user_has_username %th Username @@ -13,6 +15,8 @@ %tbody - @users.each do |user| %tr + - if Errbit::Config.use_gravatar + %td= gravatar_tag user.email, :s => 24 %td.nowrap= link_to user.name, user_path(user) - if Errbit::Config.user_has_username %td= user.username diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 5d8f8b57c..ee1e9412e 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -1,11 +1,15 @@ - content_for :title, @user.name +- if Errbit::Config.use_gravatar + - content_for :title_style do + background: url('#{gravatar_url @user.email, :s => 86}') no-repeat; + padding-left: 106px; + - content_for :action_bar do = render 'shared/link_github_account', :user => @user %span= link_to('Add a New User', new_user_path, :class => 'add') = link_to 'edit', edit_user_path(@user), :class => 'button' = link_to 'destroy', user_path(@user), :method => :delete, :data => { :confirm => 'Seriously?' }, :class => 'button' - %table.single_user %tr %th Email From 3a92292df02c113c92eeb0fd9d64e5abe6abfcac Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Wed, 29 Aug 2012 12:10:36 +1200 Subject: [PATCH 06/12] Fixed error helper and user show specs --- spec/helpers/errs_helper_spec.rb | 18 ++++-------------- spec/views/users/show.html.haml_spec.rb | 2 +- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/spec/helpers/errs_helper_spec.rb b/spec/helpers/errs_helper_spec.rb index 1b508bc75..c4b8731f1 100644 --- a/spec/helpers/errs_helper_spec.rb +++ b/spec/helpers/errs_helper_spec.rb @@ -22,23 +22,13 @@ end it "should render image_tag with correct alt and src" do - expected = "\"#{email}\"" - helper.gravatar_tag(email).should eq(expected) + expected = "\"#{email}\"" + helper.gravatar_tag(email, :s => 48).should eq(expected) end it "should override :d" do - expected = "\"#{email}\"" - helper.gravatar_tag(email, :d => 'retro').should eq(expected) - end - - it "should override alt" do - expected = "\"gravatar\"" - helper.gravatar_tag(email, :alt => 'gravatar').should eq(expected) - end - - it "should pass other options to image_tag" do - expected = "\"#{email}\"" - helper.gravatar_tag(email, :align => :left).should eq(expected) + expected = "\"#{email}\"" + helper.gravatar_tag(email, :d => 'retro', :s => 48).should eq(expected) end end end diff --git a/spec/views/users/show.html.haml_spec.rb b/spec/views/users/show.html.haml_spec.rb index 36633b40c..882922ebe 100644 --- a/spec/views/users/show.html.haml_spec.rb +++ b/spec/views/users/show.html.haml_spec.rb @@ -2,7 +2,7 @@ describe 'users/show.html.haml' do let(:user) do - stub_model(User, :created_at => Time.now) + stub_model(User, :created_at => Time.now, :email => "test@example.com") end before do From 8914d5ed494ef209b724e142a404920a43cc6e8f Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Wed, 29 Aug 2012 20:33:04 +0300 Subject: [PATCH 07/12] use ruby hash rockets in migrations closes #235 --- db/migrate/20120530005915_rename_klass_to_error_class.rb | 4 ++-- db/migrate/20120603112130_change_github_url_to_github_repo.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/db/migrate/20120530005915_rename_klass_to_error_class.rb b/db/migrate/20120530005915_rename_klass_to_error_class.rb index 8644ff23b..ceab8a1e0 100644 --- a/db/migrate/20120530005915_rename_klass_to_error_class.rb +++ b/db/migrate/20120530005915_rename_klass_to_error_class.rb @@ -1,13 +1,13 @@ class RenameKlassToErrorClass < Mongoid::Migration def self.up [Problem, Err, Notice].each do |model| - model.collection.update({}, {'$rename' => {'klass' => 'error_class'}}, multi: true, safe: true) + model.collection.update({}, {'$rename' => {'klass' => 'error_class'}}, :multi => true, :safe => true) end end def self.down [Problem, Err, Notice].each do |model| - model.collection.update({}, {'$rename' => {'error_class' => 'klass'}}, multi: true, safe: true) + model.collection.update({}, {'$rename' => {'error_class' => 'klass'}}, :multi => true, :safe => true) end end end diff --git a/db/migrate/20120603112130_change_github_url_to_github_repo.rb b/db/migrate/20120603112130_change_github_url_to_github_repo.rb index 5bda6988d..76b6d87e6 100644 --- a/db/migrate/20120603112130_change_github_url_to_github_repo.rb +++ b/db/migrate/20120603112130_change_github_url_to_github_repo.rb @@ -1,6 +1,6 @@ class ChangeGithubUrlToGithubRepo < Mongoid::Migration def self.up - App.collection.update({}, {'$rename' => {'github_url' => 'github_repo'}}, multi: true, safe: true) + App.collection.update({}, {'$rename' => {'github_url' => 'github_repo'}}, :multi => true, :safe => true) App.all.each do |app| app.send :normalize_github_repo app.save @@ -8,7 +8,7 @@ def self.up end def self.down - App.collection.update({}, {'$rename' => {'github_repo' => 'github_url'}}, multi: true, safe: true) + App.collection.update({}, {'$rename' => {'github_repo' => 'github_url'}}, :multi => true, :safe => true) App.all.each do |app| unless app.github_repo.include?("github.com") app.update_attribute :github_url, "https://github.com/" << app.github_url From 141f6ff8ec242f229e41d82d0e3ef5af4223780a Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Wed, 29 Aug 2012 21:36:23 +0300 Subject: [PATCH 08/12] set Rails logger as Omniauth logger closes #217 --- config/initializers/omniauth.rb | 1 + 1 file changed, 1 insertion(+) create mode 100644 config/initializers/omniauth.rb diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb new file mode 100644 index 000000000..550ccdede --- /dev/null +++ b/config/initializers/omniauth.rb @@ -0,0 +1 @@ +OmniAuth.config.logger = Rails.logger From 1cada7b6b79001346d3deb0d1f97e5917d49bb36 Mon Sep 17 00:00:00 2001 From: Robert Lail Date: Wed, 29 Aug 2012 20:05:51 -0500 Subject: [PATCH 09/12] added a spec to ensure that you can post a notice with the XML in a data param --- spec/controllers/notices_controller_spec.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/spec/controllers/notices_controller_spec.rb b/spec/controllers/notices_controller_spec.rb index fb0d58969..be32eb167 100644 --- a/spec/controllers/notices_controller_spec.rb +++ b/spec/controllers/notices_controller_spec.rb @@ -13,7 +13,7 @@ @notice = App.report_error!(@xml) end - it "generates a notice from xml [POST]" do + it "generates a notice from raw xml [POST]" do App.should_receive(:report_error!).with(@xml).and_return(@notice) request.should_receive(:raw_post).and_return(@xml) post :create, :format => :xml @@ -24,6 +24,16 @@ response.body.should match(%r{]*>(.+)#{locate_path(@notice.id)}}) end + it "generates a notice from xml in a data param [POST]" do + App.should_receive(:report_error!).with(@xml).and_return(@notice) + post :create, :data => @xml, :format => :xml + response.should be_success + # Same RegExp from Airbrake::Sender#send_to_airbrake (https://github.com/airbrake/airbrake/blob/master/lib/airbrake/sender.rb#L53) + # Inspired by https://github.com/airbrake/airbrake/blob/master/test/sender_test.rb + response.body.should match(%r{]*>#{@notice.id}}) + response.body.should match(%r{]*>(.+)#{locate_path(@notice.id)}}) + end + it "generates a notice from xml [GET]" do App.should_receive(:report_error!).with(@xml).and_return(@notice) get :create, :data => @xml, :format => :xml From 8696af0ad51d36822d72b2831f3b3f1920ba7f98 Mon Sep 17 00:00:00 2001 From: Robert Lail Date: Sun, 2 Sep 2012 15:48:10 -0500 Subject: [PATCH 10/12] don't break when running all migrations if using a newer Errbit --- .../20110422152027_move_notices_to_separate_collection.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/migrate/20110422152027_move_notices_to_separate_collection.rb b/db/migrate/20110422152027_move_notices_to_separate_collection.rb index 604531a48..61f4285f5 100644 --- a/db/migrate/20110422152027_move_notices_to_separate_collection.rb +++ b/db/migrate/20110422152027_move_notices_to_separate_collection.rb @@ -5,6 +5,10 @@ def self.up errs = mongo_db.collection("errs").find({ }, :fields => ["notices"]) errs.each do |err| next unless err['notices'] + + # This Err was created after the Problem->Err->Notice redesign + next if err['app_id'].nil? or err['problem_id'] + e = Err.find(err['_id']) # disable email notifications old_notify = e.app.notify_on_errs? From 6e3c8d011ffc2557b26119d3220f56526af62a83 Mon Sep 17 00:00:00 2001 From: Trey Bean Date: Sat, 8 Sep 2012 13:59:46 -0600 Subject: [PATCH 11/12] Add enforce_ssl as a Heroku config option --- config/initializers/_load_config.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/initializers/_load_config.rb b/config/initializers/_load_config.rb index c92ee0b25..b0ca94383 100644 --- a/config/initializers/_load_config.rb +++ b/config/initializers/_load_config.rb @@ -13,6 +13,7 @@ Errbit::Config.confirm_resolve_err = ENV['ERRBIT_CONFIRM_RESOLVE_ERR'] Errbit::Config.user_has_username = ENV['ERRBIT_USER_HAS_USERNAME'] Errbit::Config.allow_comments_with_issue_tracker = ENV['ERRBIT_ALLOW_COMMENTS_WITH_ISSUE_TRACKER'] + Errbit::Config.enforce_ssl = ENV['ERRBIT_ENFORCE_SSL'] Errbit::Config.use_gravatar = ENV['ERRBIT_USE_GRAVATAR'] Errbit::Config.gravatar_default = ENV['ERRBIT_GRAVATAR_DEFAULT'] From fb70eaa00ae842331a47c68fd7f43d2213e1258c Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Mon, 10 Sep 2012 21:26:25 +0300 Subject: [PATCH 12/12] update rails to 3.2.8 --- Gemfile | 2 +- Gemfile.lock | 60 ++++++++++++++++++++++++++-------------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Gemfile b/Gemfile index afa5c4ab1..61fa2842a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'http://rubygems.org' -gem 'rails', '3.2.6' +gem 'rails', '3.2.8' gem 'nokogiri' gem 'mongoid', '~> 2.4.10' diff --git a/Gemfile.lock b/Gemfile.lock index 2bf4d134c..aeaa14129 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,35 +2,35 @@ GEM remote: http://rubygems.org/ specs: SystemTimer (1.2.3) - actionmailer (3.2.6) - actionpack (= 3.2.6) + actionmailer (3.2.8) + actionpack (= 3.2.8) mail (~> 2.4.4) actionmailer_inline_css (1.3.1) actionmailer (>= 3.0.0) nokogiri (>= 1.4.4) premailer (>= 1.7.1) - actionpack (3.2.6) - activemodel (= 3.2.6) - activesupport (= 3.2.6) + actionpack (3.2.8) + activemodel (= 3.2.8) + activesupport (= 3.2.8) builder (~> 3.0.0) erubis (~> 2.7.0) - journey (~> 1.0.1) + journey (~> 1.0.4) rack (~> 1.4.0) rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.1.3) - activemodel (3.2.6) - activesupport (= 3.2.6) + activemodel (3.2.8) + activesupport (= 3.2.8) builder (~> 3.0.0) - activerecord (3.2.6) - activemodel (= 3.2.6) - activesupport (= 3.2.6) + activerecord (3.2.8) + activemodel (= 3.2.8) + activesupport (= 3.2.8) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.6) - activemodel (= 3.2.6) - activesupport (= 3.2.6) - activesupport (3.2.6) + activeresource (3.2.8) + activemodel (= 3.2.8) + activesupport (= 3.2.8) + activesupport (3.2.8) i18n (~> 0.6) multi_json (~> 1.0) addressable (2.3.2) @@ -39,7 +39,7 @@ GEM bson (1.6.2) bson_ext (1.6.2) bson (~> 1.6.2) - builder (3.0.0) + builder (3.0.3) capistrano (2.13.3) highline net-scp (>= 1.0.0) @@ -99,12 +99,12 @@ GEM builder htmlentities (4.3.1) httpauth (0.1) - i18n (0.6.0) + i18n (0.6.1) inherited_resources (1.3.1) has_scope (~> 0.5.0) responders (~> 0.6) journey (1.0.4) - json (1.7.4) + json (1.7.5) jwt (0.1.5) multi_json (>= 1.0) kaminari (0.13.0) @@ -195,19 +195,19 @@ GEM rack-ssl-enforcer (0.2.4) rack-test (0.6.1) rack (>= 1.0) - rails (3.2.6) - actionmailer (= 3.2.6) - actionpack (= 3.2.6) - activerecord (= 3.2.6) - activeresource (= 3.2.6) - activesupport (= 3.2.6) + rails (3.2.8) + actionmailer (= 3.2.8) + actionpack (= 3.2.8) + activerecord (= 3.2.8) + activeresource (= 3.2.8) + activesupport (= 3.2.8) bundler (~> 1.0) - railties (= 3.2.6) + railties (= 3.2.8) rails_autolink (1.0.9) rails (~> 3.1) - railties (3.2.6) - actionpack (= 3.2.6) - activesupport (= 3.2.6) + railties (3.2.8) + actionpack (= 3.2.8) + activesupport (= 3.2.8) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) @@ -258,7 +258,7 @@ GEM daemons (>= 1.0.9) eventmachine (>= 0.12.6) rack (>= 1.0.0) - thor (0.15.4) + thor (0.16.0) tilt (1.3.3) treetop (1.4.10) polyglot @@ -314,7 +314,7 @@ DEPENDENCIES oruen_redmine_client pivotal-tracker rack-ssl-enforcer - rails (= 3.2.6) + rails (= 3.2.8) rails_autolink (~> 1.0.9) ri_cal rspec (~> 2.6)