packet_io 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: de0f766fc2a121ed7bc25a479074f58dc93e2452
4
+ data.tar.gz: f22482ef3dd3664efff8f809fee1e70511189ffb
5
+ SHA512:
6
+ metadata.gz: 42509954becd1f27607e80bd97c5851e5de56021d1078fd2f927be0eb3c570a64bd1527da03765457f0304704c03946d48d311ef54578e407807d48d3f518445
7
+ data.tar.gz: 3e0a54a183aff9b264e56cba8c126167f93349e710d14bedb2d2ba63306d7a0a72f8e50f042a667cc609b7deb98b980cc9e1adc1da54f0a2d114f011bdded19f
data/.gitignore CHANGED
@@ -1,22 +1,5 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC
1
+ .yardoc
22
2
  Gemfile.lock
3
+ doc/
4
+ pkg/
5
+ .ruby-version
data/.travis.yml CHANGED
@@ -1,11 +1,5 @@
1
+ language: ruby
1
2
  rvm:
2
- - 1.8.7
3
- - 1.9.2
4
- - 1.9.3
5
- - jruby-18mode
6
- - jruby-19mode
7
- - rbx-18mode
8
- - rbx-19mode
9
- - ruby-head
10
- - jruby-head
11
- - ree
3
+ - ruby-2.4.0
4
+ - ruby-2.2.0
5
+ - ruby-2.0.0
data/LICENSE CHANGED
@@ -1,20 +1,21 @@
1
- Copyright (c) 2009 Levin Alexander
1
+ MIT License
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
3
+ Copyright (c) 2009-2017 Levin Alexander
10
4
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
13
11
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # packet_io
2
+
3
+ by Levin Alexander
4
+ http://levinalex.net/
5
+
6
+ [![Build Status](https://travis-ci.org/levinalex/packet_io.svg?branch=master)](https://travis-ci.org/levinalex/packet_io)
7
+
8
+
9
+ ## DESCRIPTION:
10
+
11
+ packet_io is a small library that makes it easy
12
+ to define packet based protocols over a serial link (RS232) in a
13
+ declarative fashion.
14
+
15
+ ## SYNOPSIS:
16
+
17
+ require 'packet_io'
18
+
19
+ # define your protocol handler, inheriting from PacketIO::Base
20
+ #
21
+ # override `read` and `write` to implement your functionality
22
+ #
23
+ # this is a simple protocol handler that does nothing.
24
+ #
25
+ # see {PacketIO::LineBasedProtocol} for another trivial example
26
+ #
27
+ class MyNOPProtocol < PacketIO::Base
28
+ def receive(packet)
29
+ forward(packet)
30
+ end
31
+
32
+ def write(data)
33
+ super(packet)
34
+ end
35
+ end
36
+
37
+ # use your protocol. It is possible to stack multiple protocol
38
+ # layers on top of each other
39
+ #
40
+ stream = PacketIO.IOListener(File.open("/dev/ttyUSB0"))
41
+ line_based = PacketIO::LineBasedProtocol.new(stream)
42
+ my_protocol = MyNOPProtocol.new(line_based)
43
+
44
+
45
+ stream.run!
46
+
47
+ ## INSTALL:
48
+
49
+ gem install packet_io
50
+
data/lib/packet_io.rb CHANGED
@@ -1,8 +1,7 @@
1
1
 
2
2
  module PacketIO
3
- VERSION = '0.4.3'
3
+ VERSION = '0.4.4'
4
4
  end
5
5
 
6
- require 'strscan'
7
6
  require 'packet_io/io_listener'
8
7
 
@@ -1,3 +1,5 @@
1
+ require "strscan"
2
+
1
3
  module PacketIO
2
4
 
3
5
  # a chainable IO-Listener that provides two methods:
@@ -80,7 +82,7 @@ module PacketIO
80
82
  class LineBasedProtocol < Base
81
83
  def initialize(*args)
82
84
  super
83
- @buffer = StringScanner.new("")
85
+ @buffer = ::StringScanner.new("")
84
86
  end
85
87
 
86
88
  # strip newlines from received data and pass on complete lines
data/packet_io.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.summary = %q{define packet based protocols in a declarative fashion}
21
21
 
22
22
  s.add_dependency "rake"
23
- s.add_development_dependency("minitest", ">= 3.3.0")
23
+ s.add_development_dependency("minitest", "~> 5.10")
24
24
  s.add_development_dependency("yard", ["~> 0.7", "~> 0.8"])
25
25
  end
26
26
 
@@ -1,4 +1,8 @@
1
- require 'helper'
1
+ require 'minitest'
2
+ require 'minitest/autorun'
3
+
4
+ require 'packet_io'
5
+ require 'packet_io/test/mock_server'
2
6
 
3
7
  describe "a server" do
4
8
  before do
metadata CHANGED
@@ -1,68 +1,61 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packet_io
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
5
- prerelease:
4
+ version: 0.4.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Levin Alexander
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-22 00:00:00.000000000 Z
11
+ date: 2017-02-18 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: minitest
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: 3.3.0
33
+ version: '5.10'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: 3.3.0
40
+ version: '5.10'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: yard
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0.7'
54
- - - ~>
48
+ - - "~>"
55
49
  - !ruby/object:Gem::Version
56
50
  version: '0.8'
57
51
  type: :development
58
52
  prerelease: false
59
53
  version_requirements: !ruby/object:Gem::Requirement
60
- none: false
61
54
  requirements:
62
- - - ~>
55
+ - - "~>"
63
56
  - !ruby/object:Gem::Version
64
57
  version: '0.7'
65
- - - ~>
58
+ - - "~>"
66
59
  - !ruby/object:Gem::Version
67
60
  version: '0.8'
68
61
  description: ''
@@ -71,46 +64,41 @@ executables: []
71
64
  extensions: []
72
65
  extra_rdoc_files: []
73
66
  files:
74
- - .document
75
- - .gitignore
76
- - .travis.yml
67
+ - ".gitignore"
68
+ - ".travis.yml"
77
69
  - Gemfile
78
70
  - History.txt
79
71
  - LICENSE
80
- - README.markdown
72
+ - README.md
81
73
  - Rakefile
82
74
  - lib/packet_io.rb
83
75
  - lib/packet_io/io_listener.rb
84
76
  - lib/packet_io/test/mock_server.rb
85
77
  - packet_io.gemspec
86
- - test/helper.rb
87
78
  - test/test_io_listener.rb
88
79
  homepage: http://github.com/levinalex/packet_io
89
80
  licenses: []
81
+ metadata: {}
90
82
  post_install_message:
91
83
  rdoc_options:
92
- - --charset=UTF-8
84
+ - "--charset=UTF-8"
93
85
  require_paths:
94
86
  - lib
95
87
  required_ruby_version: !ruby/object:Gem::Requirement
96
- none: false
97
88
  requirements:
98
- - - ! '>='
89
+ - - ">="
99
90
  - !ruby/object:Gem::Version
100
91
  version: '0'
101
92
  required_rubygems_version: !ruby/object:Gem::Requirement
102
- none: false
103
93
  requirements:
104
- - - ! '>='
94
+ - - ">="
105
95
  - !ruby/object:Gem::Version
106
96
  version: '0'
107
97
  requirements: []
108
98
  rubyforge_project:
109
- rubygems_version: 1.8.23
99
+ rubygems_version: 2.6.8
110
100
  signing_key:
111
- specification_version: 3
101
+ specification_version: 4
112
102
  summary: define packet based protocols in a declarative fashion
113
103
  test_files:
114
- - test/helper.rb
115
104
  - test/test_io_listener.rb
116
- has_rdoc:
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/README.markdown DELETED
@@ -1,71 +0,0 @@
1
- # packet_io
2
-
3
- by Levin Alexander
4
- http://levinalex.net/
5
-
6
- ## DESCRIPTION:
7
-
8
- packet_io is a small library that makes it easy
9
- to define packet based protocols over a serial link (RS232) in a
10
- declarative fashion.
11
-
12
- ## SYNOPSIS:
13
-
14
- require 'packet_io'
15
-
16
- # define your protocol handler, inheriting from PacketIO::Base
17
- #
18
- # override `read` and `write` to implement your functionality
19
- #
20
- # this is a simple protocol handler that does nothing.
21
- #
22
- # see {PacketIO::LineBasedProtocol} for another trivial example
23
- #
24
- class MyNOPProtocol < PacketIO::Base
25
- def receive(packet)
26
- forward(packet)
27
- end
28
-
29
- def write(data)
30
- super(packet)
31
- end
32
- end
33
-
34
- # use your protocol. It is possible to stack multiple protocol
35
- # layers on top of each other
36
- #
37
- stream = PacketIO.IOListener(File.open("/dev/ttyUSB0"))
38
- line_based = PacketIO::LineBasedProtocol.new(stream)
39
- my_protocol = MyNOPProtocol.new(line_based)
40
-
41
-
42
- stream.run!
43
-
44
- ## INSTALL:
45
-
46
- gem install packet_io
47
-
48
- ## LICENSE:
49
-
50
- (The MIT License)
51
-
52
- Copyright (c) 2006-2011 Levin Alexander
53
-
54
- Permission is hereby granted, free of charge, to any person obtaining
55
- a copy of this software and associated documentation files (the
56
- 'Software'), to deal in the Software without restriction, including
57
- without limitation the rights to use, copy, modify, merge, publish,
58
- distribute, sublicense, and/or sell copies of the Software, and to
59
- permit persons to whom the Software is furnished to do so, subject to
60
- the following conditions:
61
-
62
- The above copyright notice and this permission notice shall be
63
- included in all copies or substantial portions of the Software.
64
-
65
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
66
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
67
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
68
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
69
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
70
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
71
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/test/helper.rb DELETED
@@ -1,6 +0,0 @@
1
- require 'minitest/spec'
2
- require 'minitest/autorun'
3
-
4
- require 'packet_io'
5
- require 'packet_io/test/mock_server'
6
-