Skip to content

Commit

Permalink
Update to Loggability 0.3.x.
Browse files Browse the repository at this point in the history
  • Loading branch information
ged committed Jun 7, 2012
1 parent 10911aa commit 2e1ac47
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 268 deletions.
2 changes: 1 addition & 1 deletion .rvm.gems
@@ -1,5 +1,5 @@
hoe-deveiate -v0.1.1
ruby-ldap -v0.9.12
sequel -v3.31.0
loggability -v0.2.3
loggability -v0.3.0

1 change: 0 additions & 1 deletion Manifest.txt
Expand Up @@ -39,7 +39,6 @@ lib/treequel/schema/matchingruleuse.rb
lib/treequel/schema/objectclass.rb
lib/treequel/schema/table.rb
lib/treequel/sequel_integration.rb
lib/treequel/utils.rb
spec/data/ad_schema.yml
spec/data/objectClasses.yml
spec/data/opends.yml
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Expand Up @@ -32,6 +32,8 @@ hoespec = Hoe.spec 'treequel' do
else
self.dependency 'ruby-ldap', '~> 0.9'
end
self.dependency 'loggability', '~> 0.3'

self.dependency 'rspec', '~> 2.8', :developer
self.dependency 'ruby-termios', '~> 0.9', :developer
self.dependency 'ruby-terminfo', '~> 0.1', :developer
Expand Down
179 changes: 0 additions & 179 deletions lib/treequel/utils.rb

This file was deleted.

91 changes: 4 additions & 87 deletions spec/lib/helpers.rb
Expand Up @@ -28,73 +28,13 @@
require 'spec/lib/constants'
require 'spec/lib/matchers'

### IRb.start_session, courtesy of Joel VanderWerf in [ruby-talk:42437].
require 'irb'
require 'irb/completion'

module IRB # :nodoc:
def self.start_session( obj )
unless @__initialized
args = ARGV
ARGV.replace( ARGV.dup )
IRB.setup( nil )
ARGV.replace( args )
@__initialized = true
end

workspace = WorkSpace.new( obj )
irb = Irb.new( workspace )

@CONF[:IRB_RC].call( irb.context ) if @CONF[:IRB_RC]
@CONF[:MAIN_CONTEXT] = irb.context

begin
prevhandler = Signal.trap( 'INT' ) do
irb.signal_handle
end

catch( :IRB_EXIT ) do
irb.eval_input
end
ensure
Signal.trap( 'INT', prevhandler )
end

end
end
require 'loggability/spechelpers'


### RSpec helper functions.
module Treequel::SpecHelpers
include Treequel::TestConstants

class ArrayLogger
### Create a new ArrayLogger that will append content to +array+.
def initialize( array )
@array = array
end

### Write the specified +message+ to the array.
def write( message )
@array << message
end

### No-op -- this is here just so Logger doesn't complain
def close; end

end # class ArrayLogger


unless defined?( LEVEL )
LEVEL = {
:debug => Logger::DEBUG,
:info => Logger::INFO,
:warn => Logger::WARN,
:error => Logger::ERROR,
:fatal => Logger::FATAL,
}
end

###############
module_function
###############
Expand All @@ -105,31 +45,6 @@ def vvec( ver )
end


### Reset the logging subsystem to its default state.
def reset_logging
Treequel.logger = Treequel.default_logger
Loggability.formatter = nil
Loggability.output_to( $stderr )
Loggability.level = :fatal
end


### Alter the output of the default log formatter to be pretty in SpecMate output
def setup_logging( level=:fatal )

# Only do this when executing from a spec in TextMate
if ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\.rb/)
logarray = []
Thread.current['logger-output'] = logarray
Loggability.output_to( logarray )
Loggability.format_as( :html )
Loggability.level = :debug
else
Loggability.level = level
end
end


### Make a Treequel::Directory that will use the given +conn+ object as its
### LDAP connection. Also pre-loads the schema object and fixtures some other
### external data.
Expand Down Expand Up @@ -172,7 +87,8 @@ def ldap_mod_add( attribute, *values )

### Mock with RSpec
RSpec.configure do |c|
include Treequel::TestConstants
include Treequel::TestConstants,
Loggability::SpecHelpers

c.mock_with :rspec

Expand All @@ -181,6 +97,7 @@ def ldap_mod_add( attribute, *values )
c.include( Treequel::TestConstants )
c.include( Treequel::SpecHelpers )
c.include( Treequel::Matchers )
c.include( Loggability::SpecHelpers )

c.treat_symbols_as_metadata_keys_with_true_values = true

Expand Down

0 comments on commit 2e1ac47

Please sign in to comment.