fluent-plugin-serialport 0.1.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/fluent-plugin-serialport.gemspec +2 -2
- data/lib/fluent/plugin/in_serialport.rb +15 -16
- data/test/plugin/test_in_serialport.rb +2 -3
- data/test/test_helper.rb +4 -22
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d30caee6ecd937883c1072505107f41f207b65c
|
4
|
+
data.tar.gz: 4cbc230c9d0aa38738dd596380728901be04dc6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 596feb2a869f42ccd0af4d5cdd8f0c0e24aaca53254dbede892b646dab121a7e18118c9976b4627a39dbf3c9148f923a53facf2bcdcf42c8eef8a39f99ee981b
|
7
|
+
data.tar.gz: cff51fcecc7eaba5e901d13ac843ee64bb6a43e87fe343d3fd42b6670668e65b778c2888fadce3e09fd2b18639ffd330e56be3ceac37ecfd302eafbae9cad0b7
|
data/.travis.yml
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fluent-plugin-serialport"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.14.0"
|
7
7
|
s.authors = ["MATSUMOTO Katsuyoshi"]
|
8
8
|
s.email = ["github@katsyoshi.org"]
|
9
9
|
s.homepage = "https://github.com/katsyoshi/fluent-plugin-serialport"
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
|
20
|
-
s.add_dependency "fluentd"
|
20
|
+
s.add_dependency "fluentd", ">= 0.14", "< 2"
|
21
21
|
s.add_dependency "serialport"
|
22
22
|
s.add_development_dependency "simplecov"
|
23
23
|
s.add_development_dependency "test-unit"
|
@@ -1,19 +1,17 @@
|
|
1
1
|
require 'fluent/input'
|
2
|
-
|
3
|
-
class SerialPortInput < Input
|
4
|
-
Plugin.register_input('serialport', self)
|
5
|
-
config_param :com_port, :string
|
6
|
-
config_param :baud_rate, :integer
|
7
|
-
config_param :tag, :string, :default => "serial"
|
8
|
-
config_param :eol, :string, :default => $/
|
9
|
-
config_param :include_time, :bool, :default => false
|
2
|
+
require 'serialport'
|
10
3
|
|
11
|
-
|
4
|
+
module Fluent::Plugin
|
5
|
+
class SerialPortInput < Fluent::Plugin::Input
|
6
|
+
Fluent::Plugin.register_input('serialport', self)
|
12
7
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
helpers :thread
|
9
|
+
|
10
|
+
config_param :com_port, :string
|
11
|
+
config_param :baud_rate, :integer
|
12
|
+
config_param :tag, :string, default: "serial"
|
13
|
+
config_param :eol, :string, default: $/
|
14
|
+
config_param :include_time, :bool, default: false
|
17
15
|
|
18
16
|
def configure(conf)
|
19
17
|
super
|
@@ -21,13 +19,14 @@ class SerialPortInput < Input
|
|
21
19
|
end
|
22
20
|
|
23
21
|
def start
|
22
|
+
super
|
24
23
|
@serial = SerialPort.new(@com_port, @baud_rate, 8, 1, SerialPort::NONE)
|
25
|
-
|
24
|
+
thread_create(:in_serialport, &method(:run))
|
26
25
|
end
|
27
26
|
|
28
27
|
def shutdown
|
29
28
|
@serial.close
|
30
|
-
|
29
|
+
super
|
31
30
|
end
|
32
31
|
|
33
32
|
def run
|
@@ -38,7 +37,7 @@ class SerialPortInput < Input
|
|
38
37
|
data = {@device => timenow << @serial.readline(@eol)}
|
39
38
|
router.emit(@tag, Engine.now, data)
|
40
39
|
rescue
|
41
|
-
|
40
|
+
$stderr.puts(caller) unless stopped?
|
42
41
|
break
|
43
42
|
end
|
44
43
|
end
|
@@ -1,9 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
3
|
class SerialPortInputTest < Test::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
Fluent::Test.setup
|
6
|
-
require 'fluent/plugin/in_serialport'
|
7
6
|
end
|
8
7
|
|
9
8
|
CONFIG = %[
|
@@ -15,7 +14,7 @@ class SerialPortInputTest < Test::Unit::TestCase
|
|
15
14
|
]
|
16
15
|
|
17
16
|
def create_driver(conf=CONFIG)
|
18
|
-
Fluent::Test::
|
17
|
+
Fluent::Test::Driver::Input.new(Fluent::Plugin::SerialPortInput).configure(conf)
|
19
18
|
end
|
20
19
|
|
21
20
|
def test_configure_test_driver
|
data/test/test_helper.rb
CHANGED
@@ -1,30 +1,12 @@
|
|
1
|
-
require 'bundler'
|
1
|
+
require 'bundler/setup'
|
2
2
|
require 'simplecov'
|
3
3
|
SimpleCov.start
|
4
4
|
|
5
|
-
begin
|
6
|
-
Bundler.setup(:default, :development)
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
$stderr.puts e.message
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
11
|
-
end
|
12
5
|
require 'test/unit'
|
13
6
|
|
14
|
-
$LOAD_PATH.unshift(File.join(
|
15
|
-
$LOAD_PATH.unshift(
|
7
|
+
$LOAD_PATH.unshift(File.join(__dir__, '..', 'lib'))
|
8
|
+
$LOAD_PATH.unshift(__dir__)
|
16
9
|
require 'fluent/test'
|
17
|
-
|
18
|
-
nulllogger = Object.new
|
19
|
-
nulllogger.instance_eval {|obj|
|
20
|
-
def method_missing(method, *args)
|
21
|
-
# pass
|
22
|
-
end
|
23
|
-
}
|
24
|
-
$log = nulllogger
|
25
|
-
end
|
10
|
+
require 'fluent/test/driver/input'
|
26
11
|
|
27
12
|
require 'fluent/plugin/in_serialport'
|
28
|
-
|
29
|
-
class Test::Unit::TestCase
|
30
|
-
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-serialport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MATSUMOTO Katsuyoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '0.14'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
29
|
+
version: '0.14'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: serialport
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
123
|
version: '0'
|
118
124
|
requirements: []
|
119
125
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.6.11
|
121
127
|
signing_key:
|
122
128
|
specification_version: 4
|
123
129
|
summary: fluentd plugin for serial port
|