ruby_fs 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +3 -0
- data/Guardfile +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/Rakefile +1 -3
- data/lib/ruby_fs/stream.rb +4 -5
- data/lib/ruby_fs/version.rb +1 -1
- data/ruby_fs.gemspec +3 -7
- data/spec/ruby_fs/stream_spec.rb +7 -4
- data/spec/spec_helper.rb +1 -17
- metadata +14 -77
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Guardfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -2,14 +2,12 @@ require 'bundler/gem_tasks'
|
|
2
2
|
|
3
3
|
require 'rspec/core'
|
4
4
|
require 'rspec/core/rake_task'
|
5
|
-
require 'ci/reporter/rake/rspec'
|
6
5
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
7
6
|
spec.pattern = 'spec/**/*_spec.rb'
|
8
7
|
spec.rspec_opts = '--color'
|
9
8
|
end
|
10
9
|
|
11
|
-
task :default =>
|
12
|
-
task :ci => ['ci:setup:rspec', :spec]
|
10
|
+
task :default => :spec
|
13
11
|
|
14
12
|
require 'yard'
|
15
13
|
YARD::Rake::YardocTask.new
|
data/lib/ruby_fs/stream.rb
CHANGED
@@ -35,8 +35,8 @@ module RubyFS
|
|
35
35
|
@socket = TCPSocket.from_ruby_socket ::TCPSocket.new(@host, @port)
|
36
36
|
post_init
|
37
37
|
loop { receive_data @socket.readpartial(4096) }
|
38
|
-
rescue EOFError, IOError, Errno::ECONNREFUSED
|
39
|
-
logger.info "Client socket closed!"
|
38
|
+
rescue EOFError, IOError, Errno::ECONNREFUSED => e
|
39
|
+
logger.info "Client socket closed due to (#{e.class}) #{e.message}!"
|
40
40
|
terminate
|
41
41
|
end
|
42
42
|
|
@@ -113,13 +113,12 @@ module RubyFS
|
|
113
113
|
|
114
114
|
#
|
115
115
|
# Shutdown the stream and disconnect from the socket
|
116
|
-
|
117
|
-
@socket.close if @socket
|
118
|
-
end
|
116
|
+
alias :shutdown :terminate
|
119
117
|
|
120
118
|
# @private
|
121
119
|
def finalize
|
122
120
|
logger.debug "Finalizing stream"
|
121
|
+
@socket.close if @socket
|
123
122
|
@state = :stopped
|
124
123
|
fire_event Disconnected.new
|
125
124
|
end
|
data/lib/ruby_fs/version.rb
CHANGED
data/ruby_fs.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = RubyFS::VERSION
|
8
8
|
s.authors = ["Ben Langfeld"]
|
9
9
|
s.email = ["ben@langfeld.me"]
|
10
|
-
s.homepage = ""
|
10
|
+
s.homepage = "https://github.com/adhearsion/ruby_fs"
|
11
11
|
s.summary = %q{Wrapping FreeSWITCH EventSocket for rubyists}
|
12
12
|
s.description = %q{A Ruby client library for the FreeSWITCH EventSocket API built on Celluloid.}
|
13
13
|
|
@@ -23,12 +23,8 @@ Gem::Specification.new do |s|
|
|
23
23
|
|
24
24
|
s.add_development_dependency %q<bundler>, ["~> 1.0"]
|
25
25
|
s.add_development_dependency %q<rspec>, [">= 2.5.0"]
|
26
|
-
s.add_development_dependency %q<
|
27
|
-
s.add_development_dependency %q<yard>, ["~> 0.6.0"]
|
26
|
+
s.add_development_dependency %q<yard>, ["~> 0.6"]
|
28
27
|
s.add_development_dependency %q<rake>, [">= 0"]
|
29
|
-
s.add_development_dependency %q<mocha>, [">= 0"]
|
30
|
-
s.add_development_dependency %q<simplecov>, [">= 0"]
|
31
|
-
s.add_development_dependency %q<simplecov-rcov>, [">= 0"]
|
32
28
|
s.add_development_dependency %q<guard-rspec>
|
33
|
-
s.add_development_dependency %q<
|
29
|
+
s.add_development_dependency %q<rb-fsevent>, ['~> 0.9']
|
34
30
|
end
|
data/spec/ruby_fs/stream_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'timeout'
|
2
3
|
|
3
4
|
module RubyFS
|
4
5
|
describe Stream do
|
@@ -30,22 +31,24 @@ module RubyFS
|
|
30
31
|
|
31
32
|
def mocked_server(times = nil, fake_client = nil, &block)
|
32
33
|
mock_target = MockServer.new
|
33
|
-
mock_target.
|
34
|
+
mock_target.should_receive(:receive_data).send(*(times ? [:exactly, times] : [:at_least, 1])).with &block
|
34
35
|
s = ServerMock.new '127.0.0.1', server_port, mock_target
|
35
36
|
@stream = Stream.new '127.0.0.1', server_port, secret, lambda { |m| client.message_received m }, events
|
36
37
|
@stream.run!
|
37
38
|
sleep 0.1
|
38
39
|
fake_client.call s if fake_client.respond_to? :call
|
39
40
|
Celluloid::Actor.join s
|
40
|
-
|
41
|
+
Timeout.timeout 5 do
|
42
|
+
Celluloid::Actor.join @stream
|
43
|
+
end
|
41
44
|
end
|
42
45
|
|
43
46
|
def expect_connected_event
|
44
|
-
client.
|
47
|
+
client.should_receive(:message_received).with Stream::Connected.new
|
45
48
|
end
|
46
49
|
|
47
50
|
def expect_disconnected_event
|
48
|
-
client.
|
51
|
+
client.should_receive(:message_received).with Stream::Disconnected.new
|
49
52
|
end
|
50
53
|
|
51
54
|
before { @sequence = 1 }
|
data/spec/spec_helper.rb
CHANGED
@@ -1,25 +1,9 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
require 'simplecov-rcov'
|
3
|
-
class SimpleCov::Formatter::MergedFormatter
|
4
|
-
def format(result)
|
5
|
-
SimpleCov::Formatter::HTMLFormatter.new.format(result)
|
6
|
-
SimpleCov::Formatter::RcovFormatter.new.format(result)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter
|
10
|
-
SimpleCov.start do
|
11
|
-
add_filter "/vendor/"
|
12
|
-
end
|
13
|
-
|
14
1
|
require 'ruby_fs'
|
15
|
-
require 'mocha'
|
16
2
|
|
17
3
|
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
|
18
4
|
|
19
|
-
include RubyFS
|
20
|
-
|
21
5
|
RSpec.configure do |config|
|
22
|
-
config.mock_with :
|
6
|
+
config.mock_with :rspec
|
23
7
|
config.filter_run :focus => true
|
24
8
|
config.run_all_when_everything_filtered = true
|
25
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_fs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: celluloid-io
|
@@ -75,22 +75,6 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 2.5.0
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: ci_reporter
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 1.6.3
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: 1.6.3
|
94
78
|
- !ruby/object:Gem::Dependency
|
95
79
|
name: yard
|
96
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +82,7 @@ dependencies:
|
|
98
82
|
requirements:
|
99
83
|
- - ~>
|
100
84
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0.6
|
85
|
+
version: '0.6'
|
102
86
|
type: :development
|
103
87
|
prerelease: false
|
104
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +90,7 @@ dependencies:
|
|
106
90
|
requirements:
|
107
91
|
- - ~>
|
108
92
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.6
|
93
|
+
version: '0.6'
|
110
94
|
- !ruby/object:Gem::Dependency
|
111
95
|
name: rake
|
112
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,54 +107,6 @@ dependencies:
|
|
123
107
|
- - ! '>='
|
124
108
|
- !ruby/object:Gem::Version
|
125
109
|
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: mocha
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- - ! '>='
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- - ! '>='
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: simplecov
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
150
|
-
type: :development
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ! '>='
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '0'
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: simplecov-rcov
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
|
-
requirements:
|
163
|
-
- - ! '>='
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- - ! '>='
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
110
|
- !ruby/object:Gem::Dependency
|
175
111
|
name: guard-rspec
|
176
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,21 +124,21 @@ dependencies:
|
|
188
124
|
- !ruby/object:Gem::Version
|
189
125
|
version: '0'
|
190
126
|
- !ruby/object:Gem::Dependency
|
191
|
-
name:
|
127
|
+
name: rb-fsevent
|
192
128
|
requirement: !ruby/object:Gem::Requirement
|
193
129
|
none: false
|
194
130
|
requirements:
|
195
|
-
- -
|
131
|
+
- - ~>
|
196
132
|
- !ruby/object:Gem::Version
|
197
|
-
version: '0'
|
133
|
+
version: '0.9'
|
198
134
|
type: :development
|
199
135
|
prerelease: false
|
200
136
|
version_requirements: !ruby/object:Gem::Requirement
|
201
137
|
none: false
|
202
138
|
requirements:
|
203
|
-
- -
|
139
|
+
- - ~>
|
204
140
|
- !ruby/object:Gem::Version
|
205
|
-
version: '0'
|
141
|
+
version: '0.9'
|
206
142
|
description: A Ruby client library for the FreeSWITCH EventSocket API built on Celluloid.
|
207
143
|
email:
|
208
144
|
- ben@langfeld.me
|
@@ -233,7 +169,7 @@ files:
|
|
233
169
|
- spec/ruby_fs/stream_spec.rb
|
234
170
|
- spec/spec_helper.rb
|
235
171
|
- spec/support/mock_server.rb
|
236
|
-
homepage:
|
172
|
+
homepage: https://github.com/adhearsion/ruby_fs
|
237
173
|
licenses: []
|
238
174
|
post_install_message:
|
239
175
|
rdoc_options: []
|
@@ -247,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
247
183
|
version: '0'
|
248
184
|
segments:
|
249
185
|
- 0
|
250
|
-
hash:
|
186
|
+
hash: 402976620045827430
|
251
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
188
|
none: false
|
253
189
|
requirements:
|
@@ -256,10 +192,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
192
|
version: '0'
|
257
193
|
segments:
|
258
194
|
- 0
|
259
|
-
hash:
|
195
|
+
hash: 402976620045827430
|
260
196
|
requirements: []
|
261
197
|
rubyforge_project: ruby_fs
|
262
|
-
rubygems_version: 1.8.
|
198
|
+
rubygems_version: 1.8.24
|
263
199
|
signing_key:
|
264
200
|
specification_version: 3
|
265
201
|
summary: Wrapping FreeSWITCH EventSocket for rubyists
|
@@ -270,3 +206,4 @@ test_files:
|
|
270
206
|
- spec/ruby_fs/stream_spec.rb
|
271
207
|
- spec/spec_helper.rb
|
272
208
|
- spec/support/mock_server.rb
|
209
|
+
has_rdoc:
|