forked from cv/merb_hoptoad_notifier
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
actually filter environmental variables again
HoptoadNotifier -> Merb::HoptoadNotifier version bump to 1.1.0 since the constants changed cleanup misc cruft
- Loading branch information
Showing
6 changed files
with
59 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,5 @@ only :test do | |
gem 'rcov' | ||
gem 'rr' | ||
gem 'ruby-debug' | ||
gem 'bundler' | ||
gem 'bundler', '~>0.7.2' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
require 'rubygems' | ||
require 'rake/gempackagetask' | ||
require 'rubygems/specification' | ||
require 'date' | ||
require 'merb-core/version' | ||
require 'spec/rake/spectask' | ||
require 'bundler' | ||
|
||
install_home = ENV['GEM_HOME'] ? "-i #{ENV['GEM_HOME']}" : "" | ||
Bundler.require_env | ||
|
||
require 'lib/merb_hoptoad_notifier' | ||
|
||
NAME = "merb_hoptoad_notifier" | ||
GEM_VERSION = "1.0.12" | ||
GEM_VERSION = Merb::HoptoadNotifier::VERSION | ||
AUTHOR = "Corey Donohoe" | ||
EMAIL = '[email protected]' | ||
HOMEPAGE = "http://github.com/atmos/merb_hoptoad_notifier" | ||
|
@@ -28,14 +29,14 @@ spec = Gem::Specification.new do |s| | |
s.email = EMAIL | ||
s.homepage = HOMEPAGE | ||
|
||
manifest = Bundler::Environment.load(File.dirname(__FILE__) + '/Gemfile') | ||
manifest = Bundler::Dsl.load_gemfile(File.dirname(__FILE__) + '/Gemfile') | ||
manifest.dependencies.each do |d| | ||
next unless d.only && d.only.include?('release') | ||
s.add_dependency(d.name, d.version) | ||
end | ||
|
||
s.require_path = 'lib' | ||
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*") | ||
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib}/**/*") | ||
end | ||
|
||
Rake::GemPackageTask.new(spec) do |pkg| | ||
|
@@ -50,11 +51,11 @@ task :make_spec do | |
end | ||
|
||
Spec::Rake::SpecTask.new(:default) do |t| | ||
t.spec_opts << %w(-fs --color) << %w(-O spec/spec.opts) | ||
t.spec_opts << %w(-fs --color) | ||
t.spec_opts << '--loadby' << 'random' | ||
t.spec_files = Dir["spec/*_spec.rb"] | ||
t.rcov = ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true | ||
t.rcov_opts << '--exclude' << '.gem/' | ||
t.rcov_opts << '--exclude' << 'vendor' | ||
|
||
t.rcov_opts << '--text-summary' | ||
t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
if defined?(Merb::Plugins) | ||
libdir = File.join(File.dirname(__FILE__), 'merb_hoptoad_notifier') | ||
require 'toadhopper' | ||
require File.join(libdir, 'hoptoad_notifier') | ||
require 'toadhopper' | ||
libdir = File.join(File.dirname(__FILE__), 'merb_hoptoad_notifier') | ||
require File.join(libdir, 'hoptoad_notifier') | ||
|
||
if defined?(Merb::BootLoader) | ||
Merb::BootLoader.after_app_loads do | ||
HoptoadNotifier.configure | ||
Merb::HoptoadNotifier.configure | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,52 @@ | ||
module HoptoadNotifier | ||
class << self | ||
attr_accessor :api_key, :logger | ||
end | ||
module Merb | ||
module HoptoadNotifier | ||
VERSION = '1.1.0' | ||
class << self | ||
attr_accessor :api_key, :logger, :environment_filters | ||
end | ||
|
||
def self.configure | ||
key = YAML.load_file(Merb.root / 'config' / 'hoptoad.yml') | ||
def self.configure | ||
key = YAML.load_file(Merb.root / 'config' / 'hoptoad.yml') | ||
|
||
if key | ||
env = key[Merb.env.to_sym] | ||
env ? @api_key = env[:api_key] : raise(ArgumentError, "No hoptoad key for Merb environment #{Merb.env}") | ||
if key | ||
env = key[Merb.env.to_sym] | ||
env ? @api_key = env[:api_key] : raise(ArgumentError, "No hoptoad key for Merb environment #{Merb.env}") | ||
end | ||
end | ||
end | ||
|
||
def self.logger | ||
@logger || Merb.logger | ||
end | ||
def self.environment_filters | ||
@environment_filters ||= [ ] | ||
end | ||
|
||
def self.notify_hoptoad(request, session) | ||
request.exceptions.each do |exception| | ||
options = { | ||
:api_key => HoptoadNotifier.api_key, | ||
:url => "#{request.protocol}://#{request.host}#{request.path}", | ||
:component => request.params['controller'], | ||
:action => request.params['action'], | ||
:request => request, | ||
:framework_env => Merb.env, | ||
:notifier_name => 'Merb::HoptoadNotifier', | ||
:notifier_version => '1.0.10', | ||
:session => session.to_hash | ||
} | ||
dispatcher.post!(exception, options, {'X-Hoptoad-Client-Name' => 'Merb::HoptoadNotifier'}) | ||
def self.environment_filters=(filters) | ||
@environment_filters << filters | ||
end | ||
true | ||
end | ||
|
||
def self.dispatcher | ||
@dispatcher ||= ToadHopper.new(api_key) | ||
def self.logger | ||
@logger || Merb.logger | ||
end | ||
|
||
def self.notify_hoptoad(request, session) | ||
request.exceptions.each do |exception| | ||
options = { | ||
:api_key => HoptoadNotifier.api_key, | ||
:url => "#{request.protocol}://#{request.host}#{request.path}", | ||
:component => request.params['controller'], | ||
:action => request.params['action'], | ||
:request => request, | ||
:framework_env => Merb.env, | ||
:notifier_name => 'Merb::HoptoadNotifier', | ||
:notifier_version => Merb::HoptoadNotifier::VERSION, | ||
:session => session.to_hash | ||
} | ||
dispatcher.filters = environment_filters.flatten | ||
dispatcher.post!(exception, options, {'X-Hoptoad-Client-Name' => 'Merb::HoptoadNotifier'}) | ||
end | ||
true | ||
end | ||
|
||
def self.dispatcher | ||
@dispatcher ||= ToadHopper.new(api_key) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.