Skip to content
Browse files

clean whitespace

  • Loading branch information...
1 parent 9a6c81f commit 2fb09d4519ae4ac34c4652ee5093c6f87dc00075 @shime shime committed Aug 30, 2012
View
2 generators/airbrake/lib/rake_commands.rb
@@ -2,7 +2,7 @@
def rake(cmd, opts = {})
logger.rake "rake #{cmd}"
unless system("rake #{cmd}")
- logger.rake "#{cmd} failed. Rolling back"
+ logger.rake "#{cmd} failed. Rolling back"
command(:destroy).invoke!
end
end
View
2 generators/airbrake/templates/airbrake_tasks.rake
@@ -1,7 +1,7 @@
# Don't load anything when running the gems:* tasks.
# Otherwise, airbrake will be considered a framework gem.
# https://thoughtbot.lighthouseapp.com/projects/14221/tickets/629
-unless ARGV.any? {|a| a =~ /^gems/}
+unless ARGV.any? {|a| a =~ /^gems/}
Dir[File.join(Rails.root, 'vendor', 'gems', 'airbrake-*')].each do |vendored_notifier|
$: << File.join(vendored_notifier, 'lib')
View
1 lib/airbrake/capistrano.rb
@@ -41,4 +41,3 @@ def self.load_into(configuration)
if Capistrano::Configuration.instance
Airbrake::Capistrano.load_into(Capistrano::Configuration.instance)
end
-
View
4 lib/airbrake/configuration.rb
@@ -108,7 +108,7 @@ class Configuration
DEFAULT_BACKTRACE_FILTERS = [
lambda { |line|
- if defined?(Airbrake.configuration.project_root) && Airbrake.configuration.project_root.to_s != ''
+ if defined?(Airbrake.configuration.project_root) && Airbrake.configuration.project_root.to_s != ''
line.sub(/#{Airbrake.configuration.project_root}/, "[PROJECT_ROOT]")
else
line
@@ -280,7 +280,5 @@ def default_port
80
end
end
-
end
-
end
View
3 lib/airbrake/rails/controller_methods.rb
@@ -44,7 +44,7 @@ def airbrake_filter_if_filtering(hash)
if respond_to?(:filter_parameters) # Rails 2
- filter_parameters(hash)
+ filter_parameters(hash)
elsif defined?(ActionDispatch::Http::ParameterFilter) # Rails 3
ActionDispatch::Http::ParameterFilter.new(::Rails.application.config.filter_parameters).filter(hash)
else
@@ -83,4 +83,3 @@ def airbrake_current_user
end
end
end
-
View
1 lib/airbrake/rails/javascript_notifier.rb
@@ -42,7 +42,6 @@ def airbrake_javascript_notifier
end
end
-
end
end
end
View
3 lib/airbrake/rails3_tasks.rb
@@ -7,7 +7,7 @@
Rails.logger = defined?(ActiveSupport::TaggedLogging) ?
ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) :
Logger.new(STDOUT)
-
+
Rails.logger.level = Logger::DEBUG
Airbrake.configure(true) do |config|
config.logger = Rails.logger
@@ -82,4 +82,3 @@ class AirbrakeVerificationController < ApplicationController; end
Rails.application.call(env)
end
end
-
View
7 lib/airbrake/rake_handler.rb
@@ -10,7 +10,7 @@ def self.included(klass)
def display_error_message_with_airbrake(ex)
if Airbrake.sender && Airbrake.configuration &&
- (Airbrake.configuration.rescue_rake_exceptions ||
+ (Airbrake.configuration.rescue_rake_exceptions ||
(Airbrake.configuration.rescue_rake_exceptions===nil && !self.tty_output?))
Airbrake.notify_or_ignore(ex, :component => reconstruct_command_line, :cgi_data => ENV)
@@ -22,11 +22,11 @@ def display_error_message_with_airbrake(ex)
def reconstruct_command_line
"rake #{ARGV.join( ' ' )}"
end
-
+
# This module brings Rake 0.8.7 error handling to 0.9.0 standards
module Rake087Methods
# Method taken from Rake 0.9.0 source
- #
+ #
# Provide standard exception handling for the given block.
def standard_exception_handling
begin
@@ -63,4 +63,3 @@ class << self
include Airbrake::RakeHandler
end
end
-
View
25 lib/airbrake/sender.rb
@@ -1,7 +1,7 @@
module Airbrake
# Sends out the notice to Airbrake
class Sender
-
+
NOTICES_URI = '/notifier_api/v2/notices/'.freeze
HTTP_ERRORS = [Timeout::Error,
Errno::EINVAL,
@@ -14,15 +14,15 @@ class Sender
def initialize(options = {})
[ :proxy_host,
- :proxy_port,
- :proxy_user,
- :proxy_pass,
+ :proxy_port,
+ :proxy_user,
+ :proxy_pass,
:protocol,
- :host,
- :port,
- :secure,
- :use_system_ssl_cert_chain,
- :http_open_timeout,
+ :host,
+ :port,
+ :secure,
+ :use_system_ssl_cert_chain,
+ :http_open_timeout,
:http_read_timeout
].each do |option|
instance_variable_set("@#{option}", options[option])
@@ -72,7 +72,7 @@ def send_to_airbrake(data)
alias_method :secure?, :secure
alias_method :use_system_ssl_cert_chain?, :use_system_ssl_cert_chain
-
+
private
def url
@@ -88,7 +88,7 @@ def log(level, message, response = nil)
def logger
Airbrake.logger
end
-
+
def setup_http_connection
http =
Net::HTTP::Proxy(proxy_host, proxy_port, proxy_user, proxy_pass).
@@ -105,12 +105,11 @@ def setup_http_connection
else
http.use_ssl = false
end
-
+
http
rescue => e
log :error, "[Airbrake::Sender#setup_http_connection] Failure initializing the HTTP connection.\nError: #{e.class} - #{e.message}\nBacktrace:\n#{e.backtrace.join("\n\t")}"
raise e
end
-
end
end
View
4 test/airbrake_tasks_test.rb
@@ -54,7 +54,7 @@ def unsuccessful_response(body = "")
@options = { :rails_env => "staging", :dry_run => false }
end
-
+
context "performing a dry run" do
setup { @output = AirbrakeTasks.deploy(@options.merge(:dry_run => true)) }
@@ -140,7 +140,7 @@ def unsuccessful_response(body = "")
before_should "post to the custom host" do
@post = stub("post", :set_form_data => nil)
@http_proxy = stub("proxy", :request => @response)
-
+
@http_proxy_class = stub("proxy_class", :new => @http_proxy)
@http_proxy_class.expects(:new).with("custom.host", 80).returns(@http_proxy)
Net::HTTP.expects(:Proxy).with(any_parameters).returns(@http_proxy_class)
View
2 test/backtrace_test.rb
@@ -20,7 +20,7 @@ class BacktraceTest < Test::Unit::TestCase
assert_equal 'app/controllers/users_controller.rb', line.file
assert_equal 'index', line.method
end
-
+
should "parse a windows backtrace into lines" do
array = [
"C:/Program Files/Server/app/models/user.rb:13:in `magic'",
View
10 test/capistrano_test.rb
@@ -7,27 +7,27 @@ class CapistranoTest < Test::Unit::TestCase
def setup
super
reset_config
-
+
@configuration = Capistrano::Configuration.new
Airbrake::Capistrano.load_into(@configuration)
@configuration.dry_run = true
end
-
+
should "define airbrake:deploy task" do
assert_not_nil @configuration.find_task('airbrake:deploy')
end
-
+
should "log when calling airbrake:deploy task" do
@configuration.set(:current_revision, '084505b1c0e0bcf1526e673bb6ac99fbcb18aecc')
@configuration.set(:repository, 'repository')
@configuration.set(:current_release, '/home/deploy/rails_app/hoptoad')
io = StringIO.new
logger = Capistrano::Logger.new(:output => io)
logger.level = Capistrano::Logger::MAX_LEVEL
-
+
@configuration.logger = logger
@configuration.find_and_execute_task('airbrake:deploy')
-
+
assert io.string.include?('** Notifying Airbrake of Deploy')
assert io.string.include?('** Airbrake Notification Complete')
end
View
4 test/helper.rb
@@ -175,7 +175,7 @@ def assert_valid_node(document, xpath, content)
"but found #{nodes.map { |n| n.content }} in #{nodes.size} matching nodes." +
"Document:\n#{document.to_s}"
end
-
+
def assert_logged(expected)
assert_received(Airbrake, :write_verbose_log) do |expect|
expect.with {|actual| actual =~ expected }
@@ -188,7 +188,7 @@ def assert_not_logged(expected)
end
end
-
+
end
module DefinesConstants
View
1 test/javascript_notifier_test.rb
@@ -49,4 +49,3 @@ def render_to_string(options)
assert ! controller.send(:airbrake_javascript_notifier)['"bad_javascript"']
end
end
-
View
26 test/sender_test.rb
@@ -70,17 +70,17 @@ def stub_http(options = {})
proxy = stub()
proxy.stubs(:new).raises(NoMemoryError)
Net::HTTP.stubs(:Proxy => proxy)
-
+
assert_raise NoMemoryError do
build_sender.send(:setup_http_connection)
end
end
-
+
should "be logged" do
proxy = stub()
proxy.stubs(:new).raises(RuntimeError)
Net::HTTP.stubs(:Proxy => proxy)
-
+
sender = build_sender
sender.expects(:log).with(:error, includes('Failure initializing the HTTP connection'))
@@ -99,17 +99,17 @@ def stub_http(options = {})
sender.expects(:log).with(:error, includes('Cannot send notification. Error'))
sender.send_to_airbrake("stuff")
end
-
+
should "return nil no matter what" do
sender = build_sender
sender.stubs(:setup_http_connection).raises(LocalJumpError)
-
+
assert_nothing_thrown do
assert_nil sender.send_to_airbrake("stuff")
end
end
end
-
+
should "return nil on failed posting" do
http = stub_http
http.stubs(:post).raises(Errno::ECONNREFUSED)
@@ -173,7 +173,7 @@ def stub_http(options = {})
assert_equal(OpenSSL::SSL::VERIFY_PEER, real_http.verify_mode)
assert_equal(Airbrake.configuration.local_cert_path, real_http.ca_file)
end
-
+
should "use the default DEFAULT_CERT_FILE if asked to" do
config = Airbrake::Configuration.new
config.use_system_ssl_cert_chain = true
@@ -184,23 +184,23 @@ def stub_http(options = {})
http = sender.send(:setup_http_connection)
assert_not_equal http.ca_file, config.local_cert_path
end
-
+
should "verify the connection when the use_ssl option is set (VERIFY_PEER)" do
sender = build_sender(:secure => true)
http = sender.send(:setup_http_connection)
assert_equal(OpenSSL::SSL::VERIFY_PEER, http.verify_mode)
end
-
+
should "use the default cert (OpenSSL::X509::DEFAULT_CERT_FILE) only if explicitly told to" do
sender = build_sender(:secure => true)
http = sender.send(:setup_http_connection)
-
+
assert_equal(Airbrake.configuration.local_cert_path, http.ca_file)
File.stubs(:exist?).with(OpenSSL::X509::DEFAULT_CERT_FILE).returns(true)
sender = build_sender(:secure => true, :use_system_ssl_cert_chain => true)
http = sender.send(:setup_http_connection)
-
+
assert_not_equal(Airbrake.configuration.local_cert_path, http.ca_file)
assert_equal(OpenSSL::X509::DEFAULT_CERT_FILE, http.ca_file)
end
@@ -229,9 +229,9 @@ def stub_http(options = {})
assert_received(Net::HTTP, :new) {|expect| expect.with('example.org', 80) }
end
-
+
end
-
+
context "network timeouts" do
should "default the open timeout to 2 seconds" do
http = stub_http

0 comments on commit 2fb09d4

Please sign in to comment.
Something went wrong with that request. Please try again.