ruby-osc 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/Rakefile +5 -23
- data/lib/ruby-osc.rb +7 -7
- data/lib/ruby-osc/bundle.rb +3 -3
- data/lib/ruby-osc/client.rb +1 -1
- data/lib/ruby-osc/version.rb +3 -0
- data/ruby-osc.gemspec +19 -35
- data/spec/bundle_spec.rb +16 -19
- data/spec/message_spec.rb +4 -4
- data/spec/spec_helper.rb +2 -2
- metadata +63 -93
- data/History.txt +0 -4
- data/Manifest.txt +0 -15
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/Rakefile
CHANGED
@@ -1,25 +1,7 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
require 'hoe'
|
4
|
-
require 'fileutils'
|
5
|
-
require './lib/ruby-osc'
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require "rspec/core/rake_task"
|
6
3
|
|
7
|
-
|
8
|
-
|
9
|
-
# Hoe.plugin :cucumberfeatures
|
4
|
+
desc "Run specs"
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
6
|
|
11
|
-
|
12
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
13
|
-
$hoe = Hoe.spec 'ruby-osc' do
|
14
|
-
self.developer 'Macario Ortega', 'macarui@gmail.com'
|
15
|
-
self.rubyforge_name = self.name # TODO this is default value
|
16
|
-
self.extra_deps = [['eventmachine','>= 0.12.8']]
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
require 'newgem/tasks'
|
21
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
22
|
-
|
23
|
-
# TODO - want other tests/tasks run by default? Add them to the list
|
24
|
-
# remove_task :default
|
25
|
-
# task :default => [:spec, :features]
|
7
|
+
task :default => :spec
|
data/lib/ruby-osc.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
|
2
1
|
require 'rubygems'
|
3
2
|
require 'eventmachine'
|
4
3
|
require 'socket' # Strange side effects with eventmachine udp client and SuperCollider
|
5
4
|
require 'strscan'
|
6
5
|
require 'thread'
|
7
6
|
|
8
|
-
$:.unshift( File.dirname( __FILE__ ) )
|
9
|
-
|
10
7
|
require 'ruby-osc/message'
|
11
8
|
require 'ruby-osc/bundle'
|
12
9
|
require 'ruby-osc/server'
|
13
10
|
require 'ruby-osc/client'
|
11
|
+
require "ruby-osc/version"
|
14
12
|
|
15
13
|
module OSC
|
16
|
-
|
17
|
-
|
14
|
+
Thread = EM.reactor_running? ? nil : Thread.new {
|
15
|
+
EM.run do
|
16
|
+
EM.error_handler { |e| puts e }
|
17
|
+
EM.set_quantum 5
|
18
|
+
end
|
19
|
+
}
|
18
20
|
Thread.run if RUBY_VERSION.to_f >= 1.9
|
19
|
-
EM.error_handler { |e| puts e }
|
20
|
-
EM.set_quantum 5
|
21
21
|
|
22
22
|
class DecodeError < StandardError; end
|
23
23
|
|
data/lib/ruby-osc/bundle.rb
CHANGED
@@ -23,10 +23,10 @@ module OSC
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.decode string
|
26
|
-
string.
|
26
|
+
string.sub! /^#bundle\000/, ''
|
27
27
|
t1, t2, content_str = string.unpack('N2a*')
|
28
28
|
|
29
|
-
timetag = Time.at(t1 + t2 / (2**32.0) - 2_208_988_800)
|
29
|
+
timetag = Time.at(t1 + t2 / (2**32.0) - 2_208_988_800)
|
30
30
|
scanner = StringScanner.new content_str
|
31
31
|
args = []
|
32
32
|
|
@@ -49,4 +49,4 @@ module OSC
|
|
49
49
|
"OSC::Bundle(#{ self.join(', ') })"
|
50
50
|
end
|
51
51
|
end
|
52
|
-
end
|
52
|
+
end
|
data/lib/ruby-osc/client.rb
CHANGED
data/ruby-osc.gemspec
CHANGED
@@ -1,42 +1,26 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
+
$:.push File.expand_path("../lib", __FILE__)
|
4
|
+
require "ruby-osc/version"
|
5
|
+
|
3
6
|
Gem::Specification.new do |s|
|
4
|
-
s.name
|
5
|
-
s.version
|
7
|
+
s.name = "ruby-osc"
|
8
|
+
s.version = Osc::VERSION
|
9
|
+
s.authors = ["Macario"]
|
10
|
+
s.email = ["macarui@gmail.com"]
|
11
|
+
s.homepage = "http://makarius.me"
|
12
|
+
s.summary = %q{Concise OSC Ruby implementation}
|
13
|
+
s.description = %q{Concise OSC Ruby implementation}
|
6
14
|
|
7
|
-
s.
|
8
|
-
s.authors = ["Macario Ortega"]
|
9
|
-
s.date = %q{2010-01-17}
|
10
|
-
s.description = %q{}
|
11
|
-
s.email = ["macarui@gmail.com"]
|
12
|
-
s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
|
13
|
-
s.files = ["History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "examples/localtest.rb", "lib/ruby-osc.rb", "lib/ruby-osc/bundle.rb", "lib/ruby-osc/client.rb", "lib/ruby-osc/message.rb", "lib/ruby-osc/server.rb", "ruby-osc.gemspec", "spec/bundle_spec.rb", "spec/message_spec.rb", "spec/server_spec.rb", "spec/spec_helper.rb"]
|
14
|
-
s.homepage = %q{http://github.com/maca/ruby-osc}
|
15
|
-
s.rdoc_options = ["--main", "README.rdoc"]
|
16
|
-
s.require_paths = ["lib"]
|
17
|
-
s.rubyforge_project = %q{ruby-osc}
|
18
|
-
s.rubygems_version = %q{1.3.5}
|
19
|
-
s.summary = %q{}
|
15
|
+
s.rubyforge_project = "ruby-osc"
|
20
16
|
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
s.add_development_dependency 'rspec', '>= 2.6.0'
|
18
|
+
s.add_development_dependency 'bundler', '>= 1.0'
|
19
|
+
s.add_dependency 'eventmachine', '>= 0.12.8'
|
24
20
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
s.add_development_dependency(%q<hoe>, [">= 2.5.0"])
|
30
|
-
else
|
31
|
-
s.add_dependency(%q<eventmachine>, [">= 0.12.8"])
|
32
|
-
s.add_dependency(%q<rubyforge>, [">= 2.0.3"])
|
33
|
-
s.add_dependency(%q<gemcutter>, [">= 0.3.0"])
|
34
|
-
s.add_dependency(%q<hoe>, [">= 2.5.0"])
|
35
|
-
end
|
36
|
-
else
|
37
|
-
s.add_dependency(%q<eventmachine>, [">= 0.12.8"])
|
38
|
-
s.add_dependency(%q<rubyforge>, [">= 2.0.3"])
|
39
|
-
s.add_dependency(%q<gemcutter>, [">= 0.3.0"])
|
40
|
-
s.add_dependency(%q<hoe>, [">= 2.5.0"])
|
41
|
-
end
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
|
+
s.require_paths = ["lib"]
|
42
25
|
end
|
26
|
+
|
data/spec/bundle_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require "#{ File.dirname __FILE__ }/spec_helper"
|
2
2
|
|
3
3
|
describe Bundle do
|
4
|
-
|
5
4
|
it "should accept bundle" do
|
6
5
|
Bundle.new( Time.now, Bundle.new ).to_a.should == [Bundle.new]
|
7
6
|
end
|
@@ -22,23 +21,21 @@ describe Bundle do
|
|
22
21
|
Bundle.new nil
|
23
22
|
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
Bundle.decode(@expected).should == @bundle
|
41
|
-
end
|
24
|
+
shared_examples_for 'Encodable Bundle' do
|
25
|
+
it "should encode" do
|
26
|
+
@bundle.encode.should == @expected
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should decode to bundle" do
|
30
|
+
Bundle.decode(@expected).should be_a(Bundle)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should decode timetag" do
|
34
|
+
Bundle.decode(@expected).timetag.should == @bundle.timetag
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should actually decode" do
|
38
|
+
Bundle.decode(@expected).should == @bundle
|
42
39
|
end
|
43
40
|
end
|
44
41
|
|
@@ -96,4 +93,4 @@ describe Bundle do
|
|
96
93
|
bad_data = "#bundle\000\000\000\000\000\000\000\000\001\000\000\000\034#bundle\000\000\000\000\000\001\000\000\000\b/a\000\000,\000\000\000\000\000\000\b/b\000\000,\000\000\000"
|
97
94
|
lambda { Bundle.decode bad_data }.should raise_error(DecodeError)
|
98
95
|
end
|
99
|
-
end
|
96
|
+
end
|
data/spec/message_spec.rb
CHANGED
@@ -109,7 +109,7 @@ describe Message do
|
|
109
109
|
|
110
110
|
describe 'Float' do
|
111
111
|
before do
|
112
|
-
@message = Message.new('/foo/bar', 1.
|
112
|
+
@message = Message.new('/foo/bar', 1.100000023841858)
|
113
113
|
@expected = [47, 102, 111, 111, 47, 98, 97, 114, 0, 0, 0, 0, 44, 102, 0, 0, 63, 140, 204, 205].pack('C*')
|
114
114
|
end
|
115
115
|
it_should_behave_like 'Encodable Message'
|
@@ -117,7 +117,7 @@ describe Message do
|
|
117
117
|
|
118
118
|
describe 'Negative Float' do
|
119
119
|
before do
|
120
|
-
@message = Message.new('/foo/bar', -1.
|
120
|
+
@message = Message.new('/foo/bar', -1.100000023841858)
|
121
121
|
@expected = [47, 102, 111, 111, 47, 98, 97, 114, 0, 0, 0, 0, 44, 102, 0, 0, 191, 140, 204, 205].pack('C*')
|
122
122
|
end
|
123
123
|
it_should_behave_like 'Encodable Message'
|
@@ -133,7 +133,7 @@ describe Message do
|
|
133
133
|
|
134
134
|
describe 'Multiple types' do
|
135
135
|
before do
|
136
|
-
@message = Message.new('/foo/barzzz', 2, 1.
|
136
|
+
@message = Message.new('/foo/barzzz', 2, 1.440000057220459, 'basho')
|
137
137
|
@expected = [47, 102, 111, 111, 47, 98, 97, 114, 122, 122, 122, 0, 44, 105, 102, 115, 0, 0, 0, 0, 0, 0, 0, 2, 63, 184, 81, 236, 98, 97, 115, 104, 111, 0, 0, 0].pack('C*')
|
138
138
|
end
|
139
139
|
it_should_behave_like 'Encodable Message'
|
@@ -161,4 +161,4 @@ describe Message do
|
|
161
161
|
it_should_behave_like 'Encodable Message'
|
162
162
|
end
|
163
163
|
end
|
164
|
-
end
|
164
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,84 +1,60 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-osc
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 2
|
10
|
-
version: 0.3.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.3
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
- Macario
|
7
|
+
authors:
|
8
|
+
- Macario
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2010-10-19 00:00:00 -05:00
|
12
|
+
date: 2011-08-03 00:00:00.000000000 -05:00
|
19
13
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
requirement: &2161115880 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
- 0
|
32
|
-
- 12
|
33
|
-
- 8
|
34
|
-
version: 0.12.8
|
35
|
-
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: rubyforge
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.6.0
|
23
|
+
type: :development
|
39
24
|
prerelease: false
|
40
|
-
|
25
|
+
version_requirements: *2161115880
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: bundler
|
28
|
+
requirement: &2161115140 !ruby/object:Gem::Requirement
|
41
29
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
segments:
|
47
|
-
- 2
|
48
|
-
- 0
|
49
|
-
- 4
|
50
|
-
version: 2.0.4
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
51
34
|
type: :development
|
52
|
-
version_requirements: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: hoe
|
55
35
|
prerelease: false
|
56
|
-
|
36
|
+
version_requirements: *2161115140
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: eventmachine
|
39
|
+
requirement: &2161095240 !ruby/object:Gem::Requirement
|
57
40
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
type: :development
|
68
|
-
version_requirements: *id003
|
69
|
-
description: ""
|
70
|
-
email:
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.12.8
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *2161095240
|
48
|
+
description: Concise OSC Ruby implementation
|
49
|
+
email:
|
71
50
|
- macarui@gmail.com
|
72
51
|
executables: []
|
73
|
-
|
74
52
|
extensions: []
|
75
|
-
|
76
|
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
|
80
|
-
- History.txt
|
81
|
-
- Manifest.txt
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- .rspec
|
57
|
+
- Gemfile
|
82
58
|
- README.rdoc
|
83
59
|
- Rakefile
|
84
60
|
- examples/localtest.rb
|
@@ -87,45 +63,39 @@ files:
|
|
87
63
|
- lib/ruby-osc/client.rb
|
88
64
|
- lib/ruby-osc/message.rb
|
89
65
|
- lib/ruby-osc/server.rb
|
66
|
+
- lib/ruby-osc/version.rb
|
90
67
|
- ruby-osc.gemspec
|
91
68
|
- spec/bundle_spec.rb
|
92
69
|
- spec/message_spec.rb
|
93
70
|
- spec/server_spec.rb
|
94
71
|
- spec/spec_helper.rb
|
95
72
|
has_rdoc: true
|
96
|
-
homepage: http://
|
73
|
+
homepage: http://makarius.me
|
97
74
|
licenses: []
|
98
|
-
|
99
75
|
post_install_message:
|
100
|
-
rdoc_options:
|
101
|
-
|
102
|
-
- README.rdoc
|
103
|
-
require_paths:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
104
78
|
- lib
|
105
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
80
|
none: false
|
107
|
-
requirements:
|
108
|
-
- -
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
|
111
|
-
|
112
|
-
- 0
|
113
|
-
version: "0"
|
114
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
86
|
none: false
|
116
|
-
requirements:
|
117
|
-
- -
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
|
120
|
-
segments:
|
121
|
-
- 0
|
122
|
-
version: "0"
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
123
91
|
requirements: []
|
124
|
-
|
125
92
|
rubyforge_project: ruby-osc
|
126
|
-
rubygems_version: 1.
|
93
|
+
rubygems_version: 1.6.2
|
127
94
|
signing_key:
|
128
95
|
specification_version: 3
|
129
|
-
summary:
|
130
|
-
test_files:
|
131
|
-
|
96
|
+
summary: Concise OSC Ruby implementation
|
97
|
+
test_files:
|
98
|
+
- spec/bundle_spec.rb
|
99
|
+
- spec/message_spec.rb
|
100
|
+
- spec/server_spec.rb
|
101
|
+
- spec/spec_helper.rb
|
data/History.txt
DELETED
data/Manifest.txt
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
Manifest.txt
|
3
|
-
README.rdoc
|
4
|
-
Rakefile
|
5
|
-
examples/localtest.rb
|
6
|
-
lib/ruby-osc.rb
|
7
|
-
lib/ruby-osc/bundle.rb
|
8
|
-
lib/ruby-osc/client.rb
|
9
|
-
lib/ruby-osc/message.rb
|
10
|
-
lib/ruby-osc/server.rb
|
11
|
-
ruby-osc.gemspec
|
12
|
-
spec/bundle_spec.rb
|
13
|
-
spec/message_spec.rb
|
14
|
-
spec/server_spec.rb
|
15
|
-
spec/spec_helper.rb
|