airbrakeV4rails5 4.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +1716 -0
- data/Gemfile +3 -0
- data/Guardfile +6 -0
- data/INSTALL +20 -0
- data/LICENSE +61 -0
- data/README.md +148 -0
- data/README_FOR_HEROKU_ADDON.md +102 -0
- data/Rakefile +179 -0
- data/TESTED_AGAINST +7 -0
- data/airbrake.gemspec +41 -0
- data/bin/airbrake +12 -0
- data/features/metal.feature +34 -0
- data/features/rack.feature +60 -0
- data/features/rails.feature +324 -0
- data/features/rake.feature +33 -0
- data/features/sinatra.feature +126 -0
- data/features/step_definitions/file_steps.rb +14 -0
- data/features/step_definitions/rack_steps.rb +27 -0
- data/features/step_definitions/rails_application_steps.rb +267 -0
- data/features/step_definitions/rake_steps.rb +22 -0
- data/features/support/airbrake_shim.rb.template +11 -0
- data/features/support/aruba.rb +5 -0
- data/features/support/env.rb +39 -0
- data/features/support/matchers.rb +35 -0
- data/features/support/rails.rb +156 -0
- data/features/support/rake/Rakefile +77 -0
- data/features/user_informer.feature +57 -0
- data/generators/airbrake/airbrake_generator.rb +94 -0
- data/generators/airbrake/lib/insert_commands.rb +34 -0
- data/generators/airbrake/lib/rake_commands.rb +24 -0
- data/generators/airbrake/templates/airbrake_tasks.rake +25 -0
- data/generators/airbrake/templates/capistrano_hook.rb +6 -0
- data/generators/airbrake/templates/initializer.rb +4 -0
- data/install.rb +1 -0
- data/lib/airbrake.rb +191 -0
- data/lib/airbrake/backtrace.rb +103 -0
- data/lib/airbrake/capistrano.rb +103 -0
- data/lib/airbrake/capistrano3.rb +3 -0
- data/lib/airbrake/cli/client.rb +76 -0
- data/lib/airbrake/cli/options.rb +45 -0
- data/lib/airbrake/cli/printer.rb +33 -0
- data/lib/airbrake/cli/project.rb +17 -0
- data/lib/airbrake/cli/project_factory.rb +33 -0
- data/lib/airbrake/cli/runner.rb +49 -0
- data/lib/airbrake/cli/validator.rb +8 -0
- data/lib/airbrake/configuration.rb +366 -0
- data/lib/airbrake/jobs/send_job.rb +7 -0
- data/lib/airbrake/notice.rb +411 -0
- data/lib/airbrake/rack.rb +64 -0
- data/lib/airbrake/rails.rb +45 -0
- data/lib/airbrake/rails/action_controller_catcher.rb +32 -0
- data/lib/airbrake/rails/controller_methods.rb +146 -0
- data/lib/airbrake/rails/error_lookup.rb +35 -0
- data/lib/airbrake/rails/middleware.rb +63 -0
- data/lib/airbrake/rails3_tasks.rb +126 -0
- data/lib/airbrake/railtie.rb +44 -0
- data/lib/airbrake/rake_handler.rb +75 -0
- data/lib/airbrake/response.rb +29 -0
- data/lib/airbrake/sender.rb +213 -0
- data/lib/airbrake/shared_tasks.rb +59 -0
- data/lib/airbrake/sidekiq.rb +8 -0
- data/lib/airbrake/sinatra.rb +40 -0
- data/lib/airbrake/tasks.rb +81 -0
- data/lib/airbrake/tasks/airbrake.cap +28 -0
- data/lib/airbrake/user_informer.rb +36 -0
- data/lib/airbrake/utils/params_cleaner.rb +141 -0
- data/lib/airbrake/utils/rack_filters.rb +45 -0
- data/lib/airbrake/version.rb +3 -0
- data/lib/airbrake_tasks.rb +62 -0
- data/lib/rails/generators/airbrake/airbrake_generator.rb +155 -0
- data/lib/templates/rescue.erb +91 -0
- data/rails/init.rb +1 -0
- data/resources/README.md +34 -0
- data/resources/airbrake_2_4.xsd +89 -0
- data/resources/airbrake_3_0.json +52 -0
- data/resources/ca-bundle.crt +3376 -0
- data/script/integration_test.rb +35 -0
- data/test/airbrake_tasks_test.rb +161 -0
- data/test/backtrace_test.rb +215 -0
- data/test/capistrano_test.rb +44 -0
- data/test/configuration_test.rb +303 -0
- data/test/controller_methods_test.rb +230 -0
- data/test/helper.rb +233 -0
- data/test/integration.rb +13 -0
- data/test/integration/catcher_test.rb +371 -0
- data/test/logger_test.rb +79 -0
- data/test/notice_test.rb +494 -0
- data/test/notifier_test.rb +288 -0
- data/test/params_cleaner_test.rb +204 -0
- data/test/rack_test.rb +62 -0
- data/test/rails_initializer_test.rb +36 -0
- data/test/recursion_test.rb +10 -0
- data/test/response_test.rb +18 -0
- data/test/sender_test.rb +335 -0
- data/test/support/response_shim.xml +4 -0
- data/test/user_informer_test.rb +29 -0
- metadata +469 -0
data/Gemfile
ADDED
data/Guardfile
ADDED
data/INSTALL
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
=== Configuration
|
2
|
+
|
3
|
+
You should have something like this in config/initializers/airbrake.rb.
|
4
|
+
|
5
|
+
Airbrake.configure do |config|
|
6
|
+
config.api_key = '1234567890abcdef'
|
7
|
+
end
|
8
|
+
|
9
|
+
(Please note that this configuration should be in a global configuration, and
|
10
|
+
is *not* environment-specific. Airbrake is smart enough to know what errors are
|
11
|
+
caused by what environments, so your staging errors don't get mixed in with
|
12
|
+
your production errors.)
|
13
|
+
|
14
|
+
You can test that Airbrake is working in your production environment by using
|
15
|
+
this rake task (from RAILS_ROOT):
|
16
|
+
|
17
|
+
rake airbrake:test
|
18
|
+
|
19
|
+
If everything is configured properly, that task will send a notice to Airbrake
|
20
|
+
which will be visible immediately.
|
data/LICENSE
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
This product includes jquery written by John Resig
|
2
|
+
and distributed under an MIT license.
|
3
|
+
See https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt
|
4
|
+
|
5
|
+
Copyright (c) 2011 John Resig, http://jquery.com/
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
a copy of this software and associated documentation files (the
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
13
|
+
the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be
|
16
|
+
included in all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
+
|
26
|
+
|
27
|
+
All other components of this product are
|
28
|
+
Copyright (c) 2007-2015 Rackspace, Inc.
|
29
|
+
|
30
|
+
Subject to the terms of this notice, Rackspace, Inc. grants you a
|
31
|
+
nonexclusive, nontransferable license, without the right to
|
32
|
+
sublicense, to (a) install and execute one copy of these files on any
|
33
|
+
number of workstations owned or controlled by you and (b) distribute
|
34
|
+
verbatim copies eof these files to third parties. As a condition to the
|
35
|
+
foregoing grant, you must provide this notice along with each copy you
|
36
|
+
distribute and you must not remove, alter, or obscure this notice. All
|
37
|
+
other use, reproduction, modification, distribution, or other
|
38
|
+
exploitation of these files is strictly prohibited, except as may be set
|
39
|
+
forth in a separate written license agreement between you and ERackspace,
|
40
|
+
Inc. The terms of any such license agreement will control over this
|
41
|
+
notice. The license stated above will be automatically terminated and
|
42
|
+
revoked if you exceed its scope or violate any of the terms of this
|
43
|
+
notice.
|
44
|
+
|
45
|
+
This License does not grant permission to use the trade names,
|
46
|
+
trademarks, service marks, or product names of Rackspace, Inc.,
|
47
|
+
Airbrake, Exceptional, Airbrake.io, Exceptional.io except as
|
48
|
+
required for reasonable and customary use in describing the origin
|
49
|
+
of this file and reproducing the content of this notice. You may
|
50
|
+
not mark or brand this file with any trade name, trademarks,
|
51
|
+
servicemarks, or product names other than the original brand
|
52
|
+
(if any)provided by Rackspace, Inc.
|
53
|
+
|
54
|
+
Unless otherwise expressly agreed by Rackspace, Inc., in a
|
55
|
+
separate written license agreement, these files are provided AS IS,
|
56
|
+
WITHOUT WARRANTY OF ANY KIND, including without any implied warranties
|
57
|
+
of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, or NON-INFRINGEMENT.
|
58
|
+
As a condition to your use of these files, you are solely responsible for
|
59
|
+
such use. Rackspace, Inc. will have no liability to you for direct,
|
60
|
+
indirect, consequential, incidental, special, or punitive damages or
|
61
|
+
for lost profits or data.
|
data/README.md
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
Airbrake
|
2
|
+
========
|
3
|
+
|
4
|
+
[](https://circleci.com/gh/airbrake/airbrake)
|
5
|
+
[](https://codeclimate.com/github/airbrake/airbrake)
|
6
|
+
[](https://coveralls.io/r/airbrake/airbrake?branch=master)
|
7
|
+
[](https://gemnasium.com/airbrake/airbrake)
|
8
|
+
|
9
|
+
<img src="http://f.cl.ly/items/3Q163w1r2K1J1b030k0g/ruby%2009.19.32.jpg" width=800px>
|
10
|
+
|
11
|
+
This is the notifier gem for integrating apps with [Airbrake](http://airbrake.io).
|
12
|
+
|
13
|
+
When an uncaught exception occurs, Airbrake will POST the relevant data
|
14
|
+
to the Airbrake server specified in your environment.
|
15
|
+
|
16
|
+
<img scr="http://f.cl.ly/items/142j0Z2u0R1Y2L0L3D26/ruby.jpg" width=800px;>
|
17
|
+
|
18
|
+
Help
|
19
|
+
----
|
20
|
+
|
21
|
+
For help with using Airbrake and this notifier visit [our support site](http://help.airbrake.io).
|
22
|
+
|
23
|
+
For **SSL** verification see the [Resources](https://github.com/airbrake/airbrake/blob/master/resources/README.md).
|
24
|
+
|
25
|
+
Rails Installation
|
26
|
+
------------------
|
27
|
+
|
28
|
+
### Rails 3.x/4.x
|
29
|
+
|
30
|
+
Add the airbrake gem to your Gemfile. In Gemfile:
|
31
|
+
|
32
|
+
gem 'airbrake'
|
33
|
+
|
34
|
+
Then from your project's RAILS_ROOT, and in your development environment, run:
|
35
|
+
|
36
|
+
bundle install
|
37
|
+
rails generate airbrake --api-key your_key_here
|
38
|
+
|
39
|
+
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.
|
40
|
+
|
41
|
+
### Rails 2.x
|
42
|
+
|
43
|
+
Add the airbrake gem to your app. In config/environment.rb:
|
44
|
+
|
45
|
+
config.gem 'airbrake'
|
46
|
+
|
47
|
+
or if you are using bundler:
|
48
|
+
|
49
|
+
gem 'airbrake', :require => 'airbrake/rails'
|
50
|
+
|
51
|
+
Then from your project's RAILS_ROOT, and in your development environment, run:
|
52
|
+
|
53
|
+
rake gems:install
|
54
|
+
rake gems:unpack GEM=airbrake
|
55
|
+
script/generate airbrake --api-key your_key_here
|
56
|
+
|
57
|
+
As always, if you choose not to vendor the airbrake gem, make sure
|
58
|
+
every server you deploy to has the gem installed or your application won't start.
|
59
|
+
|
60
|
+
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.
|
61
|
+
|
62
|
+
Ignored exceptions
|
63
|
+
------------------------
|
64
|
+
|
65
|
+
Exceptions raised from Rails environments named **development**, **test** or **cucumber** will be ignored by default.
|
66
|
+
|
67
|
+
You can clear the list of ignored environments with this setting:
|
68
|
+
|
69
|
+
config.development_environments = []
|
70
|
+
|
71
|
+
List of ignored exception classes includes:
|
72
|
+
|
73
|
+
ActiveRecord::RecordNotFound
|
74
|
+
ActionController::RoutingError
|
75
|
+
ActionController::InvalidAuthenticityToken
|
76
|
+
CGI::Session::CookieStore::TamperedWithCookie
|
77
|
+
ActionController::UnknownHttpMethod
|
78
|
+
ActionController::UnknownAction
|
79
|
+
AbstractController::ActionNotFound
|
80
|
+
Mongoid::Errors::DocumentNotFound
|
81
|
+
ActionController::UnknownFormat
|
82
|
+
|
83
|
+
You can alter this list with
|
84
|
+
|
85
|
+
config.ignore_only = []
|
86
|
+
|
87
|
+
which will cause none of the exception classes to be ignored.
|
88
|
+
|
89
|
+
Check the [wiki](https://github.com/airbrake/airbrake/wiki/Customizing-your-airbrake.rb) for more customization options.
|
90
|
+
|
91
|
+
Supported frameworks
|
92
|
+
------------------------
|
93
|
+
|
94
|
+
See **[TESTED_AGAINST](https://github.com/airbrake/airbrake/blob/master/TESTED_AGAINST)** for a full list of frameworks and versions we test against.
|
95
|
+
|
96
|
+
Airbrake wiki pages
|
97
|
+
------------------------
|
98
|
+
Our wiki contains a lot of additional information about Airbrake configuration. Please browse the wiki when finished reading this
|
99
|
+
README:
|
100
|
+
|
101
|
+
https://github.com/airbrake/airbrake/wiki
|
102
|
+
|
103
|
+
Development
|
104
|
+
-----------
|
105
|
+
|
106
|
+
For running unit tests, you should run
|
107
|
+
|
108
|
+
bundle
|
109
|
+
bundle exec rake test:unit
|
110
|
+
|
111
|
+
If you wish to run the entire suite, which checks the different framework
|
112
|
+
integrations with cucumber, you should run the following commands
|
113
|
+
|
114
|
+
bundle
|
115
|
+
bundle exec appraisal install
|
116
|
+
bundle exec rake
|
117
|
+
|
118
|
+
We use [Appraisals](https://github.com/thoughtbot/appraisal) to run the integration
|
119
|
+
tests.
|
120
|
+
|
121
|
+
Maintainers
|
122
|
+
-----------
|
123
|
+
|
124
|
+
Make sure all tests are passing before pushing the new version. Also, make sure integration
|
125
|
+
test is passing. You can run it with:
|
126
|
+
|
127
|
+
./script/integration_test.rb <api_key> <host>
|
128
|
+
|
129
|
+
After this is passing, change the version inside *lib/airbrake/version.rb* and
|
130
|
+
push the new version with Changeling:
|
131
|
+
|
132
|
+
rake changeling:change
|
133
|
+
|
134
|
+
Credits
|
135
|
+
-------
|
136
|
+
|
137
|
+

|
138
|
+
|
139
|
+
Airbrake is maintained and funded by [airbrake.io](http://airbrake.io).
|
140
|
+
|
141
|
+
Thank you to all [the contributors](https://github.com/airbrake/airbrake/contributors)!
|
142
|
+
|
143
|
+
The names and logos for Airbrake, thoughtbot are trademarks of their respective holders.
|
144
|
+
|
145
|
+
License
|
146
|
+
-------
|
147
|
+
|
148
|
+
Airbrake is Copyright © 2008-2015 Airbrake.
|
@@ -0,0 +1,102 @@
|
|
1
|
+
Airbrake on Heroku
|
2
|
+
==================
|
3
|
+
|
4
|
+
Send your application errors to our hosted service and reclaim your inbox.
|
5
|
+
|
6
|
+
1. Installing the Heroku add-on
|
7
|
+
----------------------------
|
8
|
+
To use Airbrake on Heroku, install the Airbrake add-on:
|
9
|
+
|
10
|
+
$ heroku addons:add airbrake:developer # If you'd like another plan, specify that instead.
|
11
|
+
# Check https://addons.heroku.com/airbrake for a full list of plans.
|
12
|
+
|
13
|
+
2. Including the Airbrake notifier in your application
|
14
|
+
--------------------------------------------------
|
15
|
+
After adding the Airbrake add-on, you will need to install and configure the Airbrake notifier.
|
16
|
+
|
17
|
+
Your application connects to Airbrake with an API key. On Heroku, this is automatically provided to your
|
18
|
+
application in `ENV['AIRBRAKE_API_KEY']`, so installation should be a snap!
|
19
|
+
|
20
|
+
### Rails 3.x
|
21
|
+
|
22
|
+
Add the airbrake and heroku gems to your Gemfile. In Gemfile:
|
23
|
+
|
24
|
+
gem 'airbrake'
|
25
|
+
gem 'heroku'
|
26
|
+
|
27
|
+
Then from your project's RAILS_ROOT, run:
|
28
|
+
|
29
|
+
$ bundle install
|
30
|
+
$ script/rails generate airbrake --heroku
|
31
|
+
|
32
|
+
### Rails 2.x
|
33
|
+
|
34
|
+
Install the heroku gem if you haven't already:
|
35
|
+
|
36
|
+
gem install heroku
|
37
|
+
|
38
|
+
Add the airbrake gem to your app. In config/environment.rb:
|
39
|
+
|
40
|
+
config.gem 'airbrake'
|
41
|
+
|
42
|
+
Then from your project's RAILS_ROOT, run:
|
43
|
+
|
44
|
+
$ rake gems:install
|
45
|
+
$ rake gems:unpack GEM=airbrake
|
46
|
+
$ script/generate airbrake --heroku
|
47
|
+
|
48
|
+
As always, if you choose not to vendor the airbrake gem, make sure
|
49
|
+
every server you deploy to has the gem installed or your application won't start.
|
50
|
+
|
51
|
+
### Rack applications
|
52
|
+
|
53
|
+
In order to use airbrake in a non-Rails rack app, just load the airbrake, configure your API key, and use the Airbrake::Rack middleware:
|
54
|
+
|
55
|
+
require 'rubygems'
|
56
|
+
require 'rack'
|
57
|
+
require 'airbrake'
|
58
|
+
|
59
|
+
Airbrake.configure do |config|
|
60
|
+
config.api_key = `ENV['AIRBRAKE_API_KEY']`
|
61
|
+
end
|
62
|
+
|
63
|
+
app = Rack::Builder.app do
|
64
|
+
use Airbrake::Rack
|
65
|
+
run lambda { |env| raise "Rack down" }
|
66
|
+
end
|
67
|
+
|
68
|
+
### Rails 1.x
|
69
|
+
|
70
|
+
For Rails 1.x, visit the [Airbrake's README on GitHub](http://github.com/airbrake/airbrake),
|
71
|
+
and be sure to use `ENV['AIRBRAKE_API_KEY']` where your API key is required in configuration code.
|
72
|
+
|
73
|
+
3. Configure your notification settings (important!)
|
74
|
+
---------------------------------------------------
|
75
|
+
|
76
|
+
Once you have included and configured the notifier in your application,
|
77
|
+
you will want to configure your notification settings.
|
78
|
+
|
79
|
+
This is important - without setting your email address, you won't receive notification emails.
|
80
|
+
|
81
|
+
Airbrake can deliver exception notifications to your email inbox. To configure these delivery settings:
|
82
|
+
|
83
|
+
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).
|
84
|
+
2. Click the name of your Airbrake addon. (It may still be called Hoptoad.)
|
85
|
+
3. Click "Settings" to configure the Airbrake Add-on.
|
86
|
+
|
87
|
+
4. Optionally: Set up deploy notification
|
88
|
+
-----------------------------------------
|
89
|
+
|
90
|
+
If your Airbrake plan supports deploy notification, set it up for your Heroku application like this:
|
91
|
+
|
92
|
+
rake airbrake:heroku:add_deploy_notification
|
93
|
+
|
94
|
+
This will install a Heroku [HTTP Deploy Hook](http://docs.heroku.com/deploy-hooks) to notify Airbrake of the deploy.
|
95
|
+
|
96
|
+
You can pass in additional information for the deploy hook, in the ENV. Here are the available parameters:
|
97
|
+
* `ENV["RAILS_ENV"]` - Rails environment you're deploying to, if not set on Heroku
|
98
|
+
* `ENV["AIRBRAKE_API_KEY"]` - API key if not saved on Heroku or in initializer
|
99
|
+
* `ENV["HEROKU_APP"]` - app name if you have multiple Heroku apps
|
100
|
+
* `ENV["REPO"]` - Github url of the repo you're deploying, set this if you're not using remote named "origin"
|
101
|
+
|
102
|
+
We will also set "username" and "revision" from Heroku variables.
|
data/Rakefile
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
require 'rubygems' unless RUBY_VERSION > "1.8"
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'appraisal'
|
4
|
+
require 'rake'
|
5
|
+
require 'rake/testtask'
|
6
|
+
require 'coveralls/rake/task'
|
7
|
+
require 'rubygems/package_task'
|
8
|
+
require 'cucumber/rake/task'
|
9
|
+
require './lib/airbrake/version'
|
10
|
+
|
11
|
+
Coveralls::RakeTask.new
|
12
|
+
|
13
|
+
appraisal_environments = %w(rails-4.0 rails-3.2 rails-3.1 rails-3.0 rake sinatra rack)
|
14
|
+
task default: %w( test:unit coveralls:push) +
|
15
|
+
appraisal_environments.map {|ae| "test:integration:#{ae.gsub(/[\-\.]/, '_')}"} +
|
16
|
+
appraisal_environments.map {|ae| "test:cucumber:#{ae.gsub(/[\-\.]/, '_')}"}
|
17
|
+
|
18
|
+
|
19
|
+
namespace :test do
|
20
|
+
Rake::TestTask.new(:unit) do |t|
|
21
|
+
t.libs << 'lib'
|
22
|
+
t.pattern = 'test/*_test.rb'
|
23
|
+
t.verbose = true
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Integration tests Rake, Sinatra, Rack and for all versions of Rails"
|
27
|
+
namespace :integration do
|
28
|
+
appraisal_environments.each do |appraisal_env|
|
29
|
+
task appraisal_env.gsub(/[\-\.]/, '_').to_sym do
|
30
|
+
ENV['INTEGRATION'] = 'true'
|
31
|
+
system "appraisal #{appraisal_env} rake integration_test" or exit!(1)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Cucumber tests Rake, Sinatra, Rack and for all versions of Rails"
|
37
|
+
namespace :cucumber do
|
38
|
+
appraisal_environments.each do |appraisal_env|
|
39
|
+
task appraisal_env.gsub(/[\-\.]/, '_').to_sym do
|
40
|
+
ENV['INTEGRATION'] = 'true'
|
41
|
+
system "appraisal #{appraisal_env} rake cucumber" or exit!(1)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
Rake::TestTask.new(:integration_test) do |t|
|
48
|
+
t.libs << 'lib'
|
49
|
+
t.pattern = 'test/integration.rb'
|
50
|
+
t.verbose = true
|
51
|
+
end
|
52
|
+
|
53
|
+
namespace :changeling do
|
54
|
+
desc "Bumps the version by a minor or patch version, depending on what was passed in."
|
55
|
+
task :bump, :part do |t, args|
|
56
|
+
# Thanks, Jeweler!
|
57
|
+
if Airbrake::VERSION =~ /^(\d+)\.(\d+)\.(\d+)(?:\.(.*?))?$/
|
58
|
+
major = $1.to_i
|
59
|
+
minor = $2.to_i
|
60
|
+
patch = $3.to_i
|
61
|
+
build = $4
|
62
|
+
else
|
63
|
+
abort
|
64
|
+
end
|
65
|
+
|
66
|
+
case args[:part]
|
67
|
+
when /major/
|
68
|
+
major += 1
|
69
|
+
minor = 0
|
70
|
+
patch = 0
|
71
|
+
when /minor/
|
72
|
+
minor += 1
|
73
|
+
patch = 0
|
74
|
+
when /patch/
|
75
|
+
patch += 1
|
76
|
+
else
|
77
|
+
abort
|
78
|
+
end
|
79
|
+
|
80
|
+
version = [major, minor, patch, build].compact.join('.')
|
81
|
+
|
82
|
+
File.open(File.join("lib", "airbrake", "version.rb"), "w") do |f|
|
83
|
+
f.write <<EOF
|
84
|
+
module Airbrake
|
85
|
+
VERSION = "#{version}".freeze
|
86
|
+
end
|
87
|
+
EOF
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
desc "Writes out the new CHANGELOG and prepares the release"
|
92
|
+
task :change do
|
93
|
+
load 'lib/airbrake/version.rb'
|
94
|
+
file = "CHANGELOG"
|
95
|
+
old = File.read(file)
|
96
|
+
version = Airbrake::VERSION
|
97
|
+
message = "Bumping to version #{version}"
|
98
|
+
editor = ENV["EDITOR"] || "vim" # prefer vim if no env variable for editor is set
|
99
|
+
|
100
|
+
File.open(file, "w") do |f|
|
101
|
+
f.write <<EOF
|
102
|
+
Version #{version} - #{Time.now}
|
103
|
+
===============================================================================
|
104
|
+
|
105
|
+
#{`git log $(git for-each-ref --sort=taggerdate --format '%(tag)' refs/tags | tail -1)..HEAD | git shortlog`}
|
106
|
+
#{old}
|
107
|
+
EOF
|
108
|
+
end
|
109
|
+
|
110
|
+
exec ["#{editor} #{file}",
|
111
|
+
"git commit -aqm '#{message}'",
|
112
|
+
"git tag -a -m '#{message}' v#{version}",
|
113
|
+
"echo '\n\n\033[32mMarked v#{version} /' `git show-ref -s refs/heads/master` 'for release. Run: rake changeling:push\033[0m\n\n'"].join(' && ')
|
114
|
+
end
|
115
|
+
|
116
|
+
desc "Bump by a major version (1.2.3 => 2.0.0)"
|
117
|
+
task :major do |t|
|
118
|
+
Rake::Task['changeling:bump'].invoke(t.name)
|
119
|
+
Rake::Task['changeling:change'].invoke
|
120
|
+
end
|
121
|
+
|
122
|
+
desc "Bump by a minor version (1.2.3 => 1.3.0)"
|
123
|
+
task :minor do |t|
|
124
|
+
Rake::Task['changeling:bump'].invoke(t.name)
|
125
|
+
Rake::Task['changeling:change'].invoke
|
126
|
+
end
|
127
|
+
|
128
|
+
desc "Bump by a patch version, (1.2.3 => 1.2.4)"
|
129
|
+
task :patch do |t|
|
130
|
+
Rake::Task['changeling:bump'].invoke(t.name)
|
131
|
+
Rake::Task['changeling:change'].invoke
|
132
|
+
end
|
133
|
+
|
134
|
+
desc "Push the latest version and tags"
|
135
|
+
task :push do |t|
|
136
|
+
system("git push origin master")
|
137
|
+
system("git push origin $(git tag | grep -v rc | tail -1)")
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
begin
|
142
|
+
require 'yard'
|
143
|
+
YARD::Rake::YardocTask.new do |t|
|
144
|
+
t.files = ['lib/**/*.rb', 'TESTING.rdoc']
|
145
|
+
end
|
146
|
+
rescue LoadError
|
147
|
+
end
|
148
|
+
|
149
|
+
GEM_ROOT = File.dirname(__FILE__).freeze
|
150
|
+
|
151
|
+
desc "Clean files generated by rake tasks"
|
152
|
+
task :clobber => [:clobber_rdoc, :clobber_package]
|
153
|
+
|
154
|
+
LOCAL_GEM_ROOT = File.join(GEM_ROOT, 'tmp', 'local_gems').freeze
|
155
|
+
|
156
|
+
# Helper method that's used to only include relevant features when using
|
157
|
+
# various gemfiles. We don't want to, for instance, test sinatra features when
|
158
|
+
# using the rails gemfile and vice versa.
|
159
|
+
def cucumber_opts
|
160
|
+
opts = "--tags ~@wip "
|
161
|
+
|
162
|
+
opts << ENV["FEATURE"] and return if ENV["FEATURE"]
|
163
|
+
|
164
|
+
case ENV["BUNDLE_GEMFILE"]
|
165
|
+
when /rails/
|
166
|
+
opts << "features/rails.feature features/metal.feature features/user_informer.feature"
|
167
|
+
when /rack/
|
168
|
+
opts << "features/rack.feature"
|
169
|
+
when /sinatra/
|
170
|
+
opts << "features/sinatra.feature"
|
171
|
+
when /rake/
|
172
|
+
opts << "features/rake.feature"
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
Cucumber::Rake::Task.new(:cucumber) do |t|
|
177
|
+
t.fork = true
|
178
|
+
t.cucumber_opts = cucumber_opts
|
179
|
+
end
|