kosmonaut 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ 2012-01-24 Krzysztof Kowalik <chris@nu7hat.ch>
2
+
3
+ * lib/kosmonaut/client.rb: request_single_access_token adjusted to new proto
4
+
1
5
  2012-01-20 Krzysztof Kowalik <chris@nu7hat.ch>
2
6
 
3
7
  * lib/kosmonaut/*.rb: optimized sockets thanks to using raw system timeouts
data/README CHANGED
@@ -31,53 +31,53 @@ for example:
31
31
  Worker is used to listen for incoming messages and handle
32
32
  it in user's desired way, example:
33
33
 
34
- class MyWorker < Kosmonaut::Worker
35
- def on_message(event, data)
36
- if event == "hello"
37
- puts "Hello #{data[:who]}"
38
- end
39
- end
40
-
41
- def on_error(err)
42
- puts "Error encountered (code #{err.to_s})"
43
- end
44
-
45
- def on_exception(err)
46
- puts "Ouch! something went wrong! Error: #{err.to_s}"
47
- end
48
- end
49
-
50
- w = MyWorker.new("wr://token@127.0.0.1:8081/vhost")
51
- w.listen
34
+ class MyWorker < Kosmonaut::Worker
35
+ def on_message(event, data)
36
+ if event == "hello"
37
+ puts "Hello #{data[:who]}"
38
+ end
39
+ end
40
+
41
+ def on_error(err)
42
+ puts "Error encountered (code #{err.to_s})"
43
+ end
44
+
45
+ def on_exception(err)
46
+ puts "Ouch! something went wrong! Error: #{err.to_s}"
47
+ end
48
+ end
49
+
50
+ w = MyWorker.new("wr://token@127.0.0.1:8081/vhost")
51
+ w.listen
52
52
 
53
53
  Hacking
54
54
  -------
55
55
  If you want to run kosmonaut.rb in development mode, first clone
56
56
  the repo and install dependencies:
57
57
 
58
- $ git clone https://github.com/webrocket/kosmonaut.rb.git
59
- $ cd kosmonaut.rb
60
- $ bundle
58
+ $ git clone https://github.com/webrocket/kosmonaut.rb.git
59
+ $ cd kosmonaut.rb
60
+ $ bundle
61
61
 
62
62
  To run the tests you should have a `webrocket-server` instance
63
63
  running with a `/test` vhost created. To create it use the
64
64
  `webrocket-admin` tool:
65
65
 
66
- $ webrocket-admin add_vhost /test
67
- Reading cookie... done
68
- Adding a vhost... done
69
- ---
70
- Access token for this vhost: a70d7d2c0bc5761620948b3420d18df9072ca0d1
66
+ $ webrocket-admin add_vhost /test
67
+ Reading cookie... done
68
+ Adding a vhost... done
69
+ ---
70
+ Access token for this vhost: a70d7d2c0bc5761620948b3420d18df9072ca0d1
71
71
 
72
72
  Now get the access token and run kosmonaut's tests using
73
73
  rake task:
74
74
 
75
- $ VHOST_TOKEN=a70d7d2c0bc5761620948b3420d18df9072ca0d1 rake test
75
+ $ VHOST_TOKEN=a70d7d2c0bc5761620948b3420d18df9072ca0d1 rake test
76
76
 
77
77
  If you want to get debug output add a `DEBUG` environment variable
78
78
  while running tests:
79
79
 
80
- $ VHOST_TOKEN=... DEBUG=1 rake test
80
+ $ VHOST_TOKEN=... DEBUG=1 rake test
81
81
 
82
82
  With any quirks and doubts don't hesitate to start a github issue
83
83
  or email one of the maintainers.
@@ -53,8 +53,8 @@ module Kosmonaut
53
53
  perform_request(payload)
54
54
  end
55
55
 
56
- def request_single_access_token(permission)
57
- payload = ["AT", permission]
56
+ def request_single_access_token(uid, permission)
57
+ payload = ["AT", uid, permission]
58
58
  perform_request(payload)
59
59
  end
60
60
 
@@ -1,8 +1,8 @@
1
1
  module Kosmonaut
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 2
5
- PATCH = 4
4
+ MINOR = 3
5
+ PATCH = 0
6
6
 
7
7
  def self.to_s
8
8
  [MAJOR, MINOR, PATCH].join('.')
@@ -48,7 +48,7 @@ class TestKosmonautClient < MiniTest::Unit::TestCase
48
48
  end
49
49
 
50
50
  def _test_request_single_access_token
51
- token = @client.request_single_access_token(".*")
51
+ token = @client.request_single_access_token("joe", ".*")
52
52
  assert token
53
53
  assert_equal 128, token.size
54
54
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: kosmonaut
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.4
5
+ version: 0.3.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Krzysztof Kowalik
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2012-01-22 00:00:00 Z
14
+ date: 2012-01-24 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json