ribiprocessing 0.0.1
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/.gitignore +17 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +60 -0
- data/Rakefile +6 -0
- data/lib/core.jar +0 -0
- data/lib/ribiprocessing/proxy.rb +13 -0
- data/lib/ribiprocessing/simple_app.rb +21 -0
- data/lib/ribiprocessing/version.rb +3 -0
- data/lib/ribiprocessing.rb +9 -0
- data/ribiprocessing.gemspec +19 -0
- data/spec/simple_app_spec.rb +27 -0
- data/spec/spec_helper.rb +9 -0
- metadata +68 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 unsymbol
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Ribiprocessing
|
2
|
+
|
3
|
+
A really super-slim layer to communicate with Processing from JRuby.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'ribiprocessing'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install ribiprocessing
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
``` ruby
|
22
|
+
require 'ribiprocessing'
|
23
|
+
|
24
|
+
class FlashingLightsSketch < Ribiprocessing::SimpleApp
|
25
|
+
|
26
|
+
attr_reader :random_background
|
27
|
+
|
28
|
+
def initialize(opts={})
|
29
|
+
@random_background = opts[:random_background] || RandomBackground.new(self)
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def setup
|
34
|
+
size 800, 600
|
35
|
+
end
|
36
|
+
|
37
|
+
def draw
|
38
|
+
random_background.generate
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
class RandomBackground
|
44
|
+
include Ribiprocessing::Proxy
|
45
|
+
|
46
|
+
def generate
|
47
|
+
background rand(255), rand(255), rand(255)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
FlashingLightsSketch.new({:title=>"Flashing Lights"})
|
53
|
+
```
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
1. Fork it
|
57
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
58
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
59
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
60
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/core.jar
ADDED
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Ribiprocessing
|
2
|
+
module Proxy
|
3
|
+
attr_accessor :processing_instance
|
4
|
+
|
5
|
+
def initialize(processing_instance)
|
6
|
+
@processing_instance = processing_instance
|
7
|
+
end
|
8
|
+
|
9
|
+
def method_missing(method, *args, &block)
|
10
|
+
processing_instance.send(method, *args, &block)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Ribiprocessing
|
2
|
+
import "processing.core"
|
3
|
+
|
4
|
+
class SimpleApp < Ribiprocessing::PApplet
|
5
|
+
|
6
|
+
def initialize(opts={})
|
7
|
+
super()
|
8
|
+
title = opts[:title] || "MySketch"
|
9
|
+
Ribiprocessing::PApplet.run_sketch([title], self)
|
10
|
+
end
|
11
|
+
|
12
|
+
def setup
|
13
|
+
size 640, 480
|
14
|
+
end
|
15
|
+
|
16
|
+
def draw
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
working_directory = File.join( File.dirname(__FILE__))
|
2
|
+
$: << working_directory if !$:.include?(working_directory)
|
3
|
+
Dir[ File.join( working_directory, "*.jar") ].each do |jar|
|
4
|
+
require jar
|
5
|
+
end
|
6
|
+
|
7
|
+
require "ribiprocessing/version"
|
8
|
+
require "ribiprocessing/proxy"
|
9
|
+
require "ribiprocessing/simple_app"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ribiprocessing/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "ribiprocessing"
|
8
|
+
gem.version = Ribiprocessing::VERSION
|
9
|
+
gem.authors = ["unsymbol"]
|
10
|
+
gem.email = ["hello@philipcunningham.org"]
|
11
|
+
gem.description = %q{Simpler Ruby Processing}
|
12
|
+
gem.summary = %q{A really slim layer between Ruby and Processing.}
|
13
|
+
gem.homepage = "https://github.com/unsymbol/ribiprocessing"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Ribiprocessing::SimpleApp do
|
4
|
+
|
5
|
+
APPLET = Ribiprocessing::SimpleApp.new
|
6
|
+
|
7
|
+
context "standard" do
|
8
|
+
[:setup, :draw].each do |method|
|
9
|
+
it { APPLET.should respond_to(method) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context "colour" do
|
14
|
+
[:background, :color_mode, :fill, :no_fill, :no_stroke, :stroke].each do |method|
|
15
|
+
it { APPLET.should respond_to(method) }
|
16
|
+
end
|
17
|
+
|
18
|
+
[:alpha, :blue, :brightness, :color, :green, :hue, :lerp_color, :red, :saturation].each do |method|
|
19
|
+
it { APPLET.should respond_to(method) }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
after(:all) do
|
24
|
+
APPLET.exit
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ribiprocessing
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- unsymbol
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-08 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Simpler Ruby Processing
|
15
|
+
email:
|
16
|
+
- hello@philipcunningham.org
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/core.jar
|
27
|
+
- lib/ribiprocessing.rb
|
28
|
+
- lib/ribiprocessing/proxy.rb
|
29
|
+
- lib/ribiprocessing/simple_app.rb
|
30
|
+
- lib/ribiprocessing/version.rb
|
31
|
+
- ribiprocessing.gemspec
|
32
|
+
- spec/simple_app_spec.rb
|
33
|
+
- spec/spec_helper.rb
|
34
|
+
homepage: https://github.com/unsymbol/ribiprocessing
|
35
|
+
licenses: []
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
hash: 2
|
47
|
+
version: !binary |-
|
48
|
+
MA==
|
49
|
+
none: false
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
hash: 2
|
57
|
+
version: !binary |-
|
58
|
+
MA==
|
59
|
+
none: false
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 1.8.24
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: A really slim layer between Ruby and Processing.
|
66
|
+
test_files:
|
67
|
+
- spec/simple_app_spec.rb
|
68
|
+
- spec/spec_helper.rb
|