amqp-processing 0.0.1 → 0.0.2
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.textile +57 -5
- data/Rakefile +10 -11
- data/bin/amqpp +1 -0
- data/lib/amqp-processing/version.rb +1 -1
- metadata +3 -3
data/README.textile
CHANGED
@@ -7,17 +7,34 @@ Ruby-Processing, Internet-enabled.
|
|
7
7
|
|
8
8
|
h1. Installation
|
9
9
|
|
10
|
+
Install JRuby, if you haven't done so already. This is most easily done with "rvm":http://rvm.beginrescueend.com/ :
|
11
|
+
|
12
|
+
<pre>
|
13
|
+
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
|
14
|
+
$ rvm install jruby
|
15
|
+
</pre>
|
16
|
+
|
17
|
+
Then switch to your JRuby environment, and install the AMQP-Processing gem:
|
18
|
+
|
10
19
|
<pre>
|
11
|
-
|
20
|
+
$ rvm use jruby
|
21
|
+
$ gem install amqp-processing
|
12
22
|
</pre>
|
13
23
|
|
14
24
|
|
15
25
|
h1. Connecting to a Server
|
16
26
|
|
27
|
+
Once installation is complete, the "amqpp" executable should be available in your $PATH. Run it like so:
|
28
|
+
|
17
29
|
<pre>
|
18
|
-
$ amqpp <server_address>
|
30
|
+
$ amqpp <server_address>
|
19
31
|
</pre>
|
20
32
|
|
33
|
+
Where server_address is the address of an AMQP server (like RabbitMQ). You can provide a port number as a second argument if the server isn't using the standard AMQP port (5672).
|
34
|
+
|
35
|
+
|
36
|
+
h1. Drawing
|
37
|
+
|
21
38
|
When the prompt appears, call Processing::App methods on the proxy object stored in $client. The call will be duplicated on all clients currently connected to the server.
|
22
39
|
|
23
40
|
<pre>
|
@@ -27,14 +44,49 @@ When the prompt appears, call Processing::App methods on the proxy object stored
|
|
27
44
|
=> nil
|
28
45
|
</pre>
|
29
46
|
|
47
|
+
Here are a few basic method calls:
|
48
|
+
|
49
|
+
<pre>
|
50
|
+
#Draw an opaque yellow line around shapes, 10 pixels wide.
|
51
|
+
red, green, blue, alpha = 128, 128, 0, 255
|
52
|
+
$client.stroke(red, green, blue, alpha)
|
53
|
+
$client.stroke_width 10
|
54
|
+
#Fill shapes with semi-transparent purple.
|
55
|
+
red, green, blue, alpha = 255, 0, 255, 128
|
56
|
+
$client.fill(red, green, blue, alpha)
|
57
|
+
#Draw shapes.
|
58
|
+
x, y = 200, 100
|
59
|
+
width, height = 400, 300
|
60
|
+
$client.rect(x, y, width, height)
|
61
|
+
$client.oval(x, y, width, height)
|
62
|
+
</pre>
|
63
|
+
|
64
|
+
You can find more examples to get you started here:
|
65
|
+
|
66
|
+
"Samples from the Ruby-Processing project":https://github.com/jashkenas/ruby-processing/tree/master/samples/processing_app/basics
|
67
|
+
|
68
|
+
The full Processing API is supported; you can read up on the various methods here:
|
30
69
|
|
70
|
+
"API reference at processing.org":http://processing.org/reference/
|
31
71
|
|
32
|
-
|
72
|
+
You can call your local Processing::App directly (without sending the call to other clients) via $client.app. In this example, oval() would be sent over the wire, but mouse_x() and mouse_y() would not:
|
33
73
|
|
34
|
-
|
74
|
+
<pre>
|
75
|
+
loop do
|
76
|
+
x = $client.app.mouse_x
|
77
|
+
y = $client.app.mouse_y
|
78
|
+
$client.oval(x, y, 100, 100)
|
79
|
+
end
|
80
|
+
</pre>
|
81
|
+
|
82
|
+
If you don't want to prepend "$client" to everything, you can switch to the client's context in IRB:
|
35
83
|
|
84
|
+
<pre>
|
85
|
+
>> irb $client
|
86
|
+
>> oval 99, 99, 99, 99
|
87
|
+
</pre>
|
36
88
|
|
37
89
|
|
38
90
|
h1. Copyright
|
39
91
|
|
40
|
-
Copyright (c) 2010 Jay McGavren. Released under the MIT license. See the LICENSE file for details.
|
92
|
+
Copyright (c) 2010-2011 Jay McGavren. Released under the MIT license. See the LICENSE file for details.
|
data/Rakefile
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
# end
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new
|
7
|
+
|
8
|
+
namespace :spec do
|
9
|
+
desc "Run specs with RCov"
|
10
|
+
RSpec::Core::RakeTask.new('rcov') do |t|
|
11
|
+
t.rcov = true
|
12
|
+
end
|
13
|
+
end
|
15
14
|
|
16
15
|
task :default => :spec
|
17
16
|
|
data/bin/amqpp
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jay McGavren
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-02-11 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|