ddp-server 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f43570a710a6b121e3cf96bb30e0aa5bf666198
4
- data.tar.gz: d79437183194ffa2c78477d7d3a0bc7cea34021f
3
+ metadata.gz: ec53e4163f85296c7c2dd0201e980a920d4467af
4
+ data.tar.gz: 3bf64d5e0e8081498875d86c82e5475f29dc373e
5
5
  SHA512:
6
- metadata.gz: 174a05bbda54f44569370e7db5fceed094892118528636805b8fe245580a86c70e4717c6fe143f982d3cb3af91d229c94d72150584cfef7c2aff6edabf08f49b
7
- data.tar.gz: 12bc6b927a8d78ca61f1bbe6b62e4550f0848161470449ca26bf48fb89994db117cd64bf774cc4729071966278f1d3db48c101b4263b80709ed7d2f8e71e4437
6
+ metadata.gz: f03405546f2eda99a66ee4a1bf507ffa202f3fa957f2cd81ad99946b1b15d94d8eb3af43d89d069f397584af1d626219a3a0652e53d3e0659b4df18b4f466c75
7
+ data.tar.gz: 9b2f36255c527a46bdb170b8929c9b8b1392f06f0e0c18af203b75ed6b866e3f85fabc6cff6cf472a5861a93fec5ce411d8e8cdebf6c25620df66e918fb90c69
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Ddp::Server
1
+ # DDP::Server
2
2
 
3
- TODO: Write a gem description
3
+ Ruby implementation of the DDP protocol for Meteor style servers.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,7 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ For usage check out the `ddp-server-rethinkdb` gem which should be a good example of an implementation. This gem only covers the bare basics of the protocol.
22
22
 
23
23
  ## Contributing
24
24
 
data/ddp-server.gemspec CHANGED
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'bundler', '~> 1.3'
22
22
  spec.add_development_dependency 'rake'
23
23
 
24
- spec.add_dependency 'celluloid-websocket'
24
+ spec.add_dependency 'celluloid-websocket', '~> 0.0.5'
25
25
  end
@@ -1,3 +1,3 @@
1
- require 'ddp/server/rack'
1
+ require 'ddp/server'
2
2
 
3
- run DDP::Server::Rack
3
+ run DDP::Server::WebSocket.rack
@@ -1,6 +1,6 @@
1
1
  module DDP
2
2
  # We use semantic versioning
3
3
  module Server
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
6
6
  end
data/lib/ddp/server.rb CHANGED
@@ -1,10 +1,26 @@
1
1
  require 'ddp/server/version'
2
+ require 'ddp/server/protocol'
2
3
  require 'celluloid/websocket/rack'
3
4
  require 'json'
4
5
  require 'securerandom'
5
6
 
6
7
  module DDP
7
- # An implementation of the Meteor DDP protocol
8
8
  module Server
9
+ # Server on top of a Celluloid::WebSocket
10
+ class WebSocket < Celluloid::WebSocket
11
+ include DDP::Server::Protocol
12
+
13
+ def on_open
14
+ handle_connect
15
+ end
16
+
17
+ def read_message
18
+ JSON.parse read
19
+ end
20
+
21
+ def write_message(message)
22
+ write JSON.generate(message)
23
+ end
24
+ end
9
25
  end
10
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddp-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tinco Andringa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-15 00:00:00.000000000 Z
11
+ date: 2015-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: celluloid-websocket
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.0.5
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 0.0.5
55
55
  description: DDP Protocol server for implementing Ruby DDP backends
56
56
  email:
57
57
  - mail@tinco.nl
@@ -73,7 +73,6 @@ files:
73
73
  - lib/ddp/server/protocol/data.rb
74
74
  - lib/ddp/server/protocol/heartbeat.rb
75
75
  - lib/ddp/server/protocol/rpc.rb
76
- - lib/ddp/server/rack.rb
77
76
  - lib/ddp/server/version.rb
78
77
  - spec/spec_helper.rb
79
78
  homepage: https://github.com/d-snp/ruby-ddp-server
@@ -1,26 +0,0 @@
1
- require 'ddp/server/version'
2
- require 'ddp/server/protocol'
3
- require 'celluloid/websocket/rack'
4
- require 'json'
5
- require 'securerandom'
6
-
7
- module DDP
8
- module Server
9
- # Rack middleware for running DDP
10
- class Rack < Celluloid::WebSocket::Rack
11
- include DDP::Server::Protocol
12
-
13
- def on_open
14
- handle_connect
15
- end
16
-
17
- def read_message
18
- JSON.parse read
19
- end
20
-
21
- def write_message(message)
22
- write JSON.generate(message)
23
- end
24
- end
25
- end
26
- end