yell 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/yell.rb CHANGED
@@ -5,8 +5,6 @@ module Yell
5
5
  autoload :Logger, File.dirname(__FILE__) + '/yell/logger'
6
6
  autoload :Adapters, File.dirname(__FILE__) + '/yell/adapters'
7
7
 
8
- # custom errors
9
- class NoAdaptersDefined < StandardError; end
10
8
  class NoSuchAdapter < StandardError; end
11
9
 
12
10
 
data/lib/yell/adapters.rb CHANGED
@@ -13,6 +13,8 @@ module Yell
13
13
  end
14
14
 
15
15
  klass.new( options, &block )
16
+ rescue NameError => e
17
+ raise Yell::NoSuchAdapter, "no such adapter #{type.inspect}"
16
18
  end
17
19
 
18
20
  end
data/lib/yell/logger.rb CHANGED
@@ -2,7 +2,7 @@ module Yell
2
2
  class Logger
3
3
  Levels = [ 'debug', 'info', 'warn', 'error', 'fatal', 'unknown' ]
4
4
 
5
-
5
+
6
6
  def initialize( *args, &block )
7
7
  @adapters = []
8
8
 
@@ -26,7 +26,7 @@ module Yell
26
26
  def adapter ( type, options = {}, &block )
27
27
  @adapters << Yell::Adapters.new( type, @options.merge(options), &block )
28
28
  rescue LoadError => e
29
-
29
+ raise Yell::NoSuchAdapter, e.message
30
30
  end
31
31
 
32
32
  def level ( val )
data/lib/yell/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Yell
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
 
4
4
  end
data/spec/spec.opts ADDED
@@ -0,0 +1,3 @@
1
+ --colour
2
+ --format progress
3
+ --backtrace
@@ -0,0 +1,20 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+
4
+ require 'yell'
5
+
6
+ require 'rspec'
7
+ require 'timecop'
8
+
9
+ RSpec.configure do |config|
10
+
11
+ config.before do
12
+ Yell.config.stub!( :yaml_file ).and_return( File.dirname(__FILE__) + '/config/yell.yml' )
13
+ end
14
+
15
+ config.after do
16
+ Yell.config.reload! # to not run into caching problems during tests
17
+ end
18
+
19
+ end
20
+
data/spec/yell_spec.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Yell do
4
+
5
+ describe "a new Yell instance" do
6
+ let( :logger ) { Yell.new }
7
+
8
+ it "should return a Yell::Logger" do
9
+ logger.should be_kind_of( Yell::Logger )
10
+ end
11
+
12
+ it "should raise NoSuchAdapter when adapter cant be loaded" do
13
+ lambda { Yell.new :unknownadapter }.should raise_error( Yell::NoSuchAdapter )
14
+ end
15
+ end
16
+
17
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -30,6 +30,9 @@ files:
30
30
  - lib/yell/formatter.rb
31
31
  - lib/yell/logger.rb
32
32
  - lib/yell/version.rb
33
+ - spec/spec.opts
34
+ - spec/spec_helper.rb
35
+ - spec/yell_spec.rb
33
36
  - yell.gemspec
34
37
  homepage: http://rubygems.org/gems/yell
35
38
  licenses: []