flnt 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36241968a567600f6af996589ca58ba338600e54
4
- data.tar.gz: 7b535e3f4334687613c1d7cf34b98e0a8420c62e
3
+ metadata.gz: a9b2acd326993c550068ab0e17c5785fdc519eed
4
+ data.tar.gz: aa3550730b3576dde36bbdfbaaa45fb2bc787733
5
5
  SHA512:
6
- metadata.gz: b33beec07ecde402cc773e479a581d54352fb6177d88b6ffe38d68357d37bd8a073b1d5e805f82d036b7d64e47a760f7bc61ff05b6aa07b7b751115807417f23
7
- data.tar.gz: eb1129fb9a410681abab248a010dc96fc8d5d4a40ba19fa044b78a441770180f8025b55e22fd92590946343b2e7211f1488c533c9f166b25ab8af87798c11be2
6
+ metadata.gz: 278588d6e9cd876ae04bd1b109294bb87a94b618298e5b3cbe892d5944691b34a58cf3d76a04adffeee3d5a39d49f1523e40dfd1ed8d4c3f2766babf35c0ba40
7
+ data.tar.gz: c42b2a84703cc3597d2e17bede59560e7af9fc9eb7023e58c68d4400aa5912256bcafa94f7ff9eaffb5ccc41121fe141ed7c110c4f1347d5ca95cafff3b37f14
data/lib/flnt.rb CHANGED
@@ -28,8 +28,8 @@ module Flnt
28
28
  !! @initialized
29
29
  end
30
30
 
31
- def initialize!
32
- if !initialized? and !test_mode?
31
+ def initialize!(force=false)
32
+ if force or ( !initialized? and !test_mode? )
33
33
  @initialized = true
34
34
  Fluent::Logger::FluentLogger.open(*Flnt::Configuration())
35
35
  end
@@ -1,3 +1,5 @@
1
+ require 'flnt'
2
+
1
3
  module Flnt
2
4
  module Configuration
3
5
  class << self
@@ -23,6 +25,7 @@ module Flnt
23
25
 
24
26
  def configure &b
25
27
  b.call(self)
28
+ ::Flnt.initialize!(true)
26
29
  end
27
30
  end
28
31
  end
data/lib/flnt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Flnt
2
- VERSION = "0.3.3"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -31,6 +31,16 @@ describe "Flnt::Configuration" do
31
31
  )
32
32
  end
33
33
 
34
+ it "should be force to hook Flint.initialize!(true)" do
35
+ allow(Flnt).to receive(:initialized?).and_return(true)
36
+ expect(Fluent::Logger::FluentLogger).to receive(:open)
37
+ expect(Flnt).to receive(:Configuration)
38
+
39
+ Flnt::Configuration.configure do |c|
40
+ c.host = 'fluentd.example.jp'
41
+ end
42
+ end
43
+
34
44
  after do
35
45
  Flnt::Configuration.instance_eval do
36
46
  @host = nil
@@ -26,6 +26,14 @@ describe "Flnt" do
26
26
  Flnt.init_foo
27
27
  end
28
28
 
29
+ it "should be able to force to initialize fluentd connection" do
30
+ allow(Flnt).to receive(:initialized?).and_return(true)
31
+
32
+ expect(Fluent::Logger::FluentLogger).to receive(:open)
33
+ expect(Flnt).to receive(:Configuration)
34
+ Flnt.initialize!(true)
35
+ end
36
+
29
37
  it "should return Flnt::Logger tagged with called method name" do
30
38
  ret = Flnt.init_foo
31
39
  expect(ret.instance_eval { @tag }).to eq "init_foo"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flnt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uchio KONDO
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-10 00:00:00.000000000 Z
11
+ date: 2015-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluent-logger