logstash-input-yasuri 2.0.4 → 2.0.5

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: 01cf6f81b0de10a81ff1ddf0cd447e9d9b403fbd
4
- data.tar.gz: 25c33d37b927c64bf413709386b500fad9a34ac8
3
+ metadata.gz: 8a398466bd2c3c647f1af3ce24d4d85a4e3fda4e
4
+ data.tar.gz: 52b05b250914f5b625cebabdad0ee6cc146e2a96
5
5
  SHA512:
6
- metadata.gz: 513917038a3714b3eacd95374446f6ff982c9744101630da21dc350fae34f047ac15ab6eaff80bff00e2d4845c215898ec9dab5685a1baa92794e95b05f02149
7
- data.tar.gz: d923a7ffebee5d919046ba0479d9b02eed495307d679ac67d05642df1bf8600b4242a7efb8a5196e0588ded9886673dafb243e3d9aa68a18be777daed6f7afa0
6
+ metadata.gz: acf625642555c0b701e192c56a187c8ccf47c6b38bd0821b8a26a406a7dba9eef113903f502f95075758e2168e52dd82b7944ac38583fe6f7ffb12e3c00853e2
7
+ data.tar.gz: 98bea8ee7ef765d86edb800f43a9fc2a0829469acbab81431a6e3f67243cd6544a84438d6da19fe8d15008af928ca161e7885efbc19e1055228b81ae2e0c51bb
@@ -2,6 +2,7 @@
2
2
  require "logstash/inputs/base"
3
3
  require "logstash/namespace"
4
4
  require "socket" # for Socket.gethostname
5
+ require "rufus-scheduler"
5
6
  require "mechanize"
6
7
  require "yasuri"
7
8
 
@@ -26,12 +27,13 @@ class LogStash::Inputs::Yasuri < LogStash::Inputs::Base
26
27
  # Split each results to individual events (struct or pages)
27
28
  config :split, :default => false
28
29
 
29
- config :interval, :validate => :number, :default => 60
30
+ config :cron, :validate => :string, :default => '* * * * *'
30
31
 
31
32
  public
32
33
  def register
33
34
  @host = Socket.gethostname
34
35
  @agent = Mechanize.new
36
+ @scheduler = Rufus::Scheduler.new
35
37
 
36
38
  # If given both, logstash-input-yasuri use :parse_tree.
37
39
  tree = @parse_tree || File.read(@parse_tree_path)
@@ -41,14 +43,13 @@ class LogStash::Inputs::Yasuri < LogStash::Inputs::Base
41
43
 
42
44
  def run(queue)
43
45
  # we can abort the loop if stop? becomes true
44
- while !stop?
46
+ scheduler.cron @cron do
45
47
  # because the sleep interval can be big, when shutdown happens
46
48
  # we want to be able to abort the sleep
47
49
  # Stud.stoppable_sleep will frequently evaluate the given block
48
50
  # and abort the sleep(@interval) if the return value is true
49
51
  inner_run(queue)
50
- Stud.stoppable_sleep(@interval) { stop? }
51
- end # loop
52
+ end
52
53
  end # def run
53
54
 
54
55
  def stop
@@ -57,6 +58,7 @@ class LogStash::Inputs::Yasuri < LogStash::Inputs::Base
57
58
  # * close sockets (unblocking blocking reads/accepts)
58
59
  # * cleanup temporary files
59
60
  # * terminate spawned threads
61
+ @scheduler.shutdown
60
62
  end
61
63
 
62
64
  def inner_run(queue)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-yasuri'
3
- s.version = '2.0.4'
3
+ s.version = '2.0.5'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Web scraping input plugin for logstash."
6
6
  s.description = "Web scraping input plugin for logstash."
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_runtime_dependency 'logstash-core-plugin-api', '~> 1'
22
22
  s.add_runtime_dependency 'stud', '>= 0.0.22'
23
23
  s.add_runtime_dependency 'yasuri', '~> 1.9'
24
+ s.add_runtime_dependency 'rufus-scheduler', '>= 0'
24
25
 
25
26
  s.add_development_dependency 'logstash-devutils', '>= 0.0.16'
26
27
  s.add_development_dependency 'logstash-codec-plain'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-yasuri
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - tac0x2a
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-12 00:00:00.000000000 Z
11
+ date: 2016-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.9'
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ name: rufus-scheduler
62
+ prerelease: false
63
+ type: :runtime
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  requirement: !ruby/object:Gem::Requirement
57
71
  requirements: