Skip to content

Commit

Permalink
Merge branch 'master' into metrics
Browse files Browse the repository at this point in the history
Conflicts:
	lib/airbrake/configuration.rb
	lib/airbrake/railtie.rb
  • Loading branch information
shime committed Jan 21, 2013
2 parents 8e5231e + dbc50e5 commit ada45ed
Show file tree
Hide file tree
Showing 47 changed files with 564 additions and 965 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ pkg

*.rbc
*.plan
gemfiles/*.lock
33 changes: 27 additions & 6 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
appraise "3.0" do
gem "rails", "~> 3.0.17"
appraise "rails-3.0" do
gem "rails", "~> 3.0.19"
gem "airbrake", :path => "../"
end

appraise "3.1" do
gem "rails", "~> 3.1.8"
appraise "rails-3.1" do
gem "rails", "~> 3.1.10"
gem "airbrake", :path => "../"
end

appraise "3.2" do
gem "rails", "~> 3.2.9"
appraise "rails-3.2" do
gem "rails", "~> 3.2.11"
gem "airbrake", :path => "../"
end

# soon
# appraise "rails-edge" do
# gem "rails", :git => "git://github.com/rails/rails.git"
# gem "airbrake", :path => "../"
# end

appraise "sinatra" do
gem "sinatra"
gem "airbrake", :path => "../"
end

appraise "rack" do
gem "rack"
gem "airbrake", :path => "../"
end

appraise "rake" do
gem "rake"
gem "airbrake", :path => "../"
end
11 changes: 4 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ PATH
remote: .
specs:
airbrake (3.1.6)
activesupport
builder
json

GEM
remote: http://rubygems.org/
Expand Down Expand Up @@ -77,6 +79,7 @@ GEM
i18n (0.6.1)
journey (1.0.4)
json (1.7.5)
json-schema (1.0.12)
libwebsocket (0.1.5)
addressable
metaclass (0.0.1)
Expand All @@ -95,8 +98,6 @@ GEM
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-protection (1.2.0)
rack
rack-ssl (1.3.2)
rack
rack-test (0.6.2)
Expand Down Expand Up @@ -137,10 +138,6 @@ GEM
sham_rack (1.3.4)
rack
shoulda (2.11.3)
sinatra (1.3.3)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
Expand All @@ -163,9 +160,9 @@ DEPENDENCIES
cucumber-rails (~> 1.1.1)
fakeweb (~> 1.3.0)
girl_friday
json-schema
nokogiri (~> 1.5.0)
rspec (~> 2.6.0)
rspec-rails
sham_rack (~> 1.3.0)
shoulda (~> 2.11.3)
sinatra
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ See https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt


All other components of this product are
Copyright (c) 2007-2012 Exceptional Software Inc DBA Airbrake.io. All rights reserved.
Copyright (c) 2007-2013 Exceptional Software Inc DBA Airbrake.io. All rights reserved.

Subject to the terms of this notice, Exceptional Software Inc grants you a
nonexclusive, nontransferable license, without the right to
Expand Down
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ That's it!

The generator creates a file under `config/initializers/airbrake.rb` configuring Airbrake with your API key. This file should be checked into your version control system so that it is deployed to your staging and production environments.

The default behaviour of the gem is to only operate in Rails environments that are NOT **development**, **test** & **cucumber**.

You can change this by altering this array:

config.development_environments = ["development", "test", "cucumber", "custom"]

Set it to empty array and it will report errors on all environments.


### Rails 2.x

Add the airbrake gem to your app. In config/environment.rb:
Expand All @@ -52,12 +61,10 @@ every server you deploy to has the gem installed or your application won't start

The generator creates a file under `config/initializers/airbrake.rb` configuring Airbrake with your API key. This file should be checked into your version control system so that it is deployed to your staging and production environments.


Supported Rails versions
Supported frameworks
------------------------

See **[SUPPORTED_RAILS_VERSIONS](https://github.com/airbrake/airbrake/blob/master/SUPPORTED_RAILS_VERSIONS)** for a list of official supported versions of
Rails.
See **[TESTED_AGAINST](https://github.com/airbrake/airbrake/blob/master/TESTED_AGAINST)** for a full list of frameworks and versions we test against.

Airbrake wiki pages
------------------------
Expand All @@ -69,7 +76,18 @@ https://github.com/airbrake/airbrake/wiki
Development
-----------

Use `bundle && rake` to run the tests.
We use [Appraisals](https://github.com/thoughtbot/appraisal) to run the tests.

To run the test suite on your machine, you need to run the following commands:

bundle
bundle exec rake appraisal:install

After this, you're ready to run the suite with:

bundle exec rake

This will include cucumber features we use to fully test the integration.

Credits
-------
Expand All @@ -85,4 +103,4 @@ The names and logos for Airbrake, thoughtbot are trademarks of their respective
License
-------

Airbrake is Copyright © 2008-2012 Airbrake.
Airbrake is Copyright © 2008-2012 Airbrake.
18 changes: 13 additions & 5 deletions README_FOR_HEROKU_ADDON.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To use Airbrake on Heroku, install the Airbrake add-on:
After adding the Airbrake add-on, you will need to install and configure the Airbrake notifier.

Your application connects to Airbrake with an API key. On Heroku, this is automatically provided to your
application in `ENV['HOPTOAD_API_KEY']`, so installation should be a snap! (Hoptoad is Airbrake's old name.)
application in `ENV['AIRBRAKE_API_KEY']`, so installation should be a snap!

### Rails 3.x

Expand Down Expand Up @@ -57,7 +57,7 @@ In order to use airbrake in a non-Rails rack app, just load the airbrake, config
require 'airbrake'

Airbrake.configure do |config|
config.api_key = `ENV['HOPTOAD_API_KEY']`
config.api_key = `ENV['AIRBRAKE_API_KEY']`
end

app = Rack::Builder.app do
Expand All @@ -67,8 +67,8 @@ In order to use airbrake in a non-Rails rack app, just load the airbrake, config

### Rails 1.x

For Rails 1.x, visit the [Airbrake notifier's README on GitHub](http://github.com/thoughtbot/airbrake),
and be sure to use `ENV['HOPTOAD_API_KEY']` where your API key is required in configuration code.
For Rails 1.x, visit the [Airbrake's README on GitHub](http://github.com/airbrake/airbrake),
and be sure to use `ENV['AIRBRAKE_API_KEY']` where your API key is required in configuration code.

3. Configure your notification settings (important!)
---------------------------------------------------
Expand All @@ -82,7 +82,7 @@ Airbrake can deliver exception notifications to your email inbox. To configure

1. Visit your applications resources page, like [ http://api.heroku.com/myapps/my-great-app/resources ](http://api.heroku.com/myapps/my-great-app/resources).
2. Click the name of your Airbrake addon. (It may still be called Hoptoad.)
3. Click "Settings" to configure the Hoptoad Add-on.
3. Click "Settings" to configure the Airbrake Add-on.

4. Optionally: Set up deploy notification
-----------------------------------------
Expand All @@ -92,3 +92,11 @@ If your Airbrake plan supports deploy notification, set it up for your Heroku ap
rake airbrake:heroku:add_deploy_notification

This will install a Heroku [HTTP Deploy Hook](http://docs.heroku.com/deploy-hooks) to notify Airbrake of the deploy.

You can pass in additional information for the deploy hook, in the ENV. Here are the available parameters:
* `ENV["RAILS_ENV"]` - Rails environment you're deploying to, if not set on Heroku
* `ENV["AIRBRAKE_API_KEY"]` - API key if not saved on Heroku or in initializer
* `ENV["HEROKU_APP"]` - app name if you have multiple Heroku apps
* `ENV["REPO"]` - Github url of the repo you're deploying, set this if you're not using remote named "origin"

We will also set "username" and "revision" from Heroku variables.
29 changes: 26 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ end
require './lib/airbrake/version'

task :default do
exec 'rake appraisal test'
exec 'rake appraisal cucumber'
exec 'rake appraisal:rails-3.0 test '\
'&& rake appraisal:rails-3.1 test '\
'&& rake appraisal:rails-3.2 test '\
'&& rake appraisal cucumber'\
end

desc 'Test the airbrake gem.'
Expand Down Expand Up @@ -117,7 +119,28 @@ task :clobber => [:clobber_rdoc, :clobber_package]

LOCAL_GEM_ROOT = File.join(GEM_ROOT, 'tmp', 'local_gems').freeze

# Helper method that's used to only include relevant features when using
# various gemfiles. We don't want to, for instance, test sinatra features when
# using the rails gemfile and vice versa.
def cucumber_opts
opts = "--tags ~@wip --format progress "

opts << ENV["FEATURE"] and return if ENV["FEATURE"]

case ENV["BUNDLE_GEMFILE"]
when /rails/
opts << "features/rails.feature features/rails_with_js_notifier.feature features/metal.feature features/user_informer.feature"
when /rack/
opts << "features/rack.feature"
when /sinatra/
opts << "features/sinatra.feature"
when /rake/
opts << "features/rake.feature"
end
end

Cucumber::Rake::Task.new(:cucumber) do |t|
t.fork = true
t.cucumber_opts = "--tags ~@wip --format progress"
t.cucumber_opts = cucumber_opts
end

37 changes: 0 additions & 37 deletions SUPPORTED_RAILS_VERSIONS

This file was deleted.

6 changes: 6 additions & 0 deletions TESTED_AGAINST
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Rails 3.0.19
Rails 3.1.10
Rails 3.2.11
Sinatra 1.3.3
Rack 1.4.3
Rake 10.0.3
4 changes: 3 additions & 1 deletion airbrake.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Gem::Specification.new do |s|
s.test_files = Dir.glob("{test,spec,features}/**/*")

s.add_runtime_dependency("builder")
s.add_runtime_dependency("activesupport")
s.add_runtime_dependency("json")

s.add_development_dependency("bourne", ">= 1.0")
s.add_development_dependency("cucumber-rails","~> 1.1.1")
Expand All @@ -26,8 +28,8 @@ Gem::Specification.new do |s|
s.add_development_dependency("aruba")
s.add_development_dependency("appraisal")
s.add_development_dependency("rspec-rails")
s.add_development_dependency("sinatra")
s.add_development_dependency("girl_friday")
s.add_development_dependency("json-schema")

s.authors = ["Airbrake"]
s.email = %q{support@airbrake.io}
Expand Down
3 changes: 2 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
dependencies:
override:
- bundle
- bundle exec rake appraisal:install

## Customize test commands
test:
override:
- rake
- bundle exec rake
1 change: 1 addition & 0 deletions features/rake.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Feature: Use the Gem to catch errors in a Rake application
When I run rake with airbrake autodetect not from terminal
Then Airbrake should catch the exception

@wip
Scenario: Airbrake should also send the command name
When I run `rake airbrake_autodetect_not_from_terminal`
Then command "airbrake_autodetect_not_from_terminal" should be reported
3 changes: 1 addition & 2 deletions features/sinatra.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Feature: Use the notifier in a Sinatra app
Airbrake.configure do |config|
config.api_key = 'my_api_key'
config.logger = Logger.new STDOUT
config.development_environments = []
end
class FontaneApp < Sinatra::Base
use Airbrake::Sinatra
enable :raise_errors
get "/test/index" do
raise "Sinatra has left the building"
Expand Down Expand Up @@ -42,7 +42,6 @@ Feature: Use the notifier in a Sinatra app
use Airbrake::Sinatra
set :environment, :production
enable :raise_errors
get "/test/index" do
raise "Sinatra has left the building"
Expand Down
4 changes: 2 additions & 2 deletions features/step_definitions/rails_application_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def rails_non_initializer_airbrake_config_file
end

When /^I route "([^\"]*)" to "([^\"]*)"$/ do |path, controller_action_pair|
route = %(match "#{path}", :to => "#{controller_action_pair}")
route = %(get "#{path}", :to => "#{controller_action_pair}")
routes_file = File.join(rails_root, "config", "routes.rb")
File.open(routes_file, "r+") do |file|
content = file.read
Expand Down Expand Up @@ -227,7 +227,7 @@ def local_request?; false; end
# this is the ultimate authentication system, devise is history
def #{current_user}
Struct.new(:attributes).new({:id => 1,:name => 'Bender',:email => 'bender@beer.com',:username => 'b3nd0r'})
Struct.new(:id, :name, :email, :username).new(1, 'Bender', 'bender@beer.com', 'b3nd0r')
end
end
"""
Expand Down
13 changes: 12 additions & 1 deletion features/support/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,18 @@ def perform_request(uri, environment = 'production')
response = response.last if response.last.is_a?(ActionDispatch::Response)
if response.is_a?(Array)
puts response.join
puts "Status: " + response.first.to_s
puts "Headers: " + response.second.to_s
if response.last.respond_to?(:each)
# making it work even with Rack::BodyProxy
body = ""
response.last.each do |chunk|
body << chunk
end
response.pop
response << body
end
puts "Body: " + response.last.to_s
else
puts response.body
end
Expand Down
Loading

0 comments on commit ada45ed

Please sign in to comment.