remoteling-ruby 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +16 -14
- data/Rakefile +1 -1
- data/lib/remoteling.rb +15 -6
- data/remoteling-ruby.gemspec +2 -2
- data/test/remoteling_test.rb +16 -2
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,23 +1,25 @@
|
|
1
1
|
Remoteling-Ruby
|
2
2
|
=====
|
3
|
-
This is the Ruby gem for
|
3
|
+
This is the Ruby gem for Remoteling.
|
4
4
|
|
5
|
-
* See
|
5
|
+
* See http://remoteling.com/ for docs and to get an account.
|
6
6
|
* We'd love to hear about any bugs or suggestions you have.
|
7
7
|
|
8
8
|
Synopsis:
|
9
9
|
======
|
10
10
|
|
11
|
-
|
11
|
+
require 'remoteling-ruby'
|
12
|
+
|
13
|
+
@remoteling = Remoteling.new('2b0846cab17d80d2dae115bbedc3aa75cd732dccb5f412ea5e2451d6afd31fb9')
|
14
|
+
# - or -
|
15
|
+
Remoteling.key = '2b0846cab17d80d2dae115bbedc3aa75cd732dccb5f412ea5e2451d6afd31fb9'
|
16
|
+
@remoteling = Remoteling.new
|
17
|
+
|
18
|
+
@remoteling.set('example','value')
|
19
|
+
@remoteling.get('example')
|
20
|
+
@remoteling.push('queue1','value')
|
21
|
+
@remoteling.pop('queue1')
|
22
|
+
@remoteling.run('proc_name','variables_to_send')
|
23
|
+
@remoteling.run_serialized('p "foo"','more_variables_to_send')
|
12
24
|
|
13
|
-
|
14
|
-
* @remoteling.set('example','value')
|
15
|
-
* @remoteling.get('example')
|
16
|
-
* @remoteling.push('queue1','value')
|
17
|
-
* @remoteling.pop('queue1')
|
18
|
-
* @remoteling.run('proc_name','variables_to_send')
|
19
|
-
* @remoteling.run_serialized('p "foo"','more_variables_to_send')
|
20
|
-
|
21
|
-
Copyright (c) 2009 Pike Engineering, released under the MIT license
|
22
|
-
|
23
|
-
website: http://remoteling.com
|
25
|
+
Copyright (c) 2009 Pike Engineering, released under the MIT license
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('remoteling-ruby', '0.0.
|
5
|
+
Echoe.new('remoteling-ruby', '0.0.4') do |p|
|
6
6
|
p.description = "Ruby gem for working with Remoteling (http://remoteling.com)"
|
7
7
|
p.url = "http://github.com/adrianpike/remoteling-ruby"
|
8
8
|
p.author = "Adrian Pike"
|
data/lib/remoteling.rb
CHANGED
@@ -10,12 +10,20 @@ class Remoteling
|
|
10
10
|
|
11
11
|
CONFIG = {
|
12
12
|
:timeout => 2,
|
13
|
-
|
13
|
+
#:remoteling_host => 'http://remoteling.com/'
|
14
|
+
:remoteling_host => 'http://localhost:3000/'
|
14
15
|
}
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
# we could use cattr_accessor if we had active_support, but its probably not worth pulling it in just for that
|
18
|
+
def key=(key) @@key = key; end
|
19
|
+
|
20
|
+
def initialize(key = @@key)
|
21
|
+
@api_key = key
|
22
|
+
end
|
23
|
+
|
24
|
+
#Store functions
|
25
|
+
def all_keys
|
26
|
+
call_action('store', :get, '')
|
19
27
|
end
|
20
28
|
|
21
29
|
def set(key,value)
|
@@ -26,7 +34,8 @@ class Remoteling
|
|
26
34
|
deserialize(call_action('store', :get, key))
|
27
35
|
end
|
28
36
|
|
29
|
-
|
37
|
+
# Queue functions
|
38
|
+
def push(queue_name, item)
|
30
39
|
call_action('queue', :put, queue_name, serialize(item))
|
31
40
|
end
|
32
41
|
|
@@ -57,7 +66,7 @@ class Remoteling
|
|
57
66
|
req = Net::HTTP::Put.new(url.path)
|
58
67
|
end
|
59
68
|
|
60
|
-
req.basic_auth @
|
69
|
+
req.basic_auth @api_key, ''
|
61
70
|
res = Net::HTTP.new(url.host, url.port).start {|http|
|
62
71
|
if data.is_a?(Hash) then
|
63
72
|
req.set_form_data(data)
|
data/remoteling-ruby.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{remoteling-ruby}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Adrian Pike"]
|
9
|
-
s.date = %q{2009-10-
|
9
|
+
s.date = %q{2009-10-10}
|
10
10
|
s.description = %q{Ruby gem for working with Remoteling (http://remoteling.com)}
|
11
11
|
s.email = %q{adrian@pikeapps.com}
|
12
12
|
s.extra_rdoc_files = ["README.rdoc", "lib/remoteling.rb"]
|
data/test/remoteling_test.rb
CHANGED
@@ -3,10 +3,24 @@ require 'shoulda'
|
|
3
3
|
require 'lib/remoteling'
|
4
4
|
|
5
5
|
class RemotelingTest < Test::Unit::TestCase
|
6
|
+
TESTING_KEY = '2b0846cab17d80d2dae115bbedc3aa75cd732dccb5f412ea5e2451d6afd31fb9' # you'll want to set this!
|
7
|
+
|
8
|
+
context 'a remoteling client with default creds stored in the class' do
|
9
|
+
setup do
|
10
|
+
@r = Remoteling.new(TESTING_KEY)
|
11
|
+
end
|
12
|
+
|
13
|
+
# do a basic op to make sure that auth worked
|
14
|
+
should 'authenticate and be able to set and get something' do
|
15
|
+
@r.set('foobar','testing')
|
16
|
+
val = @r.get('foobar')
|
17
|
+
assert_equal 'testing', val
|
18
|
+
end
|
19
|
+
end
|
6
20
|
|
7
21
|
context 'a simple remoteling client' do
|
8
22
|
setup do
|
9
|
-
@r = Remoteling.new(
|
23
|
+
@r = Remoteling.new(TESTING_KEY)
|
10
24
|
end
|
11
25
|
|
12
26
|
should 'be able to set and get something' do
|
@@ -57,7 +71,7 @@ EOM
|
|
57
71
|
|
58
72
|
context 'a remoteling client with bad login/password information' do
|
59
73
|
setup do
|
60
|
-
@r = Remoteling.new('foo'
|
74
|
+
@r = Remoteling.new('foo')
|
61
75
|
end
|
62
76
|
|
63
77
|
should 'not be able to set' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remoteling-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Pike
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-10 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|