Skip to content
Browse files

Making sure classes don't get required more than once (no matter what)

  • Loading branch information...
1 parent adaf38b commit a1f5780150e28728a6857c70555e391145193c2d @winton committed Dec 7, 2009
Showing with 15 additions and 13 deletions.
  1. +1 −1 lib/capistrano/lilypad.rb
  2. +10 −8 lib/lilypad.rb
  3. +3 −3 lib/lilypad/hoptoad/notify.rb
  4. +1 −1 lib/rack/lilypad.rb
View
2 lib/capistrano/lilypad.rb
@@ -1,4 +1,4 @@
-require File.expand_path("#{File.dirname __FILE__}/../lilypad") unless defined?(::Lilypad)
+require File.expand_path("#{File.dirname __FILE__}/../lilypad")
Capistrano::Configuration.instance(:must_exist).load do
View
18 lib/lilypad.rb
@@ -2,14 +2,16 @@
require 'net/http'
require 'rack'
-lib = File.dirname(__FILE__)
-require "#{lib}/lilypad/config"
-require "#{lib}/lilypad/config/request"
-require "#{lib}/lilypad/log"
-require "#{lib}/lilypad/hoptoad/deploy"
-require "#{lib}/lilypad/hoptoad/notify"
-require "#{lib}/lilypad/hoptoad/xml"
-require "#{lib}/rack/lilypad"
+unless defined?(::Lilypad)
+ lib = File.dirname(__FILE__)
+ require "#{lib}/lilypad/config"
+ require "#{lib}/lilypad/config/request"
+ require "#{lib}/lilypad/log"
+ require "#{lib}/lilypad/hoptoad/deploy"
+ require "#{lib}/lilypad/hoptoad/notify"
+ require "#{lib}/lilypad/hoptoad/xml"
+ require "#{lib}/rack/lilypad"
+end
class Lilypad
class <<self
View
6 lib/lilypad/hoptoad/notify.rb
@@ -27,6 +27,9 @@ def initialize(env, exception)
private
+ class Backtrace < Struct.new(:file, :number, :method)
+ end
+
def backtrace
regex = %r{^([^:]+):(\d+)(?::in `([^']+)')?$}
@exception.backtrace.map do |line|
@@ -79,9 +82,6 @@ def parse
def success?
@response.class.superclass == Net::HTTPSuccess
end
-
- class Backtrace < Struct.new(:file, :number, :method)
- end
end
end
end
View
2 lib/rack/lilypad.rb
@@ -1,4 +1,4 @@
-require File.expand_path("#{File.dirname __FILE__}/../lilypad") unless defined?(::Lilypad)
+require File.expand_path("#{File.dirname __FILE__}/../lilypad")
module Rack
class Lilypad

0 comments on commit a1f5780

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