packet_io 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ 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
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'packet_io'
7
7
 
8
8
  require 'rake/testtask'
9
9
  Rake::TestTask.new(:test) do |test|
10
- test.libs << 'lib' << 'test'
10
+ test.libs << 'test'
11
11
  end
12
12
 
13
13
  require 'yard'
data/lib/packet_io.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  module PacketIO
3
- VERSION = '0.4.1'
3
+ VERSION = '0.4.2'
4
4
  end
5
5
 
6
6
  require 'strscan'
@@ -67,8 +67,8 @@ module PacketIO
67
67
  #
68
68
  # @return [nil]
69
69
  #
70
- def receive(data)
71
- forward(data)
70
+ def receive(*data)
71
+ forward(*data)
72
72
  end
73
73
 
74
74
  def forward(*data)
@@ -78,15 +78,18 @@ module PacketIO
78
78
 
79
79
 
80
80
  class LineBasedProtocol < Base
81
+ def initialize(*args)
82
+ super
83
+ @buffer = StringScanner.new("")
84
+ end
81
85
 
82
86
  # strip newlines from received data and pass on complete lines
83
87
  #
84
88
  # @param [String] data
85
89
  #
86
90
  def receive(data)
87
- @data ||= StringScanner.new("")
88
- @data = @data.concat(data)
89
- while s = @data.scan(/.*?\n/)
91
+ @buffer.concat(data)
92
+ while s = @buffer.scan(/.*?\n/)
90
93
  forward(s.strip)
91
94
  end
92
95
  nil
@@ -1,3 +1,5 @@
1
+ require 'thread'
2
+
1
3
  module PacketIO::Test
2
4
 
3
5
  # a threaded reader that simulates a remote server to help testing io_listener
data/packet_io.gemspec CHANGED
@@ -19,6 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
  s.summary = %q{define packet based protocols in a declarative fashion}
21
21
 
22
- s.add_development_dependency("yard", ["~> 0.7.1"])
22
+ s.add_dependency "rake"
23
+ s.add_development_dependency("minitest", "~> 3.2.0")
24
+ s.add_development_dependency("yard", ["~> 0.7", "~> 0.8"])
23
25
  end
24
26
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packet_io
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,20 +9,62 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-12 00:00:00.000000000 +02:00
13
- default_executable:
12
+ date: 2012-07-10 00:00:00.000000000 Z
14
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: minitest
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 3.2.0
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 3.2.0
15
46
  - !ruby/object:Gem::Dependency
16
47
  name: yard
17
- requirement: &2153248860 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
18
49
  none: false
19
50
  requirements:
20
51
  - - ~>
21
52
  - !ruby/object:Gem::Version
22
- version: 0.7.1
53
+ version: '0.7'
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: '0.8'
23
57
  type: :development
24
58
  prerelease: false
25
- version_requirements: *2153248860
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ~>
63
+ - !ruby/object:Gem::Version
64
+ version: '0.7'
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: '0.8'
26
68
  description: ''
27
69
  email: mail@levinalex.net
28
70
  executables: []
@@ -31,6 +73,7 @@ extra_rdoc_files: []
31
73
  files:
32
74
  - .document
33
75
  - .gitignore
76
+ - .travis.yml
34
77
  - Gemfile
35
78
  - History.txt
36
79
  - LICENSE
@@ -42,7 +85,6 @@ files:
42
85
  - packet_io.gemspec
43
86
  - test/helper.rb
44
87
  - test/test_io_listener.rb
45
- has_rdoc: true
46
88
  homepage: http://github.com/levinalex/packet_io
47
89
  licenses: []
48
90
  post_install_message:
@@ -56,18 +98,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
98
  - - ! '>='
57
99
  - !ruby/object:Gem::Version
58
100
  version: '0'
101
+ segments:
102
+ - 0
103
+ hash: 2074572682123756861
59
104
  required_rubygems_version: !ruby/object:Gem::Requirement
60
105
  none: false
61
106
  requirements:
62
107
  - - ! '>='
63
108
  - !ruby/object:Gem::Version
64
109
  version: '0'
110
+ segments:
111
+ - 0
112
+ hash: 2074572682123756861
65
113
  requirements: []
66
114
  rubyforge_project:
67
- rubygems_version: 1.6.2
115
+ rubygems_version: 1.8.24
68
116
  signing_key:
69
117
  specification_version: 3
70
118
  summary: define packet based protocols in a declarative fashion
71
119
  test_files:
72
120
  - test/helper.rb
73
121
  - test/test_io_listener.rb
122
+ has_rdoc: