Skip to content
Browse files

pushed to gemcutter; autospec friendly specs

  • Loading branch information...
1 parent cb3c126 commit 0bbde03ada7f09583f0298c26933e775418ccacb Macario Ortega committed
Showing with 37 additions and 29 deletions.
  1. +1 −0 .gitignore
  2. +5 −3 README.rdoc
  3. +1 −1 lib/ruby-osc/bundle.rb
  4. +13 −8 ruby-osc.gemspec
  5. +7 −7 spec/bundle_spec.rb
  6. +10 −10 spec/message_spec.rb
View
1 .gitignore
@@ -0,0 +1 @@
+pkg
View
8 README.rdoc
@@ -1,13 +1,13 @@
= ruby-osc
+http://github.com/maca/ruby-osc
+
Concise OSC implementation for Ruby
* 1.9.1 and jRuby compatible
* Complies with OSC 1.0 specification
* Uses EventMachine for networking and lightweight soft-real-time bundle scheduling
-http://github.com/maca/ruby-osc
-
== SYNOPSIS:
require 'rubygems'
@@ -46,8 +46,10 @@ eventmachine
== INSTALL:
-sudo gem install maca-ruby-osc –source http://gems.github.com
+ sudo gem install ruby-osc –-source http://gemcutter.org
+ Although I prefer not to use sudo: http://dev.innovationfactory.nl/2009/10/26/never-use-sudo-gem-install-again/
+
== TODO:
- OSC 1.1 compatibility mode
View
2 lib/ruby-osc/bundle.rb
@@ -26,7 +26,7 @@ def self.decode string
string.gsub! /^#bundle\000/, ''
t1, t2, content_str = string.unpack('N2a*')
- timetag = Time.at(t1 + t2 / (2**32.0) - 2208988800) rescue nil
+ timetag = Time.at(t1 + t2 / (2**32.0) - 2_208_988_800) rescue nil
scanner = StringScanner.new content_str
args = []
View
21 ruby-osc.gemspec
@@ -6,32 +6,37 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Macario Ortega"]
- s.date = %q{2009-08-30}
+ s.date = %q{2010-01-17}
s.description = %q{}
s.email = ["macarui@gmail.com"]
s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
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"]
- s.has_rdoc = true
- s.homepage = %q{Concise OSC client for Ruby}
+ s.homepage = %q{http://github.com/maca/ruby-osc}
s.rdoc_options = ["--main", "README.rdoc"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{ruby-osc}
- s.rubygems_version = %q{1.3.1}
+ s.rubygems_version = %q{1.3.5}
s.summary = %q{}
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 2
+ s.specification_version = 3
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.8"])
- s.add_development_dependency(%q<hoe>, [">= 2.3.2"])
+ s.add_development_dependency(%q<rubyforge>, [">= 2.0.3"])
+ s.add_development_dependency(%q<gemcutter>, [">= 0.3.0"])
+ s.add_development_dependency(%q<hoe>, [">= 2.5.0"])
else
s.add_dependency(%q<eventmachine>, [">= 0.12.8"])
- s.add_dependency(%q<hoe>, [">= 2.3.2"])
+ s.add_dependency(%q<rubyforge>, [">= 2.0.3"])
+ s.add_dependency(%q<gemcutter>, [">= 0.3.0"])
+ s.add_dependency(%q<hoe>, [">= 2.5.0"])
end
else
s.add_dependency(%q<eventmachine>, [">= 0.12.8"])
- s.add_dependency(%q<hoe>, [">= 2.3.2"])
+ s.add_dependency(%q<rubyforge>, [">= 2.0.3"])
+ s.add_dependency(%q<gemcutter>, [">= 0.3.0"])
+ s.add_dependency(%q<hoe>, [">= 2.5.0"])
end
end
View
14 spec/bundle_spec.rb
@@ -23,7 +23,7 @@
end
describe 'Encode/decode' do
- shared_examples_for 'Encodable' do
+ shared_examples_for 'Encodable Bundle' do
it "should encode" do
@bundle.encode.should == @expected
end
@@ -47,7 +47,7 @@
@bundle = Bundle.new
@expected = "#bundle\000\000\000\000\000\000\000\000\001"
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Bundle'
end
describe 'Empty bundle with timetag' do
@@ -55,7 +55,7 @@
@bundle = Bundle.new Time.at(1251420949.16959)
@expected = [35, 98, 117, 110, 100, 108, 101, 0, 206, 65, 169, 149, 43, 106, 64, 0].pack('C*')
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Bundle'
end
describe 'Bundle with timetag and messages' do
@@ -63,7 +63,7 @@
@bundle = Bundle.new Time.at(946702800), Message.new('/bar/foo', 4, 3, 2, 1), Message.new('/foo/bar', 1, 2, 3, 4)
@expected = [35, 98, 117, 110, 100, 108, 101, 0, 188, 24, 8, 80, 0, 0, 0, 0, 0, 0, 0, 36, 47, 98, 97, 114, 47, 102, 111, 111, 0, 0, 0, 0, 44, 105, 105, 105, 105, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 36, 47, 102, 111, 111, 47, 98, 97, 114, 0, 0, 0, 0, 44, 105, 105, 105, 105, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4].pack('C*')
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Bundle'
end
describe 'Nested bundles' do
@@ -71,7 +71,7 @@
@bundle = Bundle.new( nil, Bundle.new(nil, Message.new('/a')), Message.new('/b') )
@expected = "#bundle\000\000\000\000\000\000\000\000\001\000\000\000\034#bundle\000\000\000\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"
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Bundle'
end
describe 'Complex blob' do
@@ -80,7 +80,7 @@
@bundle = Bundle.new nil, Message.new('/d_recv', Blob.new(data), 0)
@expected = [35, 98, 117, 110, 100, 108, 101, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 76, 47, 100, 95, 114, 101, 99, 118, 0, 44, 98, 105, 0, 0, 0, 0, 56, 83, 67, 103, 102, 0, 0, 0, 1, 0, 1, 4, 104, 111, 108, 97, 0, 2, 67, 220, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 6, 83, 105, 110, 79, 115, 99, 2, 0, 2, 0, 1, 0, 0, 255, 255, 0, 0, 255, 255, 0, 1, 2, 0, 0, 0, 0, 0, 0].pack('C*')
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Bundle'
end
describe 'Complex blob 2' do
@@ -89,7 +89,7 @@
@bundle = Bundle.new nil, Message.new('/d_recv', Blob.new(data), 0)
@expected = [35, 98, 117, 110, 100, 108, 101, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 124, 47, 100, 95, 114, 101, 99, 118, 0, 44, 98, 105, 0, 0, 0, 1, 101, 83, 67, 103, 102, 0, 0, 0, 1, 0, 1, 2, 97, 109, 0, 7, 0, 0, 0, 0, 63, 0, 0, 0, 63, 128, 0, 0, 64, 0, 0, 0, 194, 198, 0, 0, 64, 160, 0, 0, 192, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 103, 97, 116, 101, 0, 0, 9, 112, 111, 114, 116, 97, 100, 111, 114, 97, 0, 1, 10, 109, 111, 100, 117, 108, 97, 100, 111, 114, 97, 0, 2, 3, 97, 109, 112, 0, 3, 0, 8, 7, 67, 111, 110, 116, 114, 111, 108, 1, 0, 0, 0, 4, 0, 0, 1, 1, 1, 1, 6, 83, 105, 110, 79, 115, 99, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, 2, 255, 255, 0, 0, 1, 6, 77, 117, 108, 65, 100, 100, 1, 0, 3, 0, 1, 0, 0, 0, 1, 0, 0, 255, 255, 0, 1, 255, 255, 0, 1, 1, 6, 83, 105, 110, 79, 115, 99, 2, 0, 2, 0, 1, 0, 0, 0, 0, 0, 1, 255, 255, 0, 0, 2, 12, 66, 105, 110, 97, 114, 121, 79, 112, 85, 71, 101, 110, 2, 0, 2, 0, 1, 0, 2, 0, 3, 0, 0, 0, 2, 0, 0, 2, 6, 69, 110, 118, 71, 101, 110, 1, 0, 17, 0, 1, 0, 0, 0, 0, 0, 0, 255, 255, 0, 2, 255, 255, 0, 0, 255, 255, 0, 2, 255, 255, 0, 3, 255, 255, 0, 0, 255, 255, 0, 3, 255, 255, 0, 2, 255, 255, 0, 4, 255, 255, 0, 2, 255, 255, 0, 3, 255, 255, 0, 5, 255, 255, 0, 6, 255, 255, 0, 0, 255, 255, 0, 3, 255, 255, 0, 5, 255, 255, 0, 6, 1, 12, 66, 105, 110, 97, 114, 121, 79, 112, 85, 71, 101, 110, 2, 0, 2, 0, 1, 0, 2, 0, 4, 0, 0, 0, 5, 0, 0, 2, 3, 79, 117, 116, 2, 0, 2, 0, 0, 0, 0, 255, 255, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].pack('C*')
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Bundle'
end
it 'Should raise OSC::DecodeError with bad encoded bundle' do
View
20 spec/message_spec.rb
@@ -65,7 +65,7 @@
end
describe 'Encode/decode' do
- shared_examples_for 'Encodable' do
+ shared_examples_for 'Encodable Message' do
it "should encode" do
@message.encode.should == @expected
end
@@ -88,7 +88,7 @@
@message = Message.new('/foo/bar/long/very/long/long/long/address')
@expected = "/foo/bar/long/very/long/long/long/address\000\000\000,\000\000\000"
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Message'
end
describe 'Integer' do
@@ -96,7 +96,7 @@
@message = Message.new('/foo/barz', 2)
@expected = "/foo/barz\000\000\000,i\000\000\000\000\000\002"
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Message'
end
describe 'Negative Integer' do
@@ -104,7 +104,7 @@
@message = Message.new('/foo/barz', -2)
@expected = "/foo/barz\000\000\000,i\000\000\377\377\377\376"
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Message'
end
describe 'Float' do
@@ -112,7 +112,7 @@
@message = Message.new('/foo/bar', 1.10000002384186)
@expected = [47, 102, 111, 111, 47, 98, 97, 114, 0, 0, 0, 0, 44, 102, 0, 0, 63, 140, 204, 205].pack('C*')
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Message'
end
describe 'Negative Float' do
@@ -120,7 +120,7 @@
@message = Message.new('/foo/bar', -1.10000002384186)
@expected = [47, 102, 111, 111, 47, 98, 97, 114, 0, 0, 0, 0, 44, 102, 0, 0, 191, 140, 204, 205].pack('C*')
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Message'
end
describe 'String' do
@@ -128,7 +128,7 @@
@message = Message.new('/foo/bar', 'a string to encode')
@expected = "/foo/bar\000\000\000\000,s\000\000a string to encode\000\000"
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Message'
end
describe 'Multiple types' do
@@ -136,7 +136,7 @@
@message = Message.new('/foo/barzzz', 2, 1.44000005722046, 'basho')
@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*')
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Message'
end
describe 'Blob' do
@@ -144,7 +144,7 @@
@message = Message.new('/foo/bar', Blob.new('test blob'))
@expected = "/foo/bar\000\000\000\000,b\000\000\000\000\000\ttest blob\000\000\000"
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Message'
it "should raise if size doesn't correspond and return empty message" do
lambda do
@@ -158,7 +158,7 @@
@message = Message.new('/bar/foo', 4, 3, 2, 1)
@expected = "/bar/foo\000\000\000\000,iiii\000\000\000\000\000\000\004\000\000\000\003\000\000\000\002\000\000\000\001"
end
- it_should_behave_like 'Encodable'
+ it_should_behave_like 'Encodable Message'
end
end
end

0 comments on commit 0bbde03

Please sign in to comment.
Something went wrong with that request. Please try again.