Permalink
Browse files

Merge branch 'pull-requests/1-update-ruby-and-deps'

  • Loading branch information...
2 parents c50cbbc + 3cd94e0 commit 38a83511e3caf568cea45c4a39c3e36eb17a8b88 @mwynholds mwynholds committed Feb 6, 2012
View
@@ -2,3 +2,4 @@
.bundle
pkg/*
.idea
+Gemfile.lock
View
1 .rspec
@@ -0,0 +1 @@
+--colour
View
4 .rvmrc
@@ -1 +1,3 @@
-rvm --create ruby-1.9.2-p0@log_weasel
+#!/usr/bin/env bash
+
+rvm --create use "ruby-1.9.2@log_weasel"
View
@@ -1,52 +0,0 @@
-PATH
- remote: .
- specs:
- log_weasel (0.0.7)
- activesupport (~> 3.0)
-
-GEM
- remote: http://rubygems.org/
- specs:
- activesupport (3.0.4)
- builder (3.0.0)
- diff-lcs (1.1.2)
- hoptoad_notifier (2.4.5)
- activesupport
- builder
- json (1.4.6)
- mocha (0.9.11)
- rake
- rack (1.2.1)
- rake (0.8.7)
- redis (2.1.1)
- redis-namespace (0.10.0)
- redis (< 3.0.0)
- resque (1.13.0)
- json (~> 1.4.6)
- redis-namespace (>= 0.10.0)
- sinatra (>= 0.9.2)
- vegas (~> 0.1.2)
- rspec (2.5.0)
- rspec-core (~> 2.5.0)
- rspec-expectations (~> 2.5.0)
- rspec-mocks (~> 2.5.0)
- rspec-core (2.5.1)
- rspec-expectations (2.5.0)
- diff-lcs (~> 1.1.2)
- rspec-mocks (2.5.0)
- sinatra (1.1.2)
- rack (~> 1.1)
- tilt (~> 1.2)
- tilt (1.2.2)
- vegas (0.1.8)
- rack (>= 1.0.0)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- hoptoad_notifier
- log_weasel!
- mocha
- resque (~> 1.0)
- rspec
View
@@ -68,11 +68,11 @@ it modifies Resque to include transaction IDs in all worker logs.
Start your Resque worker with <code>VERBOSE=1</code> and you'll see transaction IDs in your Resque logs.
-## Hoptoad
+## Airbrake
-If you are using <a href="http://hoptoadapp.com">Hoptoad</a>, Log Weasel will add the parameter <code>log_weasel_id</code>
-to Hoptoad errors so that you can track execution through your application stack that resulted in the error. No additional
-configuration required.
+If you are using <a href="http://airbrake.io/p">Airbrake</a>, Log Weasel will add the parameter
+<code>log_weasel_id</code> to Airbrake errors so that you can track execution through your application stack that
+resulted in the error. No additional configuration required.
## Example
View
@@ -6,7 +6,7 @@ require 'rspec/core/rake_task'
Bundler::GemHelper.install_tasks
-Rspec::Core::RakeTask.new(:spec) do |spec|
+RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
end
View
@@ -1,6 +1,6 @@
require 'log_weasel/transaction'
require 'log_weasel/buffered_logger'
-require 'log_weasel/hoptoad_notifier'
+require 'log_weasel/airbrake'
require 'log_weasel/middleware'
require 'log_weasel/resque'
require 'log_weasel/railtie' if defined? ::Rails::Railtie
@@ -18,9 +18,9 @@ def self.config
def self.configure
yield self.config
- if defined? ::HoptoadNotifier
- class << ::HoptoadNotifier
- include LogWeasel::HoptoadNotifier;
+ if defined? ::Airbrake
+ class << ::Airbrake
+ include LogWeasel::Airbrake;
end
end
@@ -1,4 +1,4 @@
-module LogWeasel::HoptoadNotifier
+module LogWeasel::Airbrake
def notify_with_transaction_id(exception, opts = {})
add_transaction_id(opts) if LogWeasel::Transaction.id
notify_without_transaction_id exception, opts
@@ -1,11 +1,14 @@
class LogWeasel::Middleware
+ KEY_HEADER = 'X_LOGWEASEL_KEY'
+
def initialize(app, options = {})
@app = app
@key = LogWeasel.config.key ? "#{LogWeasel.config.key}-WEB" : "WEB"
end
def call(env)
- LogWeasel::Transaction.create @key
+ key = env.fetch("HTTP_#{KEY_HEADER}", @key)
+ LogWeasel::Transaction.create key
@app.call(env)
ensure
LogWeasel::Transaction.destroy
@@ -1,4 +1,8 @@
-require 'active_support/secure_random'
+begin
+ require 'securerandom'
+rescue
+ require 'active_support/secure_random'
+end
module LogWeasel
module Transaction
@@ -1,5 +1,5 @@
module Log
module Weasel
- VERSION = "0.0.7"
+ VERSION = "0.1.0"
end
end
View
@@ -14,12 +14,14 @@ Gem::Specification.new do |s|
s.rubyforge_project = "log_weasel"
+ s.add_development_dependency('rake')
s.add_development_dependency('rspec')
s.add_development_dependency('mocha')
- s.add_development_dependency('resque', ['~> 1.0'])
- s.add_development_dependency('hoptoad_notifier')
+ s.add_development_dependency('resque')
+ s.add_development_dependency('airbrake')
+ s.add_development_dependency('gemfury')
- s.add_dependency('activesupport', ['~> 3.0'])
+ s.add_dependency('activesupport')
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,18 +1,18 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
-require 'hoptoad_notifier'
+require 'airbrake'
-describe LogWeasel::HoptoadNotifier do
+describe LogWeasel::Airbrake do
before do
LogWeasel.configure {}
- HoptoadNotifier.configure {}
+ Airbrake.configure {}
LogWeasel::Transaction.stubs(:id).returns('123')
end
it "adds transaction id to parameters with no parameters" do
- HoptoadNotifier.expects(:send_notice).with do |notice|
+ Airbrake.expects(:send_notice).with do |notice|
notice.parameters.should have_key('log_weasel_id')
end
- HoptoadNotifier.notify(RuntimeError.new('failure'))
+ Airbrake.notify(RuntimeError.new('failure'))
end
end
View
@@ -4,8 +4,12 @@
require 'log_weasel'
require 'rspec'
-require 'active_support/secure_random'
+begin
+ require 'securerandom'
+rescue
+ require 'active_support/secure_random'
+end
-Rspec.configure do |config|
+RSpec.configure do |config|
config.mock_with :mocha
end

0 comments on commit 38a8351

Please sign in to comment.