ruby_ami 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/Guardfile +4 -0
- data/README.md +17 -0
- data/lib/ruby_ami/agi_result_parser.rb +6 -6
- data/lib/ruby_ami/client.rb +1 -1
- data/lib/ruby_ami/stream.rb +4 -0
- data/lib/ruby_ami/version.rb +1 -1
- data/ruby_ami.gemspec +2 -1
- data/spec/ruby_ami/stream_spec.rb +2 -2
- metadata +23 -7
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# [develop](https://github.com/adhearsion/ruby_ami)
|
2
2
|
|
3
|
+
# [1.2.2](https://github.com/adhearsion/ruby_ami/compare/v1.2.1...v1.2.2) - [2012-09-05](https://rubygems.org/gems/ruby_ami/versions/1.2.2)
|
4
|
+
* Streams now log syntax errors
|
5
|
+
* Celluloid dependency updated
|
6
|
+
|
3
7
|
# [1.2.1](https://github.com/adhearsion/ruby_ami/compare/v1.2.0...v1.2.1) - [2012-07-19](https://rubygems.org/gems/ruby_ami/versions/1.2.1)
|
4
8
|
* Use SecureRandom for UUIDs
|
5
9
|
|
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -27,6 +27,23 @@ end
|
|
27
27
|
client.start
|
28
28
|
```
|
29
29
|
|
30
|
+
## Development Requirements
|
31
|
+
|
32
|
+
ruby_ami uses [ragel](http://www.complang.org/ragel/) to generate some of it's
|
33
|
+
files.
|
34
|
+
|
35
|
+
On OS X (if you use homebrew):
|
36
|
+
|
37
|
+
brew install ragel
|
38
|
+
|
39
|
+
On Linux:
|
40
|
+
|
41
|
+
apt-get install ragel OR yum install ragel
|
42
|
+
|
43
|
+
Once you are inside the repository, before anything else, you will want to run:
|
44
|
+
|
45
|
+
rake ragel
|
46
|
+
|
30
47
|
## Links:
|
31
48
|
* [Source](https://github.com/adhearsion/ruby_ami)
|
32
49
|
* [Documentation](http://rdoc.info/github/adhearsion/ruby_ami/master/frames)
|
@@ -4,8 +4,8 @@ module RubyAMI
|
|
4
4
|
class AGIResultParser
|
5
5
|
attr_reader :code, :result, :data
|
6
6
|
|
7
|
-
FORMAT = /^(
|
8
|
-
DATA_KV_FORMAT = /([\w\d]+)=([\w\d]*)/.freeze
|
7
|
+
FORMAT = /^(?<code>\d{3}) result=(?<result>-?\d*) ?(?<data>\(?.*\)?)?$/.freeze
|
8
|
+
DATA_KV_FORMAT = /(?<key>[\w\d]+)=(?<value>[\w\d]*)/.freeze
|
9
9
|
DATA_CLEANER = /(^\()|(\)$)/.freeze
|
10
10
|
|
11
11
|
def initialize(result_string)
|
@@ -16,7 +16,7 @@ module RubyAMI
|
|
16
16
|
|
17
17
|
def data_hash
|
18
18
|
return unless data_kv_match
|
19
|
-
{data_kv_match[
|
19
|
+
{data_kv_match[:key] => data_kv_match[:value]}
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
@@ -30,9 +30,9 @@ module RubyAMI
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def parse
|
33
|
-
@code = match[
|
34
|
-
@result = match[
|
35
|
-
@data = match[
|
33
|
+
@code = match[:code].to_i
|
34
|
+
@result = match[:result].to_i
|
35
|
+
@data = match[:data] ? match[:data].gsub(DATA_CLEANER, '').freeze : nil
|
36
36
|
end
|
37
37
|
|
38
38
|
def data_kv_match
|
data/lib/ruby_ami/client.rb
CHANGED
data/lib/ruby_ami/stream.rb
CHANGED
@@ -60,6 +60,10 @@ module RubyAMI
|
|
60
60
|
@event_callback.call message
|
61
61
|
end
|
62
62
|
|
63
|
+
def syntax_error_encountered(ignored_chunk)
|
64
|
+
logger.error "Encountered a syntax error. Ignoring chunk: #{ignored_chunk.inspect}"
|
65
|
+
end
|
66
|
+
|
63
67
|
alias :error_received :message_received
|
64
68
|
|
65
69
|
def finalize
|
data/lib/ruby_ami/version.rb
CHANGED
data/ruby_ami.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
s.add_runtime_dependency %q<celluloid-io>, ["~> 0.
|
21
|
+
s.add_runtime_dependency %q<celluloid-io>, ["~> 0.12.0"]
|
22
22
|
s.add_runtime_dependency %q<future-resource>, [">= 0"]
|
23
23
|
s.add_runtime_dependency %q<girl_friday>, [">= 0"]
|
24
24
|
s.add_runtime_dependency %q<countdownlatch>, ["~> 1.0"]
|
@@ -33,5 +33,6 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.add_development_dependency %q<simplecov>, [">= 0"]
|
34
34
|
s.add_development_dependency %q<simplecov-rcov>, [">= 0"]
|
35
35
|
s.add_development_dependency %q<guard-rspec>
|
36
|
+
s.add_development_dependency %q<guard-shell>
|
36
37
|
s.add_development_dependency %q<ruby_gntp>
|
37
38
|
end
|
@@ -28,8 +28,8 @@ module RubyAMI
|
|
28
28
|
@stream = Stream.new '127.0.0.1', server_port, lambda { |m| client.message_received m }
|
29
29
|
@stream.run!
|
30
30
|
fake_client.call if fake_client.respond_to? :call
|
31
|
-
|
32
|
-
@stream
|
31
|
+
Celluloid::Actor.join s
|
32
|
+
Celluloid::Actor.join @stream
|
33
33
|
end
|
34
34
|
|
35
35
|
def expect_connected_event
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_ami
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
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-09-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: celluloid-io
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.12.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.12.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: future-resource
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,6 +235,22 @@ dependencies:
|
|
235
235
|
- - ! '>='
|
236
236
|
- !ruby/object:Gem::Version
|
237
237
|
version: '0'
|
238
|
+
- !ruby/object:Gem::Dependency
|
239
|
+
name: guard-shell
|
240
|
+
requirement: !ruby/object:Gem::Requirement
|
241
|
+
none: false
|
242
|
+
requirements:
|
243
|
+
- - ! '>='
|
244
|
+
- !ruby/object:Gem::Version
|
245
|
+
version: '0'
|
246
|
+
type: :development
|
247
|
+
prerelease: false
|
248
|
+
version_requirements: !ruby/object:Gem::Requirement
|
249
|
+
none: false
|
250
|
+
requirements:
|
251
|
+
- - ! '>='
|
252
|
+
- !ruby/object:Gem::Version
|
253
|
+
version: '0'
|
238
254
|
- !ruby/object:Gem::Dependency
|
239
255
|
name: ruby_gntp
|
240
256
|
requirement: !ruby/object:Gem::Requirement
|
@@ -314,7 +330,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
314
330
|
version: '0'
|
315
331
|
segments:
|
316
332
|
- 0
|
317
|
-
hash:
|
333
|
+
hash: -4025771816081059304
|
318
334
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
319
335
|
none: false
|
320
336
|
requirements:
|
@@ -323,10 +339,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
323
339
|
version: '0'
|
324
340
|
segments:
|
325
341
|
- 0
|
326
|
-
hash:
|
342
|
+
hash: -4025771816081059304
|
327
343
|
requirements: []
|
328
344
|
rubyforge_project: ruby_ami
|
329
|
-
rubygems_version: 1.8.
|
345
|
+
rubygems_version: 1.8.23
|
330
346
|
signing_key:
|
331
347
|
specification_version: 3
|
332
348
|
summary: Futzing with AMI so you don't have to
|