logstash-devutils 0.0.10-java → 0.0.12-java

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: 7877431f083dc1534560d324bf0994c3b478e71d
4
- data.tar.gz: 401a884b10e972e32c763cb1acda91906686166e
3
+ metadata.gz: 635b306c54063f2e4908bd6d0e6cc86569f6c066
4
+ data.tar.gz: 48f2292b2d850eb31dd7e6b281c318d72ed544b8
5
5
  SHA512:
6
- metadata.gz: c1c16e56f9c05385d1dcfd8d7f34bece76fcbdde383bbfc5c6d865193fca3f5c24bbce5167a3c083fa3c124c9cdf463962e95baf162cd39156c257d81f37db28
7
- data.tar.gz: d37a5649c96f9537b493413721fd0389d77b39a3daf075849a16628bd34fbb70a3c6d4cb1ade2f49b64b28bcdc33f3b3f82149e00c5fa240e1a4d4d283476ecd
6
+ metadata.gz: c772bf38abd45e9193745343db06510b7bc6246e230777f2cfc6d4f68c858f9ed897cc72fa8c023fddf5737098e8b59b870abcfbf779b3a0a855101d7c7a4ca1
7
+ data.tar.gz: 2acefbfe05c98abeeec884e326017a037f61c63257ba1d417077bf19cacc43eb9bb36987d30201afbe81e0e870767771f8e0b0ec1551f19c22c31ec6437869b7
@@ -1,6 +1,7 @@
1
1
  require "logstash/agent"
2
2
  require "logstash/pipeline"
3
3
  require "logstash/event"
4
+ require "thread"
4
5
 
5
6
  module LogStashHelper
6
7
 
@@ -36,32 +37,45 @@ module LogStashHelper
36
37
  pipeline.instance_eval { @filters.each(&:register) }
37
38
 
38
39
  event.each do |e|
39
- pipeline.filter(e) {|new_event| results << new_event }
40
+ # filter call the block on all filtered events, included new events added by the filter
41
+ pipeline.filter(e) { |filtered_event| results << filtered_event }
40
42
  end
41
43
 
42
- pipeline.flush_filters(:final => true) do |e|
43
- results << e unless e.cancelled?
44
- end
44
+ # flush makes sure to empty any buffered events in the filter
45
+ pipeline.flush_filters(:final => true) { |flushed_event| results << flushed_event }
45
46
 
46
- results
47
+ results.select { |e| !e.cancelled? }
47
48
  end
48
49
 
49
- subject { results.length > 1 ? results: results.first }
50
+ subject { results.length > 1 ? results : results.first }
50
51
 
51
52
  it("when processed", &block)
52
53
  end
53
54
  end # def sample
54
55
 
55
- def input(&block)
56
- it "inputs" do
57
- pipeline = LogStash::Pipeline.new(config)
58
- queue = Queue.new
59
- pipeline.instance_eval do
60
- @output_func = lambda { |event| queue << event }
56
+ def input(config, &block)
57
+ pipeline = LogStash::Pipeline.new(config)
58
+ queue = Queue.new
59
+
60
+ pipeline.instance_eval do
61
+ # create closure to capture queue
62
+ @output_func = lambda { |event| queue << event }
63
+
64
+ # output_func is now a method, call closure
65
+ def output_func(event)
66
+ @output_func.call(event)
61
67
  end
62
- block.call(pipeline, queue)
63
- pipeline.shutdown
64
68
  end
69
+
70
+ pipeline_thread = Thread.new { pipeline.run }
71
+ sleep 0.1 while !pipeline.ready?
72
+
73
+ result = block.call(pipeline, queue)
74
+
75
+ pipeline.shutdown
76
+ pipeline_thread.join
77
+
78
+ result
65
79
  end # def input
66
80
 
67
81
  def agent(&block)
@@ -43,8 +43,12 @@ class LogStash::Event
43
43
  end
44
44
 
45
45
  RSpec.configure do |config|
46
+ # for now both include and extend are required because the newly refactored "input" helper method need to be visible in a "it" block
47
+ # and this is only possible by calling include on LogStashHelper
48
+ config.include LogStashHelper
46
49
  config.extend LogStashHelper
47
- exclude_tags = { :redis => true, :socket => true, :performance => true, :couchdb => true, :elasticsearch => true, :elasticsearch_secure => true, :broken => true, :export_cypher => true, :integration => true }
50
+
51
+ exclude_tags = { :redis => true, :socket => true, :performance => true, :couchdb => true, :elasticsearch => true, :elasticsearch_secure => true, :export_cypher => true, :integration => true }
48
52
 
49
53
  if LogStash::Environment.windows?
50
54
  exclude_tags[:unix] = true
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  files = %x{git ls-files}.split("\n")
7
7
 
8
8
  spec.name = "logstash-devutils"
9
- spec.version = "0.0.10"
9
+ spec.version = "0.0.12"
10
10
  spec.summary = "logstash-devutils"
11
11
  spec.description = "logstash-devutils"
12
12
  spec.license = "Apache 2.0"
metadata CHANGED
@@ -1,99 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-devutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.12
5
5
  platform: java
6
6
  authors:
7
7
  - Jordan Sissel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-23 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: 2.14.0
20
14
  requirement: !ruby/object:Gem::Requirement
21
15
  requirements:
22
16
  - - ~>
23
17
  - !ruby/object:Gem::Version
24
18
  version: 2.14.0
19
+ name: rspec
25
20
  prerelease: false
26
21
  type: :runtime
27
- - !ruby/object:Gem::Dependency
28
- name: jar-dependencies
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
- - - '>='
24
+ - - ~>
32
25
  - !ruby/object:Gem::Version
33
- version: '0'
26
+ version: 2.14.0
27
+ - !ruby/object:Gem::Dependency
34
28
  requirement: !ruby/object:Gem::Requirement
35
29
  requirements:
36
30
  - - '>='
37
31
  - !ruby/object:Gem::Version
38
32
  version: '0'
33
+ name: jar-dependencies
39
34
  prerelease: false
40
35
  type: :runtime
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
36
  version_requirements: !ruby/object:Gem::Requirement
44
37
  requirements:
45
38
  - - '>='
46
39
  - !ruby/object:Gem::Version
47
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
48
42
  requirement: !ruby/object:Gem::Requirement
49
43
  requirements:
50
44
  - - '>='
51
45
  - !ruby/object:Gem::Version
52
46
  version: '0'
47
+ name: rake
53
48
  prerelease: false
54
49
  type: :runtime
55
- - !ruby/object:Gem::Dependency
56
- name: gem_publisher
57
50
  version_requirements: !ruby/object:Gem::Requirement
58
51
  requirements:
59
52
  - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
62
56
  requirement: !ruby/object:Gem::Requirement
63
57
  requirements:
64
58
  - - '>='
65
59
  - !ruby/object:Gem::Version
66
60
  version: '0'
61
+ name: gem_publisher
67
62
  prerelease: false
68
63
  type: :runtime
69
- - !ruby/object:Gem::Dependency
70
- name: minitar
71
64
  version_requirements: !ruby/object:Gem::Requirement
72
65
  requirements:
73
66
  - - '>='
74
67
  - !ruby/object:Gem::Version
75
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
76
70
  requirement: !ruby/object:Gem::Requirement
77
71
  requirements:
78
72
  - - '>='
79
73
  - !ruby/object:Gem::Version
80
74
  version: '0'
75
+ name: minitar
81
76
  prerelease: false
82
77
  type: :runtime
83
- - !ruby/object:Gem::Dependency
84
- name: insist
85
78
  version_requirements: !ruby/object:Gem::Requirement
86
79
  requirements:
87
- - - '='
80
+ - - '>='
88
81
  - !ruby/object:Gem::Version
89
- version: 1.0.0
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
90
84
  requirement: !ruby/object:Gem::Requirement
91
85
  requirements:
92
86
  - - '='
93
87
  - !ruby/object:Gem::Version
94
88
  version: 1.0.0
89
+ name: insist
95
90
  prerelease: false
96
91
  type: :runtime
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 1.0.0
97
97
  description: logstash-devutils
98
98
  email:
99
99
  - jls@semicomplete.com