ruby-processing 2.6.4 → 2.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby-processing/app.rb +40 -42
- data/lib/ruby-processing/exporters/creator.rb +88 -114
- data/lib/ruby-processing/helper_methods.rb +21 -10
- data/lib/ruby-processing/library_loader.rb +5 -5
- data/lib/ruby-processing/runner.rb +13 -14
- data/lib/ruby-processing/runners/base.rb +17 -16
- data/lib/ruby-processing/version.rb +1 -1
- data/vendors/Rakefile +3 -3
- metadata +26 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d37219dbcfc503ec0b97b07d08a307b7c1408744
|
4
|
+
data.tar.gz: c35100c261c806e067db30ecc661c12681ee580b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8137822eed4a491c7b2052621b589ffe8218840c6e2dfed421323ad0813eabab77e3152ab1e7463d8da99b325af1d18c7adc27dd50ef639c753da1578d4d64bf
|
7
|
+
data.tar.gz: 23fbd6c57e263380dfcdf5cae5b5b2037bff917bcf38d5cf013e6499be7832832494aec743764d994abf804064d0a8bf9edee6cd210ef0081daac765296c3324
|
data/lib/ruby-processing/app.rb
CHANGED
@@ -9,7 +9,7 @@ require_relative '../ruby-processing/config'
|
|
9
9
|
|
10
10
|
Dir["#{Processing::RP_CONFIG['PROCESSING_ROOT']}/core/library/\*.jar"].each do
|
11
11
|
|jar|
|
12
|
-
|
12
|
+
require jar
|
13
13
|
end
|
14
14
|
|
15
15
|
module Processing
|
@@ -22,8 +22,8 @@ module Processing
|
|
22
22
|
# called constantly, for every frame.
|
23
23
|
|
24
24
|
# Include some core processing classes that we'd like to use:
|
25
|
-
include_package 'processing.core'
|
26
|
-
|
25
|
+
include_package 'processing.core'
|
26
|
+
|
27
27
|
# Watch the definition of these methods, to make sure
|
28
28
|
# that Processing is able to call them during events.
|
29
29
|
METHODS_TO_ALIAS ||= {
|
@@ -36,7 +36,7 @@ module Processing
|
|
36
36
|
key_released: :keyReleased,
|
37
37
|
key_typed: :keyTyped
|
38
38
|
}
|
39
|
-
|
39
|
+
# All sketches extend this class
|
40
40
|
class App < PApplet
|
41
41
|
include Math
|
42
42
|
include HelperMethods
|
@@ -109,54 +109,22 @@ module Processing
|
|
109
109
|
proxy_java_fields
|
110
110
|
set_sketch_path # unless Processing.online?
|
111
111
|
mix_proxy_into_inner_classes
|
112
|
-
# @started = false
|
113
|
-
|
114
112
|
java.lang.Thread.default_uncaught_exception_handler = proc do
|
115
|
-
|
113
|
+
|_thread_, exception|
|
116
114
|
puts(exception.class.to_s)
|
117
115
|
puts(exception.message)
|
118
116
|
puts(exception.backtrace.map { |trace| "\t#{trace}" })
|
119
117
|
close
|
120
118
|
end
|
121
|
-
|
122
|
-
# For the list of all available args, see:-
|
123
|
-
# http://processing.org/reference/, however not all convenience functions
|
124
|
-
# are implemented in ruby-processing (you should in general prefer ruby
|
125
|
-
# alternatives when available and methods using java reflection, are best
|
126
|
-
# avoided entirely)
|
127
|
-
|
128
|
-
args = []
|
129
|
-
@width, @height = options[:width], options[:height]
|
130
|
-
if options[:full_screen]
|
131
|
-
present = true
|
132
|
-
args << '--full-screen'
|
133
|
-
args << "--bgcolor=#{options[:bgcolor]}" if options[:bgcolor]
|
134
|
-
end
|
135
|
-
@render_mode ||= JAVA2D
|
136
|
-
xc = Processing::RP_CONFIG['X_OFF'] ||= 0
|
137
|
-
yc = Processing::RP_CONFIG['Y_OFF'] ||= 0
|
138
|
-
x = options[:x] || xc
|
139
|
-
y = options[:y] || yc
|
140
|
-
args << "--location=#{x},#{y}" # important no spaces here
|
141
|
-
title = options[:title] ||
|
142
|
-
File.basename(SKETCH_PATH).sub(/(\.rb)$/, '').titleize
|
143
|
-
args << title
|
144
|
-
PApplet.run_sketch(args.to_java(:string), self)
|
119
|
+
run_sketch(options)
|
145
120
|
end
|
146
121
|
|
147
122
|
def size(*args)
|
148
123
|
w, h, mode = *args
|
149
|
-
@width ||= w
|
150
|
-
@height ||= h
|
151
|
-
@render_mode ||= mode
|
152
|
-
if /opengl/ =~ mode
|
153
|
-
# Include processing opengl classes that we'd like to use:
|
154
|
-
%w(FontTexture FrameBuffer LinePath LineStroker PGL
|
155
|
-
PGraphics2D PGraphics3D PGraphicsOpenGL PShader
|
156
|
-
PShapeOpenGL Texture).each do |klass|
|
157
|
-
java_import "processing.opengl.#{klass}"
|
158
|
-
end
|
159
|
-
end
|
124
|
+
@width ||= w
|
125
|
+
@height ||= h
|
126
|
+
@render_mode ||= mode
|
127
|
+
import_opengl if /opengl/ =~ mode
|
160
128
|
super(*args)
|
161
129
|
end
|
162
130
|
|
@@ -194,6 +162,36 @@ module Processing
|
|
194
162
|
const.class_eval 'include Processing::Proxy'
|
195
163
|
end
|
196
164
|
end
|
165
|
+
|
166
|
+
def import_opengl
|
167
|
+
# Include processing opengl classes that we'd like to use:
|
168
|
+
%w(FontTexture FrameBuffer LinePath LineStroker PGL
|
169
|
+
PGraphics2D PGraphics3D PGraphicsOpenGL PShader
|
170
|
+
PShapeOpenGL Texture).each do |klass|
|
171
|
+
java_import "processing.opengl.#{klass}"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def run_sketch(options = {})
|
176
|
+
args = []
|
177
|
+
@width, @height = options[:width], options[:height]
|
178
|
+
if options[:full_screen]
|
179
|
+
present = true
|
180
|
+
args << '--full-screen'
|
181
|
+
args << "--bgcolor=#{options[:bgcolor]}" if options[:bgcolor]
|
182
|
+
end
|
183
|
+
xc = Processing::RP_CONFIG['X_OFF'] ||= 0
|
184
|
+
yc = Processing::RP_CONFIG['Y_OFF'] ||= 0
|
185
|
+
x = options.fetch(:x, xc)
|
186
|
+
y = options.fetch(:y, yc)
|
187
|
+
args << "--location=#{x},#{y}" # important no spaces here
|
188
|
+
title = options.fetch(
|
189
|
+
:title,
|
190
|
+
File.basename(SKETCH_PATH).sub(/(\.rb)$/, '').titleize
|
191
|
+
)
|
192
|
+
args << title
|
193
|
+
PApplet.run_sketch(args.to_java(:string), self)
|
194
|
+
end
|
197
195
|
end # Processing::App
|
198
196
|
|
199
197
|
# This module will get automatically mixed in to any inner class of
|
@@ -1,44 +1,78 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
BASIC = <<-CODE
|
2
|
+
def setup
|
3
|
+
size %s, %s
|
4
|
+
end
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
@name = param[:name]
|
9
|
-
@file_name = param[:file_name]
|
10
|
-
@title = param[:title]
|
11
|
-
@width = param[:width]
|
12
|
-
@height = param[:height]
|
13
|
-
@mode = param[:mode].upcase unless param[:mode].nil?
|
14
|
-
@template = template
|
15
|
-
save(@file_name)
|
16
|
-
end
|
6
|
+
def draw
|
7
|
+
|
8
|
+
end
|
9
|
+
CODE
|
17
10
|
|
18
|
-
|
19
|
-
|
11
|
+
BASIC_MODE = <<-CODE
|
12
|
+
def setup
|
13
|
+
size %s, %s, %s
|
14
|
+
end
|
15
|
+
|
16
|
+
def draw
|
17
|
+
|
18
|
+
end
|
19
|
+
CODE
|
20
|
+
|
21
|
+
CLASS_BASIC = <<-CODE
|
22
|
+
class %s
|
23
|
+
def setup
|
24
|
+
size %s, %s
|
25
|
+
end
|
26
|
+
|
27
|
+
def draw
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
CODE
|
32
|
+
|
33
|
+
CLASS_MODE = <<-CODE
|
34
|
+
class %s
|
35
|
+
def setup
|
36
|
+
size %s, %s, %s
|
37
|
+
end
|
38
|
+
|
39
|
+
def draw
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
CODE
|
44
|
+
|
45
|
+
INNER = <<-CODE
|
46
|
+
class %s
|
47
|
+
include Processing::Proxy
|
48
|
+
|
49
|
+
end
|
50
|
+
CODE
|
51
|
+
|
52
|
+
module Processing
|
53
|
+
# Write file to disk
|
54
|
+
class SketchWriter
|
55
|
+
attr_reader :file
|
56
|
+
def initialize(path)
|
57
|
+
@file = "#{File.dirname(path)}/#{path.underscore}.rb"
|
20
58
|
end
|
21
59
|
|
22
|
-
def save(
|
60
|
+
def save(template)
|
23
61
|
File.open(file, 'w+') do |f|
|
24
|
-
f.write(
|
62
|
+
f.write(template)
|
25
63
|
end
|
26
64
|
end
|
27
65
|
end
|
28
66
|
|
29
67
|
# An abstract class providing common methods for real creators
|
30
68
|
class Creator
|
31
|
-
|
32
69
|
ALL_DIGITS = /\A\d+\Z/
|
33
70
|
|
34
71
|
def already_exist(path)
|
35
72
|
new_file = "#{File.dirname(path)}/#{path.underscore}.rb"
|
36
|
-
if !File.exist?(path) && !File.exist?(new_file)
|
37
|
-
|
38
|
-
|
39
|
-
puts 'That file already exists!'
|
40
|
-
exit
|
41
|
-
end
|
73
|
+
return if !File.exist?(path) && !File.exist?(new_file)
|
74
|
+
puts 'That file already exists!'
|
75
|
+
exit
|
42
76
|
end
|
43
77
|
|
44
78
|
# Show the help/usage message for create.
|
@@ -55,133 +89,73 @@ module Processing
|
|
55
89
|
|
56
90
|
USAGE
|
57
91
|
end
|
58
|
-
|
59
92
|
end
|
60
93
|
|
61
94
|
# This class creates bare sketches, with an optional render mode
|
62
95
|
class BasicSketch < Creator
|
63
96
|
# Create a blank sketch, given a path.
|
64
97
|
def basic_template
|
65
|
-
|
66
|
-
def setup
|
67
|
-
size <%=@width%>, <%=@height%>
|
68
|
-
end
|
69
|
-
|
70
|
-
def draw
|
71
|
-
|
72
|
-
end
|
73
|
-
)
|
98
|
+
format(BASIC, @width, @height)
|
74
99
|
end
|
75
100
|
|
76
101
|
def basic_template_mode
|
77
|
-
|
78
|
-
def setup
|
79
|
-
size <%=@width%>, <%=@height%>, <%=@mode%>
|
80
|
-
end
|
81
|
-
|
82
|
-
def draw
|
83
|
-
|
84
|
-
end
|
85
|
-
)
|
102
|
+
format(BASIC_MODE, @width, @height, @mode)
|
86
103
|
end
|
87
104
|
|
88
105
|
def create!(path, args)
|
89
106
|
return usage if /\?/ =~ path || /--help/ =~ path
|
90
|
-
main_file = File.basename(path, '.rb')
|
91
107
|
# Check to make sure that the main file doesn't exist already
|
92
108
|
already_exist(path)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
}
|
101
|
-
@with_size = @param[:width] && @param[:width].match(ALL_DIGITS) &&
|
102
|
-
@param[:height] && @param[:height].match(ALL_DIGITS)
|
103
|
-
template = @param[:mode].nil? ? basic_template : basic_template_mode
|
104
|
-
SketchWriter.new(template, @param)
|
109
|
+
main_file = File.basename(path, '.rb') # allow uneeded extension input
|
110
|
+
writer = SketchWriter.new(main_file)
|
111
|
+
@width = args[0]
|
112
|
+
@height = args[1]
|
113
|
+
@mode = args[2].upcase unless args[2].nil?
|
114
|
+
template = @mode.nil? ? basic_template : basic_template_mode
|
115
|
+
writer.save(template)
|
105
116
|
end
|
106
117
|
end
|
107
118
|
|
108
119
|
# This class creates class wrapped sketches, with an optional render mode
|
109
120
|
class ClassSketch < Creator
|
110
|
-
|
111
121
|
def class_template
|
112
|
-
|
113
|
-
class <%=@name%> < Processing::App
|
114
|
-
def setup
|
115
|
-
size <%=@width%>, <%=@height%>
|
116
|
-
end
|
117
|
-
|
118
|
-
def draw
|
119
|
-
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
# <%=@name%>.new(x: 20, y: 20)
|
124
|
-
)
|
122
|
+
format(CLASS_BASIC, @name, @width, @height)
|
125
123
|
end
|
126
124
|
|
127
125
|
def class_template_mode
|
128
|
-
|
129
|
-
class <%=@name%> < Processing::App
|
130
|
-
def setup
|
131
|
-
size <%=@width%>, <%=@height%>, <%=@mode%>
|
132
|
-
end
|
133
|
-
|
134
|
-
def draw
|
135
|
-
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
# <%=@name%>.new(x: 20, y: 20)
|
140
|
-
)
|
126
|
+
format(CLASS_MODE, @name, @width, @height, @mode)
|
141
127
|
end
|
142
|
-
# Create a
|
128
|
+
# Create a class wrapped sketch, given a path.
|
143
129
|
def create!(path, args)
|
144
130
|
return usage if /\?/ =~ path || /--help/ =~ path
|
145
|
-
main_file = File.basename(path, '.rb')
|
131
|
+
main_file = File.basename(path, '.rb') # allow uneeded extension input
|
146
132
|
# Check to make sure that the main file doesn't exist already
|
147
133
|
already_exist(path)
|
148
|
-
@
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
}
|
156
|
-
@with_size = @param[:width] && @param[:width].match(ALL_DIGITS) &&
|
157
|
-
@param[:height] && @param[:height].match(ALL_DIGITS)
|
158
|
-
template = @param[:mode].nil? ? class_template : class_template_mode
|
159
|
-
SketchWriter.new(template, @param)
|
134
|
+
@name = main_file.camelize
|
135
|
+
writer = SketchWriter.new(main_file)
|
136
|
+
@title = main_file.titleize
|
137
|
+
@width, @height = args[0], args[1]
|
138
|
+
@mode = args[2].upcase unless args[2].nil?
|
139
|
+
template = @mode.nil? ? class_template : class_template_mode
|
140
|
+
writer.save(template)
|
160
141
|
end
|
161
142
|
end
|
162
143
|
|
163
|
-
# This class creates a
|
144
|
+
# This class creates a pseudo 'java inner class' of the sketch
|
164
145
|
class Inner < Creator
|
165
146
|
def inner_class_template
|
166
|
-
|
167
|
-
class <%=@name%>
|
168
|
-
include Processing::Proxy
|
169
|
-
|
170
|
-
end
|
171
|
-
)
|
147
|
+
format(INNER, @name)
|
172
148
|
end
|
173
|
-
# Create a
|
149
|
+
# Create a pseudo inner class, given a path.
|
174
150
|
def create!(path, _args_)
|
175
151
|
return usage if /\?/ =~ path || /--help/ =~ path
|
176
|
-
main_file = File.basename(path, '.rb')
|
152
|
+
main_file = File.basename(path, '.rb') # allow uneeded extension input
|
177
153
|
# Check to make sure that the main file doesn't exist already
|
178
154
|
already_exist(path)
|
179
|
-
@
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
}
|
184
|
-
SketchWriter.new(inner_class_template, @param)
|
155
|
+
@name = main_file.camelize
|
156
|
+
writer = SketchWriter.new(main_file)
|
157
|
+
template = inner_class_template
|
158
|
+
writer.save(template)
|
185
159
|
end
|
186
160
|
end
|
187
161
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module Processing
|
2
|
+
# Provides some convenience methods available in vanilla processing
|
2
3
|
module HelperMethods
|
3
4
|
# processings epsilon may not be defined yet
|
4
5
|
EPSILON ||= 1.0e-04
|
@@ -100,16 +101,9 @@ module Processing
|
|
100
101
|
def dist(*args)
|
101
102
|
len = args.length
|
102
103
|
if len == 4
|
103
|
-
|
104
|
-
dy = args[1] - args[3]
|
105
|
-
return 0 if dx.abs < EPSILON && dy.abs < EPSILON
|
106
|
-
return Math.hypot(dx, dy)
|
104
|
+
return dist2d(*args)
|
107
105
|
elsif len == 6
|
108
|
-
|
109
|
-
dy = args[1] - args[4]
|
110
|
-
dz = args[2] - args[5]
|
111
|
-
return 0 if dx.abs < EPSILON && dy.abs < EPSILON && dz.abs < EPSILON
|
112
|
-
return Math.sqrt(dx * dx + dy * dy + dz * dz)
|
106
|
+
return dist3d(*args)
|
113
107
|
end
|
114
108
|
fail ArgumentError, 'takes 4 or 6 parameters'
|
115
109
|
end
|
@@ -205,5 +199,22 @@ module Processing
|
|
205
199
|
def key_pressed?
|
206
200
|
@declared_fields['keyPressed'].value(java_self)
|
207
201
|
end
|
202
|
+
|
203
|
+
private
|
204
|
+
|
205
|
+
def dist2d(*args)
|
206
|
+
dx = args[0] - args[2]
|
207
|
+
dy = args[1] - args[3]
|
208
|
+
return 0 if dx.abs < EPSILON && dy.abs < EPSILON
|
209
|
+
Math.hypot(dx, dy)
|
210
|
+
end
|
211
|
+
|
212
|
+
def dist3d(*args)
|
213
|
+
dx = args[0] - args[3]
|
214
|
+
dy = args[1] - args[4]
|
215
|
+
dz = args[2] - args[5]
|
216
|
+
return 0 if dx.abs < EPSILON && dy.abs < EPSILON && dz.abs < EPSILON
|
217
|
+
Math.sqrt(dx * dx + dy * dy + dz * dz)
|
218
|
+
end
|
208
219
|
end
|
209
|
-
end
|
220
|
+
end
|
@@ -138,15 +138,15 @@ module Processing
|
|
138
138
|
sketchbook_paths << spath
|
139
139
|
end
|
140
140
|
end
|
141
|
-
|
141
|
+
if preferences_paths.empty?
|
142
|
+
sketchbook_path = sketchbook_paths.first
|
143
|
+
else
|
142
144
|
lines = File.readlines(preferences_paths.first)
|
143
|
-
regex1
|
144
|
-
regex2
|
145
|
+
regex1 = /^sketchbook\.path=(.+)/ # processing-2.0
|
146
|
+
regex2 = /^sketchbook\.path\.three=(.+)/ # processing-3.0
|
145
147
|
matched_lines = lines.grep(regex1) { $1 } unless $1 == ''
|
146
148
|
matched_lines = lines.grep(regex2) { $1 } unless $1 == ''
|
147
149
|
sketchbook_path = matched_lines.first
|
148
|
-
else
|
149
|
-
sketchbook_path = sketchbook_paths.first
|
150
150
|
end
|
151
151
|
return sketchbook_path
|
152
152
|
end
|
@@ -71,6 +71,7 @@ module Processing
|
|
71
71
|
when 'app' then app(@options.path)
|
72
72
|
when 'setup' then setup(@options.path)
|
73
73
|
when /-v/ then show_version
|
74
|
+
when /-h/ then show_help
|
74
75
|
else
|
75
76
|
show_help
|
76
77
|
end
|
@@ -93,11 +94,8 @@ module Processing
|
|
93
94
|
def create(sketch, args)
|
94
95
|
require_relative '../ruby-processing/exporters/creator'
|
95
96
|
return Processing::Inner.new.create!(sketch, args) if @options.inner
|
96
|
-
if @options.wrap
|
97
|
-
|
98
|
-
else
|
99
|
-
Processing::BasicSketch.new.create!(sketch, args)
|
100
|
-
end
|
97
|
+
return Processing::ClassSketch.new.create!(sketch, args) if @options.wrap
|
98
|
+
Processing::BasicSketch.new.create!(sketch, args)
|
101
99
|
end
|
102
100
|
|
103
101
|
# Just simply run a ruby-processing sketch.
|
@@ -216,19 +214,18 @@ module Processing
|
|
216
214
|
args.map! { |arg| "-J#{arg}" } unless @options.nojruby
|
217
215
|
args
|
218
216
|
end
|
217
|
+
|
218
|
+
# NB: we really do require 'and' not '&&' to get message returned
|
219
219
|
|
220
220
|
def ensure_exists(sketch)
|
221
|
-
puts "Couldn't find: #{sketch}"
|
221
|
+
puts "Couldn't find: #{sketch}" and exit unless File.exist?(sketch)
|
222
222
|
end
|
223
223
|
|
224
224
|
def jruby_complete
|
225
225
|
rcomplete = File.join(RP5_ROOT, 'lib/ruby/jruby-complete.jar')
|
226
|
-
if File.exist?(rcomplete)
|
227
|
-
|
228
|
-
|
229
|
-
warn "#{rcomplete} does not exist\nTry running `rp5 setup install`"
|
230
|
-
exit
|
231
|
-
end
|
226
|
+
return rcomplete if File.exist?(rcomplete)
|
227
|
+
warn "#{rcomplete} does not exist\nTry running `rp5 setup install`"
|
228
|
+
exit
|
232
229
|
end
|
233
230
|
|
234
231
|
def host_os
|
@@ -247,9 +244,10 @@ module Processing
|
|
247
244
|
# Optimistically set processing root
|
248
245
|
def set_processing_root
|
249
246
|
require 'psych'
|
247
|
+
@os ||= host_os
|
250
248
|
data = {}
|
251
249
|
path = File.expand_path("#{ENV['HOME']}/.rp5rc")
|
252
|
-
if
|
250
|
+
if os == :mac
|
253
251
|
data['PROCESSING_ROOT'] = '/Applications/Processing.app/Contents/Java'
|
254
252
|
else
|
255
253
|
root = "#{ENV['HOME']}/processing-2.2.1"
|
@@ -261,8 +259,9 @@ module Processing
|
|
261
259
|
|
262
260
|
# On the Mac, we can display a fat, shiny ruby in the Dock.
|
263
261
|
def dock_icon
|
262
|
+
@os ||= host_os
|
264
263
|
icon = []
|
265
|
-
if
|
264
|
+
if os == :mac
|
266
265
|
icon << '-Xdock:name=Ruby-Processing'
|
267
266
|
icon << "-Xdock:icon=#{RP5_ROOT}/lib/templates/application/Contents/Resources/sketch.icns"
|
268
267
|
end
|
@@ -8,17 +8,19 @@ require_relative '../../ruby-processing/app'
|
|
8
8
|
|
9
9
|
module Processing
|
10
10
|
# For use with "bare" sketches that don't want to define a class or methods
|
11
|
-
|
11
|
+
BARE_TEMPLATE = <<-EOS
|
12
12
|
class Sketch < Processing::App
|
13
|
-
|
14
|
-
<%= source %>
|
15
|
-
<% else %>
|
16
|
-
def setup
|
17
|
-
size(DEFAULT_WIDTH, DEFAULT_HEIGHT, JAVA2D)
|
18
|
-
<%= source %>
|
19
|
-
no_loop
|
13
|
+
%s
|
20
14
|
end
|
21
|
-
|
15
|
+
EOS
|
16
|
+
|
17
|
+
NAKED_TEMPLATE = <<-EOS
|
18
|
+
class Sketch < Processing::App
|
19
|
+
def setup
|
20
|
+
size(DEFAULT_WIDTH, DEFAULT_HEIGHT)
|
21
|
+
%s
|
22
|
+
no_loop
|
23
|
+
end
|
22
24
|
end
|
23
25
|
EOS
|
24
26
|
|
@@ -28,15 +30,14 @@ module Processing
|
|
28
30
|
has_sketch = !source.match(/^[^#]*< Processing::App/).nil?
|
29
31
|
has_methods = !source.match(/^[^#]*(def\s+setup|def\s+draw)/).nil?
|
30
32
|
|
31
|
-
if has_sketch
|
32
|
-
|
33
|
-
|
33
|
+
return load File.join(SKETCH_ROOT, SKETCH_PATH) if has_sketch
|
34
|
+
if has_methods
|
35
|
+
code = format(BARE_TEMPLATE, source)
|
34
36
|
else
|
35
|
-
|
36
|
-
code = ERB.new(SKETCH_TEMPLATE).result(binding)
|
37
|
-
Object.class_eval code, SKETCH_PATH, -1
|
38
|
-
Processing::App.sketch_class.new
|
37
|
+
code = format(NAKED_TEMPLATE, source)
|
39
38
|
end
|
39
|
+
Object.class_eval code, SKETCH_PATH, -1
|
40
|
+
Processing::App.sketch_class.new
|
40
41
|
end
|
41
42
|
|
42
43
|
# Read in the sketch source code. Needs to work both online and offline.
|
data/vendors/Rakefile
CHANGED
@@ -8,8 +8,8 @@ WARNING = <<-EOS
|
|
8
8
|
|
9
9
|
EOS
|
10
10
|
|
11
|
-
JRUBYC_VERSION = '1.7.16.
|
12
|
-
EXAMPLES = '1.
|
11
|
+
JRUBYC_VERSION = '1.7.16.2'
|
12
|
+
EXAMPLES = '1.1'
|
13
13
|
HOME_DIR = ENV['HOME']
|
14
14
|
MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
|
15
15
|
|
@@ -27,7 +27,7 @@ file "jruby-complete-#{JRUBYC_VERSION}.jar" do
|
|
27
27
|
rescue
|
28
28
|
warn(WARNING)
|
29
29
|
end
|
30
|
-
check_sha1("jruby-complete-#{JRUBYC_VERSION}.jar", "
|
30
|
+
check_sha1("jruby-complete-#{JRUBYC_VERSION}.jar", "5cf4c6eb55a361137face9cd0cdc6980d772809e")
|
31
31
|
end
|
32
32
|
|
33
33
|
directory "../lib/ruby"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-processing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Ashkenas
|
@@ -15,65 +15,65 @@ authors:
|
|
15
15
|
- Juris Galang
|
16
16
|
- Guillaume Pierronnet
|
17
17
|
- Martin Prout
|
18
|
-
autorequire:
|
18
|
+
autorequire:
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
|
-
date: 2014-
|
21
|
+
date: 2014-12-08 00:00:00.000000000 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
|
-
name: bundler
|
25
24
|
requirement: !ruby/object:Gem::Requirement
|
26
25
|
requirements:
|
27
|
-
- -
|
26
|
+
- - ~>
|
28
27
|
- !ruby/object:Gem::Version
|
29
28
|
version: '1.3'
|
30
|
-
|
29
|
+
name: bundler
|
31
30
|
prerelease: false
|
31
|
+
type: :development
|
32
32
|
version_requirements: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- -
|
34
|
+
- - ~>
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: '1.3'
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name: rake
|
39
38
|
requirement: !ruby/object:Gem::Requirement
|
40
39
|
requirements:
|
41
|
-
- -
|
40
|
+
- - ~>
|
42
41
|
- !ruby/object:Gem::Version
|
43
42
|
version: '10.3'
|
44
|
-
|
43
|
+
name: rake
|
45
44
|
prerelease: false
|
45
|
+
type: :development
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- -
|
48
|
+
- - ~>
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '10.3'
|
51
51
|
- !ruby/object:Gem::Dependency
|
52
|
-
name: rake-compiler
|
53
52
|
requirement: !ruby/object:Gem::Requirement
|
54
53
|
requirements:
|
55
|
-
- -
|
54
|
+
- - ~>
|
56
55
|
- !ruby/object:Gem::Version
|
57
56
|
version: '0.9'
|
58
|
-
|
57
|
+
name: rake-compiler
|
59
58
|
prerelease: false
|
59
|
+
type: :development
|
60
60
|
version_requirements: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- -
|
62
|
+
- - ~>
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0.9'
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
|
-
name: minitest
|
67
66
|
requirement: !ruby/object:Gem::Requirement
|
68
67
|
requirements:
|
69
|
-
- -
|
68
|
+
- - ~>
|
70
69
|
- !ruby/object:Gem::Version
|
71
70
|
version: '5.3'
|
72
|
-
|
71
|
+
name: minitest
|
73
72
|
prerelease: false
|
73
|
+
type: :development
|
74
74
|
version_requirements: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ~>
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '5.3'
|
79
79
|
description: |2+
|
@@ -104,7 +104,6 @@ extensions: []
|
|
104
104
|
extra_rdoc_files: []
|
105
105
|
files:
|
106
106
|
- bin/rp5
|
107
|
-
- lib/rpextras.jar
|
108
107
|
- lib/ruby-processing.rb
|
109
108
|
- lib/ruby-processing/app.rb
|
110
109
|
- lib/ruby-processing/config.rb
|
@@ -139,32 +138,32 @@ files:
|
|
139
138
|
- library/file_chooser/file_chooser.rb
|
140
139
|
- library/vecmath/vecmath.rb
|
141
140
|
- vendors/Rakefile
|
141
|
+
- lib/rpextras.jar
|
142
142
|
homepage: http://wiki.github.com/jashkenas/ruby-processing
|
143
143
|
licenses:
|
144
144
|
- MIT
|
145
145
|
metadata: {}
|
146
|
-
post_install_message: Use 'rp5 setup install' to install jruby-complete, and 'rp5
|
147
|
-
setup check' to check config.
|
146
|
+
post_install_message: Use 'rp5 setup install' to install jruby-complete, and 'rp5 setup check' to check config.
|
148
147
|
rdoc_options: []
|
149
148
|
require_paths:
|
150
149
|
- lib
|
151
150
|
required_ruby_version: !ruby/object:Gem::Requirement
|
152
151
|
requirements:
|
153
|
-
- -
|
152
|
+
- - '>='
|
154
153
|
- !ruby/object:Gem::Version
|
155
154
|
version: '0'
|
156
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
156
|
requirements:
|
158
|
-
- -
|
157
|
+
- - '>='
|
159
158
|
- !ruby/object:Gem::Version
|
160
159
|
version: '0'
|
161
160
|
requirements:
|
162
161
|
- A decent graphics card
|
163
162
|
- java runtime >= 1.7+
|
164
163
|
- processing = 2.2.1+
|
165
|
-
rubyforge_project:
|
166
|
-
rubygems_version: 2.
|
167
|
-
signing_key:
|
164
|
+
rubyforge_project:
|
165
|
+
rubygems_version: 2.1.9
|
166
|
+
signing_key:
|
168
167
|
specification_version: 4
|
169
168
|
summary: Code as Art, Art as Code. Processing and Ruby are meant for each other.
|
170
169
|
test_files: []
|