ruby-processing 2.6.7 → 2.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rpextras.jar +0 -0
- data/lib/ruby-processing/app.rb +21 -25
- data/lib/ruby-processing/exporters/application_exporter.rb +2 -2
- data/lib/ruby-processing/exporters/base_exporter.rb +1 -1
- data/lib/ruby-processing/exporters/creator.rb +1 -1
- data/lib/ruby-processing/library_loader.rb +34 -47
- data/lib/ruby-processing/runner.rb +6 -6
- data/lib/ruby-processing/runners/watch.rb +3 -2
- data/lib/ruby-processing/version.rb +1 -1
- data/library/vecmath/vecmath.rb +4 -0
- data/vendors/Rakefile +1 -0
- metadata +6 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f86e1e9a4937a12e054537a3a11d87bd4d80ca8d
|
4
|
+
data.tar.gz: d9504d46543bf9467603fd6f0b3b8b25ddcfc366
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7618164b1440aa65fb4d8361392fcfde54588741e1f48fcd983c079bfcd936c6a8d1dd32f3a38e56cf63428022df0733641b4ccf0ce462d6377360d7ccbaf734
|
7
|
+
data.tar.gz: a00bd119873be49f403a5b606e82f98a84a7e10c52a4ab2a5fd741fbbce4d324616e8d3658a2d71743e09b065c245421f3b45779ee915ccb041d0ef18d72503a
|
data/lib/rpextras.jar
CHANGED
Binary file
|
data/lib/ruby-processing/app.rb
CHANGED
@@ -8,9 +8,10 @@ require_relative '../ruby-processing/helpers/string_extra'
|
|
8
8
|
require_relative '../ruby-processing/library_loader'
|
9
9
|
require_relative '../ruby-processing/config'
|
10
10
|
|
11
|
-
Dir["#{Processing::RP_CONFIG['PROCESSING_ROOT']}/core/library/\*.jar"]
|
12
|
-
|
13
|
-
|
11
|
+
jars = Dir["#{Processing::RP_CONFIG['PROCESSING_ROOT']}/core/library/\*.jar"]
|
12
|
+
# We don't seem need to load the native jars so perhaps we shouldn't
|
13
|
+
jars.reject { |jar| jar =~ /native/ }.each do |jar|
|
14
|
+
require jar
|
14
15
|
end
|
15
16
|
|
16
17
|
module Processing
|
@@ -48,19 +49,6 @@ module Processing
|
|
48
49
|
alias_method :rgb, :color
|
49
50
|
alias_method :gray, :color
|
50
51
|
|
51
|
-
# When certain special methods get added to the sketch, we need to let
|
52
|
-
# Processing call them by their expected Java names.
|
53
|
-
def self.method_added(method_name) #:nodoc:
|
54
|
-
if METHODS_TO_ALIAS.key?(method_name)
|
55
|
-
alias_method METHODS_TO_ALIAS[method_name], method_name
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Handy getters and setters on the class go here:
|
60
|
-
class << self
|
61
|
-
attr_accessor :sketch_class
|
62
|
-
end
|
63
|
-
|
64
52
|
def sketch_class
|
65
53
|
self.class.sketch_class
|
66
54
|
end
|
@@ -72,23 +60,33 @@ module Processing
|
|
72
60
|
@sketch_class = subclass
|
73
61
|
end
|
74
62
|
|
75
|
-
@@library_loader = LibraryLoader.new
|
76
63
|
class << self
|
64
|
+
# Handy getters and setters on the class go here:
|
65
|
+
attr_accessor :sketch_class, :library_loader
|
66
|
+
|
77
67
|
def load_libraries(*args)
|
78
|
-
|
68
|
+
library_loader ||= LibraryLoader.new
|
69
|
+
library_loader.load_library(*args)
|
79
70
|
end
|
80
71
|
alias_method :load_library, :load_libraries
|
81
72
|
|
82
73
|
def library_loaded?(library_name)
|
83
|
-
|
74
|
+
library_loader.library_loaded?(library_name)
|
84
75
|
end
|
85
76
|
|
86
77
|
def load_ruby_library(*args)
|
87
|
-
|
78
|
+
library_loader.load_ruby_library(*args)
|
88
79
|
end
|
89
80
|
|
90
81
|
def load_java_library(*args)
|
91
|
-
|
82
|
+
library_loader.load_java_library(*args)
|
83
|
+
end
|
84
|
+
|
85
|
+
# When certain special methods get added to the sketch, we need to let
|
86
|
+
# Processing call them by their expected Java names.
|
87
|
+
def method_added(method_name) #:nodoc:
|
88
|
+
return unless METHODS_TO_ALIAS.key?(method_name)
|
89
|
+
alias_method METHODS_TO_ALIAS[method_name], method_name
|
92
90
|
end
|
93
91
|
end
|
94
92
|
|
@@ -172,7 +170,7 @@ module Processing
|
|
172
170
|
java_import "processing.opengl.#{klass}"
|
173
171
|
end
|
174
172
|
end
|
175
|
-
|
173
|
+
|
176
174
|
def run_sketch(options = {})
|
177
175
|
args = []
|
178
176
|
@width, @height = options[:width], options[:height]
|
@@ -206,9 +204,7 @@ module Processing
|
|
206
204
|
unwanted -= %w(width height cursor create_image background size resize)
|
207
205
|
methods = Processing::App.public_instance_methods
|
208
206
|
methods.reject do |m|
|
209
|
-
unwanted.include?(m) ||
|
210
|
-
bad_method.match(m) ||
|
211
|
-
inner_class.method_defined?(m)
|
207
|
+
unwanted.include?(m) || bad_method.match(m) || inner_class.method_defined?(m)
|
212
208
|
end
|
213
209
|
end
|
214
210
|
|
@@ -19,7 +19,7 @@ module Processing
|
|
19
19
|
def export!(sketch)
|
20
20
|
# Check to make sure that the main file exists
|
21
21
|
@main_file_path, @main_file, @main_folder = *get_main_file(sketch)
|
22
|
-
usage(@main_file_path &&
|
22
|
+
usage(@main_file_path && FileTest.exist?(@main_file_path))
|
23
23
|
|
24
24
|
extract_information
|
25
25
|
|
@@ -49,7 +49,7 @@ module Processing
|
|
49
49
|
@necessary_files += @real_requires
|
50
50
|
NECESSARY_FOLDERS.each do |folder|
|
51
51
|
resource_path = File.join(@main_folder, folder)
|
52
|
-
@necessary_files << resource_path if
|
52
|
+
@necessary_files << resource_path if FileTest.exist?(resource_path)
|
53
53
|
end
|
54
54
|
@necessary_files.uniq!
|
55
55
|
cp_r(@necessary_files, File.join(@dest, @prefix))
|
@@ -74,7 +74,7 @@ module Processing
|
|
74
74
|
def already_exist(path)
|
75
75
|
underscore = StringExtra.new(path).underscore
|
76
76
|
new_file = "#{File.dirname(path)}/#{underscore}.rb"
|
77
|
-
return if !
|
77
|
+
return if !FileTest.exist?(path) && !FileTest.exist?(new_file)
|
78
78
|
puts 'That file already exists!'
|
79
79
|
exit
|
80
80
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module Processing
|
2
|
+
# Encapsulate library loader functionality as a class
|
2
3
|
class LibraryLoader
|
3
4
|
attr_reader :sketchbook_library_path
|
4
5
|
|
5
6
|
def initialize
|
6
|
-
@sketchbook_library_path = File.join(find_sketchbook_path
|
7
|
+
@sketchbook_library_path = File.join(find_sketchbook_path, 'libraries')
|
7
8
|
@loaded_libraries = Hash.new(false)
|
8
9
|
end
|
9
10
|
|
@@ -18,9 +19,10 @@ module Processing
|
|
18
19
|
# If a library is put into a 'library' folder next to the sketch it will
|
19
20
|
# be used instead of the library that ships with Ruby-Processing.
|
20
21
|
def load_libraries(*args)
|
22
|
+
message = 'no such file to load -- %s'
|
21
23
|
args.each do |lib|
|
22
24
|
loaded = load_ruby_library(lib) || load_java_library(lib)
|
23
|
-
fail(LoadError.new,
|
25
|
+
fail(LoadError.new, format(message, lib)) unless loaded
|
24
26
|
end
|
25
27
|
end
|
26
28
|
alias_method :load_library, :load_libraries
|
@@ -30,7 +32,7 @@ module Processing
|
|
30
32
|
# of the same name as the library folder.
|
31
33
|
def load_ruby_library(library_name)
|
32
34
|
library_name = library_name.to_sym
|
33
|
-
return true if @loaded_libraries
|
35
|
+
return true if @loaded_libraries.include?(library_name)
|
34
36
|
if Processing.exported?
|
35
37
|
begin
|
36
38
|
return @loaded_libraries[library_name] = (require_relative "../library/#{library_name}")
|
@@ -43,15 +45,13 @@ module Processing
|
|
43
45
|
@loaded_libraries[library_name] = (require path)
|
44
46
|
end
|
45
47
|
|
46
|
-
# For pure java libraries, such as the ones that are available
|
48
|
+
# HACK: For pure java libraries, such as the ones that are available
|
47
49
|
# on this page: http://processing.org/reference/libraries/index.html
|
48
|
-
#
|
49
|
-
#
|
50
|
-
# hack the 'Java ClassLoader', so that you don't have to
|
51
|
-
# futz with your PATH. But it's probably bad juju.
|
50
|
+
# that include native code, we mess with the 'Java ClassLoader', so that
|
51
|
+
# you don't have to futz with your PATH. But it's probably bad juju.
|
52
52
|
def load_java_library(library_name)
|
53
53
|
library_name = library_name.to_sym
|
54
|
-
return true if @loaded_libraries
|
54
|
+
return true if @loaded_libraries.include?(library_name)
|
55
55
|
jpath = get_library_directory_path(library_name, 'jar')
|
56
56
|
jars = get_library_paths(library_name, 'jar')
|
57
57
|
return false if jars.empty?
|
@@ -60,7 +60,6 @@ module Processing
|
|
60
60
|
platform_specific_library_paths = platform_specific_library_paths.select do |ppath|
|
61
61
|
test(?d, ppath) && !Dir.glob(File.join(ppath, '*.{so,dll,jnilib}')).empty?
|
62
62
|
end
|
63
|
-
|
64
63
|
unless platform_specific_library_paths.empty?
|
65
64
|
platform_specific_library_paths << java.lang.System.getProperty('java.library.path')
|
66
65
|
new_library_path = platform_specific_library_paths.join(java.io.File.pathSeparator)
|
@@ -73,23 +72,23 @@ module Processing
|
|
73
72
|
end
|
74
73
|
@loaded_libraries[library_name] = true
|
75
74
|
end
|
76
|
-
|
75
|
+
|
77
76
|
def platform
|
78
|
-
match = %w(
|
79
|
-
java.lang.System.getProperty('os.name').index(os)
|
77
|
+
match = %w(mac linux windows).find do |os|
|
78
|
+
java.lang.System.getProperty('os.name').downcase.index(os)
|
80
79
|
end
|
81
80
|
return 'other' unless match
|
82
|
-
return match
|
83
|
-
|
81
|
+
return match unless match =~ /mac/
|
82
|
+
'macosx'
|
84
83
|
end
|
85
84
|
|
86
85
|
def get_platform_specific_library_paths(basename)
|
87
86
|
bits = 'universal' # for MacOSX, but does this even work, or does Mac return '64'?
|
88
87
|
if java.lang.System.getProperty('sun.arch.data.model') == '32' ||
|
89
|
-
|
88
|
+
java.lang.System.getProperty('java.vm.name').index('32')
|
90
89
|
bits = '32'
|
91
90
|
elsif java.lang.System.getProperty('sun.arch.data.model') == '64' ||
|
92
|
-
|
91
|
+
java.lang.System.getProperty('java.vm.name').index('64')
|
93
92
|
bits = '64' unless platform =~ /macosx/
|
94
93
|
end
|
95
94
|
[platform, platform + bits].map { |p| File.join(basename, p) }
|
@@ -105,14 +104,13 @@ module Processing
|
|
105
104
|
def get_library_directory_path(library_name, extension = nil)
|
106
105
|
extensions = extension ? [extension] : %w(jar rb)
|
107
106
|
extensions.each do |ext|
|
108
|
-
[
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
"#{@sketchbook_library_path}/#{library_name}"
|
107
|
+
["#{SKETCH_ROOT}/library/#{library_name}",
|
108
|
+
"#{Processing::RP_CONFIG['PROCESSING_ROOT']}/modes/java/libraries/#{library_name}/library",
|
109
|
+
"#{RP5_ROOT}/library/#{library_name}/library",
|
110
|
+
"#{RP5_ROOT}/library/#{library_name}",
|
111
|
+
"#{@sketchbook_library_path}/#{library_name}/library"
|
114
112
|
].each do |jpath|
|
115
|
-
if File.exist?(jpath) && !Dir.glob(jpath
|
113
|
+
if File.exist?(jpath) && !Dir.glob(format('%s/*.%s', jpath, ext)).empty?
|
116
114
|
return jpath
|
117
115
|
end
|
118
116
|
end
|
@@ -123,32 +121,21 @@ module Processing
|
|
123
121
|
def find_sketchbook_path
|
124
122
|
preferences_paths = []
|
125
123
|
sketchbook_paths = []
|
126
|
-
if sketchbook_path = Processing::RP_CONFIG
|
127
|
-
return
|
124
|
+
if sketchbook_path = Processing::RP_CONFIG.fetch('sketchbook_path', false)
|
125
|
+
return sketchbook_path
|
128
126
|
else
|
129
127
|
["'Application Data/Processing'", 'AppData/Roaming/Processing',
|
130
|
-
|
131
|
-
|
132
|
-
spath =
|
133
|
-
pref_path =
|
134
|
-
if test(?f, pref_path)
|
135
|
-
|
136
|
-
end
|
137
|
-
if test(?d, spath)
|
138
|
-
sketchbook_paths << spath
|
139
|
-
end
|
128
|
+
'Library/Processing', 'Documents/Processing',
|
129
|
+
'.processing', 'sketchbook'].each do |prefix|
|
130
|
+
spath = format('%s/%s', ENV['HOME'], prefix)
|
131
|
+
pref_path = format('%s/preferences.txt', spath)
|
132
|
+
preferences_paths << pref_path if test(?f, pref_path)
|
133
|
+
sketchbook_paths << spath if test(?d, spath)
|
140
134
|
end
|
141
|
-
if preferences_paths.empty?
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
regex1 = /^sketchbook\.path=(.+)/ # processing-2.0
|
146
|
-
regex2 = /^sketchbook\.path\.three=(.+)/ # processing-3.0
|
147
|
-
matched_lines = lines.grep(regex1) { $1 } unless $1 == ''
|
148
|
-
matched_lines = lines.grep(regex2) { $1 } unless $1 == ''
|
149
|
-
sketchbook_path = matched_lines.first
|
150
|
-
end
|
151
|
-
return sketchbook_path
|
135
|
+
return sketchbook_paths.first if preferences_paths.empty?
|
136
|
+
lines = IO.readlines(preferences_paths.first)
|
137
|
+
matchedline = lines.grep(/^sketchbook/).first
|
138
|
+
matchedline[/=(.+)/].gsub('=', '')
|
152
139
|
end
|
153
140
|
end
|
154
141
|
end
|
@@ -47,7 +47,7 @@ module Processing
|
|
47
47
|
/bccwin/i,
|
48
48
|
/cygwin/i,
|
49
49
|
/djgpp/i,
|
50
|
-
/
|
50
|
+
/ming/i,
|
51
51
|
/mswin/i,
|
52
52
|
/wince/i
|
53
53
|
]
|
@@ -124,10 +124,10 @@ module Processing
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def setup(choice)
|
127
|
-
proc_root =
|
127
|
+
proc_root = FileTest.exist?("#{ENV['HOME']}/.rp5rc")
|
128
128
|
case choice
|
129
129
|
when /check/
|
130
|
-
check(proc_root,
|
130
|
+
check(proc_root, FileTest.exist?("#{RP5_ROOT}/lib/ruby/jruby-complete.jar"))
|
131
131
|
when /install/
|
132
132
|
install(proc_root)
|
133
133
|
when /unpack_samples/
|
@@ -206,7 +206,7 @@ module Processing
|
|
206
206
|
arg_file = "#{File.dirname(sketch)}/data/java_args.txt"
|
207
207
|
args = []
|
208
208
|
args += dock_icon
|
209
|
-
if
|
209
|
+
if FileTest.exist?(arg_file)
|
210
210
|
args += File.read(arg_file).split(/\s+/)
|
211
211
|
elsif Processing::RP_CONFIG['java_args']
|
212
212
|
args += Processing::RP_CONFIG['java_args'].split(/\s+/)
|
@@ -218,12 +218,12 @@ module Processing
|
|
218
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}" and exit unless
|
221
|
+
puts "Couldn't find: #{sketch}" and exit unless FileTest.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
|
-
return rcomplete if
|
226
|
+
return rcomplete if FileTest.exist?(rcomplete)
|
227
227
|
warn "#{rcomplete} does not exist\nTry running `rp5 setup install`"
|
228
228
|
exit
|
229
229
|
end
|
@@ -5,6 +5,7 @@ module Processing
|
|
5
5
|
# the feedback between code and effect.
|
6
6
|
class Watcher
|
7
7
|
# Sic a new Processing::Watcher on the sketch
|
8
|
+
SLEEP_TIME = 0.2
|
8
9
|
def initialize
|
9
10
|
reload_files_to_watch
|
10
11
|
@time = Time.now
|
@@ -16,7 +17,7 @@ module Processing
|
|
16
17
|
def start_watching
|
17
18
|
start_runner
|
18
19
|
Kernel.loop do
|
19
|
-
if @files.find { |file|
|
20
|
+
if @files.find { |file| FileTest.exist?(file) && File.stat(file).mtime > @time }
|
20
21
|
puts 'reloading sketch...'
|
21
22
|
$app && $app.close
|
22
23
|
@time = Time.now
|
@@ -24,7 +25,7 @@ module Processing
|
|
24
25
|
start_runner
|
25
26
|
reload_files_to_watch
|
26
27
|
end
|
27
|
-
sleep
|
28
|
+
sleep SLEEP_TIME
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
data/library/vecmath/vecmath.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
require 'rpextras'
|
2
2
|
|
3
|
+
# HACK: required for exported applications, comment out or replace first line
|
4
|
+
# with next line (create a lib folder here and move rpextras.jar there.
|
5
|
+
# require_relative 'lib/rpextras'
|
6
|
+
|
3
7
|
Java::ProcessingVecmathArcball::ArcballLibrary.new.load(JRuby.runtime, false)
|
4
8
|
Java::ProcessingVecmathVec2::Vec2Library.new.load(JRuby.runtime, false)
|
5
9
|
Java::ProcessingVecmathVec3::Vec3Library.new.load(JRuby.runtime, false)
|
data/vendors/Rakefile
CHANGED
@@ -75,6 +75,7 @@ task :copy_examples => file_name do
|
|
75
75
|
else
|
76
76
|
sh "tar xzvf #{EXAMPLES}.tar.gz"
|
77
77
|
end
|
78
|
+
sh "rm -r #{HOME_DIR}/rp_samples" if File.exist? "#{HOME_DIR}/rp_samples"
|
78
79
|
sh "cp -r Example-Sketches-#{EXAMPLES} #{HOME_DIR}/rp_samples"
|
79
80
|
sh "rm -r Example-Sketches-#{EXAMPLES}"
|
80
81
|
end
|
metadata
CHANGED
@@ -1,24 +1,22 @@
|
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Ashkenas
|
8
|
-
- Peter Gassner
|
9
|
-
- Martin Stannard
|
10
|
-
- Andrew Nanton
|
8
|
+
- Peter Gassner Martin Stannard Andrew Nanton
|
11
9
|
- Marc Chung
|
12
10
|
- Peter Krenn
|
13
11
|
- Florian Jenett
|
14
12
|
- Andreas Haller
|
15
|
-
- Juris
|
16
|
-
- Guillaume
|
13
|
+
- Juris
|
14
|
+
- Galang Guillaume Pierronne
|
17
15
|
- Martin Prout
|
18
16
|
autorequire:
|
19
17
|
bindir: bin
|
20
18
|
cert_chain: []
|
21
|
-
date: 2015-
|
19
|
+
date: 2015-04-03 00:00:00.000000000 Z
|
22
20
|
dependencies:
|
23
21
|
- !ruby/object:Gem::Dependency
|
24
22
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
150
|
requirements:
|
153
151
|
- - '>='
|
154
152
|
- !ruby/object:Gem::Version
|
155
|
-
version:
|
153
|
+
version: 1.9.3
|
156
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
155
|
requirements:
|
158
156
|
- - '>='
|