[DRE-commits] [ruby-websocket-parser] 02/03: Add patches
Hleb Valoshka
tsfgnu-guest at moszumanska.debian.org
Tue Jul 7 16:00:25 UTC 2015
This is an automated email from the git hooks/post-receive script.
tsfgnu-guest pushed a commit to branch master
in repository ruby-websocket-parser.
commit 70a840db218f8579ea91aaeab1e9eeba38a53dae
Author: Hleb Valoshka <375gnu at gmail.com>
Date: Tue Jul 7 18:32:43 2015 +0300
Add patches
---
debian/patches/0001-Do-not-require-bundler.patch | 17 +
...specs-to-RSpec-3.3.1-syntax-with-Transpec.patch | 349 +++++++++++++++++++++
debian/patches/0003-Add-absent-require-uri.patch | 26 ++
debian/patches/series | 3 +
4 files changed, 395 insertions(+)
diff --git a/debian/patches/0001-Do-not-require-bundler.patch b/debian/patches/0001-Do-not-require-bundler.patch
new file mode 100644
index 0000000..4f72e1f
--- /dev/null
+++ b/debian/patches/0001-Do-not-require-bundler.patch
@@ -0,0 +1,17 @@
+From: Hleb Valoshka <375gnu at gmail.com>
+Date: Tue, 7 Jul 2015 18:29:49 +0300
+Subject: Do not require bundler
+
+---
+ spec/spec_helper.rb | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
+index e2b6dc9..4bb9503 100644
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -1,4 +1,3 @@
+-require 'bundler/setup'
+ require 'websocket_parser'
+
+ RSpec.configure do |config|
diff --git a/debian/patches/0002-Convert-specs-to-RSpec-3.3.1-syntax-with-Transpec.patch b/debian/patches/0002-Convert-specs-to-RSpec-3.3.1-syntax-with-Transpec.patch
new file mode 100644
index 0000000..52bdccd
--- /dev/null
+++ b/debian/patches/0002-Convert-specs-to-RSpec-3.3.1-syntax-with-Transpec.patch
@@ -0,0 +1,349 @@
+From: Hleb Valoshka <375gnu at gmail.com>
+Date: Tue, 7 Jul 2015 18:38:51 +0300
+Subject: Convert specs to RSpec 3.3.1 syntax with Transpec
+
+This conversion is done by Transpec 3.1.0 with the following command:
+ transpec
+
+* 58 conversions
+ from: obj.should
+ to: expect(obj).to
+
+* 2 conversions
+ from: be_true
+ to: be_truthy
+
+* 1 conversion
+ from: be_false
+ to: be_falsey
+
+For more details: https://github.com/yujinakayama/transpec#supported-conversions
+---
+ spec/websocket/handshake_spec.rb | 10 +++----
+ spec/websocket/message_spec.rb | 46 +++++++++++++++---------------
+ spec/websocket/parser_spec.rb | 60 ++++++++++++++++++++--------------------
+ 3 files changed, 58 insertions(+), 58 deletions(-)
+
+diff --git a/spec/websocket/handshake_spec.rb b/spec/websocket/handshake_spec.rb
+index 6a62f75..99460ce 100644
+--- a/spec/websocket/handshake_spec.rb
++++ b/spec/websocket/handshake_spec.rb
+@@ -16,15 +16,15 @@ describe WebSocket::ClientHandshake do
+ let(:client_handshake) { WebSocket::ClientHandshake.new(:get, '/', handshake_headers) }
+
+ it "can validate handshake format" do
+- client_handshake.valid?.should be_true
++ expect(client_handshake.valid?).to be_truthy
+ end
+
+ it "can generate an accept response for the client" do
+ response = client_handshake.accept_response
+
+- response.headers['Upgrade'].should eq('websocket')
+- response.headers['Connection'].should eq('Upgrade')
+- response.headers['Sec-WebSocket-Accept'].should eq('s3pPLMBiTxaQ9kYGzzhZRbK+xOo=')
++ expect(response.headers['Upgrade']).to eq('websocket')
++ expect(response.headers['Connection']).to eq('Upgrade')
++ expect(response.headers['Sec-WebSocket-Accept']).to eq('s3pPLMBiTxaQ9kYGzzhZRbK+xOo=')
+ end
+
+ it "can be seariakized to data" do
+@@ -40,6 +40,6 @@ describe WebSocket::ClientHandshake do
+ "\r\n"
+ ]
+
+- client_handshake.to_data.should eq expected_lines.join("\r\n")
++ expect(client_handshake.to_data).to eq expected_lines.join("\r\n")
+ end
+ end
+diff --git a/spec/websocket/message_spec.rb b/spec/websocket/message_spec.rb
+index a07a37d..43fff11 100644
+--- a/spec/websocket/message_spec.rb
++++ b/spec/websocket/message_spec.rb
+@@ -7,14 +7,14 @@ describe WebSocket::Message do
+ data = message.to_data
+
+ # 2 bytes from header + 8 bytes from extended payload length + payload
+- data.size.should eq(2 + 8 + text.length)
++ expect(data.size).to eq(2 + 8 + text.length)
+
+ first_byte, second_byte, ext_length, payload = data.unpack("CCQ>a#{text.length}")
+
+- first_byte.should eq(0b10000001) # Text frame with FIN bit set
+- second_byte.should eq(0b01111111) # Unmasked. Payload length 127.
+- ext_length.should eq(text.length)
+- payload.should eq(text)
++ expect(first_byte).to eq(0b10000001) # Text frame with FIN bit set
++ expect(second_byte).to eq(0b01111111) # Unmasked. Payload length 127.
++ expect(ext_length).to eq(text.length)
++ expect(payload).to eq(text)
+ end
+
+ it "knows binary representation of messages between 126 and 65,535 bytes" do
+@@ -22,16 +22,16 @@ describe WebSocket::Message do
+ data = WebSocket::Message.new(text).to_data
+
+ # 2 bytes from header + 2 bytes from extended payload length + payload
+- data.size.should eq(2 + 2 + text.length)
++ expect(data.size).to eq(2 + 2 + text.length)
+ # extended payload length should respect endianness
+- data[2..3].should eq([0x00, 0x7F].pack('C*'))
++ expect(data[2..3]).to eq([0x00, 0x7F].pack('C*'))
+
+ first_byte, second_byte, ext_length, payload = data.unpack("CCna#{text.length}")
+
+- first_byte.should eq(0b10000001) # Text frame with FIN bit set
+- second_byte.should eq(0b01111110) # Unmasked. Payload length 126.
+- ext_length.should eq(text.length)
+- payload.should eq(text)
++ expect(first_byte).to eq(0b10000001) # Text frame with FIN bit set
++ expect(second_byte).to eq(0b01111110) # Unmasked. Payload length 126.
++ expect(ext_length).to eq(text.length)
++ expect(payload).to eq(text)
+ end
+
+ it "knows binary representation of messages with less than 126 bytes" do
+@@ -39,31 +39,31 @@ describe WebSocket::Message do
+ data = WebSocket::Message.new(text).to_data
+
+ # 2 bytes from header + payload
+- data.size.should eq(2 + text.length)
++ expect(data.size).to eq(2 + text.length)
+
+ first_byte, second_byte, payload = data.unpack("CCa#{text.length}")
+
+- first_byte.should eq(0b10000001) # Text frame with FIN bit set
+- second_byte.should eq(0b01111101) # Unmasked. Payload length 125.
+- payload.should eq(text)
++ expect(first_byte).to eq(0b10000001) # Text frame with FIN bit set
++ expect(second_byte).to eq(0b01111101) # Unmasked. Payload length 125.
++ expect(payload).to eq(text)
+ end
+
+ it "can be masked" do
+ message = WebSocket::Message.new('The man with the Iron Mask')
+- message.masked?.should be_false
++ expect(message.masked?).to be_falsey
+
+ message.mask!
+
+- message.masked?.should be_true
++ expect(message.masked?).to be_truthy
+ end
+
+ it "allows status codes for control frames" do
+ msg = WebSocket::Message.close(1001, 'Bye')
+
+- msg.status_code.should eq(1001)
+- msg.payload.should eq([1001, 'Bye'].pack('S<a*'))
+- msg.status.should eq(:peer_going_away)
+- msg.status_message.should eq('Bye')
++ expect(msg.status_code).to eq(1001)
++ expect(msg.payload).to eq([1001, 'Bye'].pack('S<a*'))
++ expect(msg.status).to eq(:peer_going_away)
++ expect(msg.status_message).to eq('Bye')
+ end
+
+ it "does not allow a status message without status code" do
+@@ -74,7 +74,7 @@ describe WebSocket::Message do
+ ping = WebSocket::Message.ping('Roman Ping Pong')
+ pong = WebSocket::Message.pong(ping.payload)
+
+- pong.type.should eq(:pong)
+- pong.payload.should eq('Roman Ping Pong')
++ expect(pong.type).to eq(:pong)
++ expect(pong.payload).to eq('Roman Ping Pong')
+ end
+ end
+diff --git a/spec/websocket/parser_spec.rb b/spec/websocket/parser_spec.rb
+index c7a31e9..cfc290d 100644
+--- a/spec/websocket/parser_spec.rb
++++ b/spec/websocket/parser_spec.rb
+@@ -22,7 +22,7 @@ describe WebSocket::Parser do
+ it "recognizes a text message" do
+ parser << WebSocket::Message.new('Once upon a time').to_data
+
+- received_messages.first.should eq('Once upon a time')
++ expect(received_messages.first).to eq('Once upon a time')
+ end
+
+ it "returns parsed messages on parse" do
+@@ -30,30 +30,30 @@ describe WebSocket::Parser do
+ msg2 = WebSocket::Message.new('Made glorious summer by this sun of York').to_data
+
+ messages = parser << msg1.slice!(0,5)
+- messages.should be_empty # We don't have a complete message yet
++ expect(messages).to be_empty # We don't have a complete message yet
+
+ messages = parser << msg1 + msg2
+
+- messages[0].should eq('Now is the winter of our discontent')
+- messages[1].should eq('Made glorious summer by this sun of York')
++ expect(messages[0]).to eq('Now is the winter of our discontent')
++ expect(messages[1]).to eq('Made glorious summer by this sun of York')
+ end
+
+ it "does not return control frames" do
+ msg = WebSocket::Message.close(1001, 'Goodbye!').to_data
+
+ messages = parser << msg
+- messages.should be_empty
++ expect(messages).to be_empty
+ end
+
+ it "can receive a message in parts" do
+ data = WebSocket::Message.new('Once upon a time').to_data
+ parser << data.slice!(0, 5)
+
+- received_messages.should be_empty
++ expect(received_messages).to be_empty
+
+ parser << data
+
+- received_messages.first.should eq('Once upon a time')
++ expect(received_messages.first).to eq('Once upon a time')
+ end
+
+ it "can receive succesive messages" do
+@@ -63,60 +63,60 @@ describe WebSocket::Parser do
+ parser << msg1.to_data
+ parser << msg2.to_data
+
+- received_messages[0].should eq('Now is the winter of our discontent')
+- received_messages[1].should eq('Made glorious summer by this sun of York')
++ expect(received_messages[0]).to eq('Now is the winter of our discontent')
++ expect(received_messages[1]).to eq('Made glorious summer by this sun of York')
+ end
+
+ it "can receive medium size messages" do
+ # Medium size messages has a payload length between 127 and 65_535 bytes
+
+ text = 4.times.collect { 'All work and no play makes Jack a dull boy.' }.join("\n\n")
+- text.length.should be > 127
+- text.length.should be < 65_536
++ expect(text.length).to be > 127
++ expect(text.length).to be < 65_536
+
+ parser << WebSocket::Message.new(text).to_data
+- received_messages.first.should eq(text)
++ expect(received_messages.first).to eq(text)
+ end
+
+ it "can receive large size messages" do
+ # Large size messages has a payload length greater than 65_535 bytes
+
+ text = 1500.times.collect { 'All work and no play makes Jack a dull boy.' }.join("\n\n")
+- text.length.should be > 65_536
++ expect(text.length).to be > 65_536
+
+ parser << WebSocket::Message.new(text).to_data
+
+ # Check lengths first to avoid gigantic error message
+- received_messages.first.length.should eq(text.length)
+- received_messages.first.should eq(text)
++ expect(received_messages.first.length).to eq(text.length)
++ expect(received_messages.first).to eq(text)
+ end
+
+ it "recognizes a ping message" do
+ parser << WebSocket::Message.ping.to_data
+
+- received_pings.size.should eq(1)
++ expect(received_pings.size).to eq(1)
+ end
+
+ it "recognizes a pong message" do
+ parser << WebSocket::Message.pong.to_data
+
+- received_pongs.size.should eq(1)
++ expect(received_pongs.size).to eq(1)
+ end
+
+ it "recognizes a close message with status code and message" do
+ parser << WebSocket::Message.close(1001, 'Browser leaving page').to_data
+
+ status, message = received_closes.first
+- status.should eq(:peer_going_away) # Status code 1001
+- message.should eq('Browser leaving page')
++ expect(status).to eq(:peer_going_away) # Status code 1001
++ expect(message).to eq('Browser leaving page')
+ end
+
+ it "recognizes a close message without status code" do
+ parser << WebSocket::Message.close.to_data
+
+ status, message = received_closes.first
+- status.should be_nil
+- message.should be_empty
++ expect(status).to be_nil
++ expect(message).to be_empty
+ end
+
+ it "recognizes a masked frame" do
+@@ -125,7 +125,7 @@ describe WebSocket::Parser do
+
+ parser << msg.to_data
+
+- received_messages.first.should eq('Once upon a time')
++ expect(received_messages.first).to eq('Once upon a time')
+ end
+
+ context "examples from the spec" do
+@@ -134,49 +134,49 @@ describe WebSocket::Parser do
+ it "recognizes single-frame unmasked text message" do
+ parser << [0x81, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f].pack('C*')
+
+- received_messages.first.should eq('Hello')
++ expect(received_messages.first).to eq('Hello')
+ end
+
+ it "recognizes single-frame masked text message" do
+ parser << [0x81, 0x85, 0x37, 0xfa, 0x21, 0x3d, 0x7f, 0x9f, 0x4d, 0x51, 0x58].pack('C*')
+
+- received_messages.first.should eq('Hello')
++ expect(received_messages.first).to eq('Hello')
+ end
+
+ it "recognizes a fragmented unmasked text message" do
+ parser << [0x01, 0x03, 0x48, 0x65, 0x6c].pack('C*') # contains "Hel"
+
+- received_messages.should be_empty
++ expect(received_messages).to be_empty
+
+ parser << [0x80, 0x02, 0x6c, 0x6f].pack('C*') # contains "lo"
+
+- received_messages.first.should eq('Hello')
++ expect(received_messages.first).to eq('Hello')
+ end
+
+ it "recognizes an unnmasked ping request" do
+ parser << [0x89, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f].pack('C*')
+
+- received_pings.size.should eq(1)
++ expect(received_pings.size).to eq(1)
+ end
+
+ it "recognizes a masked pong response" do
+ parser << [0x8a, 0x85, 0x37, 0xfa, 0x21, 0x3d, 0x7f, 0x9f, 0x4d, 0x51, 0x58].pack('C*')
+
+- received_pongs.size.should eq(1)
++ expect(received_pongs.size).to eq(1)
+ end
+
+ it "recognizes 256 bytes binary message in a single unmasked frame" do
+ data = Array.new(256) { rand(256) }.pack('c*')
+ parser << [0x82, 0x7E, 0x0100].pack('CCn') + data
+
+- received_messages.first.should eq(data)
++ expect(received_messages.first).to eq(data)
+ end
+
+ it "recoginzes 64KiB binary message in a single unmasked frame" do
+ data = Array.new(65536) { rand(256) }.pack('c*')
+ parser << [0x82, 0x7F, 0x0000000000010000].pack('CCQ>') + data
+
+- received_messages.first.should eq(data)
++ expect(received_messages.first).to eq(data)
+ end
+ end
+ end
diff --git a/debian/patches/0003-Add-absent-require-uri.patch b/debian/patches/0003-Add-absent-require-uri.patch
new file mode 100644
index 0000000..58bc4ef
--- /dev/null
+++ b/debian/patches/0003-Add-absent-require-uri.patch
@@ -0,0 +1,26 @@
+From: Hleb Valoshka <375gnu at gmail.com>
+Date: Tue, 7 Jul 2015 18:47:13 +0300
+Subject: Add absent require 'uri'
+
+---
+ lib/websocket/client_handshake.rb | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/lib/websocket/client_handshake.rb b/lib/websocket/client_handshake.rb
+index e3aa8d0..d3f43e6 100644
+--- a/lib/websocket/client_handshake.rb
++++ b/lib/websocket/client_handshake.rb
+@@ -1,5 +1,6 @@
+ require 'digest/sha1'
+ require 'base64'
++require 'uri'
+
+ module WebSocket
+ class ClientHandshake
+@@ -62,4 +63,4 @@ module WebSocket
+ data
+ end
+ end
+-end
+\ No newline at end of file
++end
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..84bee80
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,3 @@
+0001-Do-not-require-bundler.patch
+0002-Convert-specs-to-RSpec-3.3.1-syntax-with-Transpec.patch
+0003-Add-absent-require-uri.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-websocket-parser.git
More information about the Pkg-ruby-extras-commits
mailing list