Permalink
Browse files

Fixed version numbers and other project info not appearing in notices

  • Loading branch information...
1 parent 46c249b commit 14a2c3ea2d14d09c6e649689d4a947985c15789c Joe Ferris committed Aug 26, 2009
View
@@ -16,9 +16,7 @@ module HoptoadNotifier
HEADERS = {
'Content-type' => 'text/xml',
- 'Accept' => 'text/xml, application/xml',
- 'X-Hoptoad-Client-Name' => 'Hoptoad Notifier',
- 'X-Hoptoad-Client-Version' => VERSION
+ 'Accept' => 'text/xml, application/xml'
}
class << self
@@ -1,10 +1,12 @@
module HoptoadNotifier
class Configuration
- OPTIONS = [:api_key, :host, :port, :secure, :http_open_timeout, :http_read_timeout,
- :proxy_host, :proxy_port, :proxy_user, :proxy_pass, :params_filters,
- :environment_filters, :backtrace_filters, :ignore_by_filters, :ignore,
- :ignore_user_agent, :port, :protocol, :development_environments].freeze
+ OPTIONS = [:api_key, :backtrace_filters, :development_environments,
+ :environment_filters, :environment_name, :host, :http_open_timeout,
+ :http_read_timeout, :ignore, :ignore_by_filters, :ignore_user_agent,
+ :notifier_name, :notifier_url, :notifier_version, :params_filters,
+ :project_root, :port, :protocol, :proxy_host, :proxy_pass, :proxy_port,
+ :proxy_user, :secure].freeze
# The API key for your project, found on the project edit form.
attr_accessor :api_key
View
@@ -4,4 +4,5 @@
HoptoadNotifier.configure do |config|
config.environment_name = RAILS_ENV
+ config.project_root = RAILS_ROOT
end
@@ -1,9 +1,10 @@
#!/usr/bin/env ruby
require 'logger'
+require 'fileutils'
RAILS_ENV = "production"
-RAILS_ROOT = "./"
+RAILS_ROOT = FileUtils.pwd
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
$: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -28,6 +29,10 @@
config.host = host
config.api_key = ARGV.first
end
+puts "Configuration:"
+HoptoadNotifier.configuration.to_hash.each do |key, value|
+ puts sprintf("%25s: %s", key.to_s, value.inspect.slice(0, 55))
+end
puts "Sending #{secure ? "" : "in"}secure notification to project with key #{ARGV.first}"
HoptoadNotifier.notify(exception)
View
@@ -67,10 +67,12 @@ class ConfigurationTest < Test::Unit::TestCase
should "act like a hash" do
config = HoptoadNotifier::Configuration.new
hash = config.to_hash
- [:api_key, :host, :port, :secure, :http_open_timeout, :http_read_timeout,
- :proxy_host, :proxy_port, :proxy_user, :proxy_pass, :params_filters,
- :environment_filters, :backtrace_filters, :ignore_by_filters, :ignore,
- :ignore_user_agent, :port, :protocol].each do |option|
+ [:api_key, :backtrace_filters, :development_environments,
+ :environment_filters, :environment_name, :host, :http_open_timeout,
+ :http_read_timeout, :ignore, :ignore_by_filters, :ignore_user_agent,
+ :notifier_name, :notifier_url, :notifier_version, :params_filters,
+ :project_root, :port, :protocol, :proxy_host, :proxy_pass, :proxy_port,
+ :proxy_user, :secure].each do |option|
assert_equal config[option], hash[option], "Wrong value for #{option}"
end
end
View
@@ -23,18 +23,6 @@ def set_development_env
HoptoadNotifier.configure { |config| config.environment_name = 'development' }
end
- # TODO: what does this test?
- should "send without rails environment" do
- assert_nothing_raised do
- HoptoadNotifier.environment_info
- end
- end
-
- should "send information about the notifier in the headers" do
- assert_equal "Hoptoad Notifier", HoptoadNotifier::HEADERS['X-Hoptoad-Client-Name']
- assert_equal HoptoadNotifier::VERSION, HoptoadNotifier::HEADERS['X-Hoptoad-Client-Version']
- end
-
should "yield and save a configuration when configuring" do
yielded_configuration = nil
HoptoadNotifier.configure do |config|

0 comments on commit 14a2c3e

Please sign in to comment.