jruby_art 0.3.1.pre → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6310fd7a020ca5af0b1efd759a68402e64390c64
4
- data.tar.gz: 27ee30134bbdad7cc47a31730a457b6d382a51a1
3
+ metadata.gz: bd9cb0f962dc0a84b23505e358c06629c40f68e6
4
+ data.tar.gz: fbe671a54abacc8ba092e8a0990a4001f2801eca
5
5
  SHA512:
6
- metadata.gz: a76a9bf6a75eba08aa8a9a46e0add4188b515138fd265408ee4acd7af9b047efd14e7a2d4c1501e5582a13d0ac7d9e9f82c8bab4063eb9c760b9b72d57da81d9
7
- data.tar.gz: 44c04ac82796deb2e411b27f2b2ccdb4872ee2e8052bec0ce7be1123a0720ef8e00fa3a3c1c8a370a44acfec65cec1921c41dadc115d2f4918076444b3c46e2a
6
+ metadata.gz: 461771d79505d0055e7327292df3c592aa33ad8d5d61a302fc55e09d51f5c40d8f032eb9d9179e47d6fc4c746a0db2fbd875254b4f595572c0f5a0fc9d404746
7
+ data.tar.gz: 5e4ecc05a81f62637333b4b8a53c669b292c539e797c1012819f665851cd641c4111c701072b58c1873643fec1f4a0dc290461cc90063bf36659e1c645302dba
data/lib/jruby_art.rb CHANGED
@@ -1,9 +1,9 @@
1
- # Ruby-Processing is for Code Art.
1
+ # JRubyArt is for Code Art.
2
2
  # Send suggestions, ideas, and hate-mail to mamba2928 [at] gmail.com
3
3
  # Also, send samples and libraries.
4
- unless defined? RP5_ROOT
4
+ unless defined? K9_ROOT
5
5
  $LOAD_PATH << File.expand_path(File.dirname(__FILE__))
6
- RP5_ROOT = File.expand_path(File.dirname(__FILE__) + '/../')
6
+ K9_ROOT = File.expand_path(File.dirname(__FILE__) + '/../')
7
7
  end
8
8
 
9
9
  SKETCH_ROOT ||= Dir.pwd
@@ -12,14 +12,7 @@ require 'jruby_art/version'
12
12
  require 'jruby_art/helpers/numeric'
13
13
  require 'jruby_art/helpers/range'
14
14
 
15
- # The top-level namespace, a home for all Ruby-Processing classes.
15
+ # The top-level namespace, a home for all JRubyArt classes.
16
16
  module Processing
17
-
18
- # Autoload a number of path/constants that we may end up using.
19
- # mri ruby does not understand ** require 'java' ** and we may otherwise call
20
- # it from mri ruby without lazy path loading of autoload
21
- # NB: autoload was slated for possible removal by ruby-2.2 never happened
22
- autoload :App, 'jruby_art/app'
23
- autoload :Runner, 'jruby_art/runner'
24
- autoload :Watcher, 'jruby_art/runners/watch'
17
+ require 'jruby_art/runner'
25
18
  end
data/lib/jruby_art/app.rb CHANGED
@@ -7,15 +7,18 @@ require_relative '../jruby_art/config'
7
7
 
8
8
  # A wrapper module for the processing App
9
9
  module Processing
10
+ Dir[format("%s/core/library/\*.jar", RP_CONFIG['PROCESSING_ROOT'])].each do |jar|
11
+ require jar unless jar =~ /native/
12
+ end
10
13
  # Include some core processing classes that we'd like to use:
11
14
  include_package 'processing.core'
12
15
  # Load vecmath and fastmath modules
13
- Java::ProcessingVecmathArcball::ArcballLibrary.new.load(JRuby.runtime, false)
14
- Java::ProcessingVecmathVec2::Vec2Library.new.load(JRuby.runtime, false)
15
- Java::ProcessingVecmathVec3::Vec3Library.new.load(JRuby.runtime, false)
16
- Java::ProcessingFastmath::DeglutLibrary.new.load(JRuby.runtime, false)
17
- AppRender ||= Java::ProcessingVecmath::AppRender
18
- ShapeRender ||= Java::ProcessingVecmath::ShapeRender
16
+ Java::MonkstoneArcball::ArcballLibrary.new.load(JRuby.runtime, false)
17
+ Java::MonkstoneVecmathVec2::Vec2Library.new.load(JRuby.runtime, false)
18
+ Java::MonkstoneVecmathVec3::Vec3Library.new.load(JRuby.runtime, false)
19
+ Java::MonkstoneFastmath::DeglutLibrary.new.load(JRuby.runtime, false)
20
+ AppRender ||= Java::MonkstoneVecmath::AppRender
21
+ ShapeRender ||= Java::MonkstoneVecmath::ShapeRender
19
22
 
20
23
  # Watch the definition of these methods, to make sure
21
24
  # that Processing is able to call them during events.
@@ -1,4 +1,6 @@
1
- # Then processing wrapper module
1
+ # The processing wrapper module
2
+ require_relative '../jruby_art'
3
+
2
4
  module Processing
3
5
 
4
6
  # Encapsulate library loader functionality as a class
@@ -19,7 +21,7 @@ module Processing
19
21
  # Usage: load_libraries :opengl, :boids
20
22
  #
21
23
  # If a library is put into a 'library' folder next to the sketch it will
22
- # be used instead of the library that ships with Ruby-Processing.
24
+ # be used instead of the library that ships with JRubyArt.
23
25
  def load_libraries(*args)
24
26
  message = 'no such file to load -- %s'
25
27
  args.each do |lib|
@@ -101,8 +103,8 @@ module Processing
101
103
  extensions.each do |ext|
102
104
  ["#{SKETCH_ROOT}/library/#{library_name}",
103
105
  "#{Processing::RP_CONFIG['PROCESSING_ROOT']}/modes/java/libraries/#{library_name}/library",
104
- "#{RP5_ROOT}/library/#{library_name}/library",
105
- "#{RP5_ROOT}/library/#{library_name}",
106
+ "#{K9_ROOT}/library/#{library_name}/library",
107
+ "#{K9_ROOT}/library/#{library_name}",
106
108
  "#{@sketchbook_library_path}/#{library_name}/library"
107
109
  ].each do |jpath|
108
110
  if File.exist?(jpath) && !Dir.glob(format('%s/*.%s', jpath, ext)).empty?
@@ -12,7 +12,7 @@ module Processing
12
12
  HELP_MESSAGE ||= <<-EOS
13
13
  Version: #{JRubyArt::VERSION}
14
14
 
15
- Ruby-Processing is a little shim between Processing and JRuby that helps
15
+ JRubyArt is a little shim between Processing and JRuby that helps
16
16
  you create sketches of code art.
17
17
 
18
18
  Usage:
@@ -110,18 +110,18 @@ module Processing
110
110
  proc_root = FileTest.exist?("#{ENV['HOME']}/.jruby_art/config.yml")
111
111
  case choice
112
112
  when /check/
113
- check(proc_root, FileTest.exist?("#{RP5_ROOT}/lib/ruby/jruby-complete.jar"))
113
+ check(proc_root, FileTest.exist?("#{K9_ROOT}/lib/ruby/jruby-complete.jar"))
114
114
  when /install/
115
115
  install(proc_root)
116
116
  when /unpack_samples/
117
- system "cd #{RP5_ROOT}/vendors && rake unpack_samples"
117
+ system "cd #{K9_ROOT}/vendors && rake unpack_samples"
118
118
  else
119
119
  puts 'Usage: k9 setup [check | install | unpack_samples]'
120
120
  end
121
121
  end
122
122
 
123
123
  def install(root_exist)
124
- system "cd #{RP5_ROOT}/vendors && rake"
124
+ system "cd #{K9_ROOT}/vendors && rake"
125
125
  return if root_exist
126
126
  set_processing_root
127
127
  warn 'PROCESSING_ROOT set optimistically, run check to confirm'
@@ -141,7 +141,7 @@ module Processing
141
141
  puts " jruby-complete installed = #{installed}"
142
142
  end
143
143
 
144
- # Display the current version of Ruby-Processing.
144
+ # Display the current version of JRubyArt.
145
145
  def show_version
146
146
  puts format('JRubyArt version %s', JRubyArt::VERSION)
147
147
  end
@@ -153,10 +153,6 @@ module Processing
153
153
 
154
154
  private
155
155
 
156
- def core_classpath
157
- Dir["#{Processing::RP_CONFIG['PROCESSING_ROOT']}/core/library/\*.jar"]
158
- end
159
-
160
156
  # Trade in this Ruby instance for a JRuby instance, loading in a starter
161
157
  # script and passing it some arguments.Unless '--nojruby' is passed, the
162
158
  # installed version of jruby is used instead of our vendored jarred one
@@ -164,16 +160,14 @@ module Processing
164
160
  # jruby-complete by default set JRUBY: false in ~/.k9rc config
165
161
  # (but that will make using other gems in your sketches hard....)
166
162
  def spin_up(starter_script, sketch, args)
167
- runner = "#{RP5_ROOT}/lib/jruby_art/runners/#{starter_script}"
168
- warn('The --jruby flag is no longer required') if @options.jruby
163
+ runner = "#{K9_ROOT}/lib/jruby_art/runners/#{starter_script}"
169
164
  @options.nojruby = true if Processing::RP_CONFIG['JRUBY'] == 'false'
170
165
  java_args = discover_java_args(sketch)
171
166
  if @options.nojruby
172
- classpath = jruby_complete + core_classpath
173
167
  command = ['java',
174
168
  java_args,
175
169
  '-cp',
176
- classpath.join(path_separator),
170
+ jruby_complete,
177
171
  'org.jruby.Main',
178
172
  runner,
179
173
  sketch,
@@ -181,8 +175,6 @@ module Processing
181
175
  else
182
176
  command = ['jruby',
183
177
  java_args,
184
- '-J-cp',
185
- core_classpath.join(path_separator),
186
178
  runner,
187
179
  sketch,
188
180
  args].flatten
@@ -190,14 +182,10 @@ module Processing
190
182
  begin
191
183
  exec(*command)
192
184
  # exec replaces the Ruby process with the JRuby one.
193
- rescue Java::JavaLang::ClassNotFoundExcetion
185
+ rescue Java::JavaLang::ClassNotFoundException
194
186
  end
195
187
  end
196
188
 
197
- def path_separator
198
- (host_os == :windows) ? ';' : ':'
199
- end
200
-
201
189
  # If you need to pass in arguments to Java, such as the ones on this page:
202
190
  # http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/java.html
203
191
  # add them to a java_args.txt in your data directory next to your sketch.
@@ -221,11 +209,19 @@ module Processing
221
209
  end
222
210
 
223
211
  def jruby_complete
224
- rcomplete = File.join(RP5_ROOT, 'lib/ruby/jruby-complete.jar')
212
+ rcomplete = File.join(K9_ROOT, 'lib/ruby/jruby-complete.jar')
225
213
  return [rcomplete] if FileTest.exist?(rcomplete)
226
214
  warn "#{rcomplete} does not exist\nTry running `k9 setup install`"
227
215
  exit
228
216
  end
217
+
218
+ def libraries
219
+ %w(video sound).map { |library| sketchbook_library(library) }.flatten
220
+ end
221
+
222
+ def sketchbook_library(name)
223
+ Dir["#{Processing::RP_CONFIG['sketchbook_path']}/libraries/#{name}/library/\*.jar"]
224
+ end
229
225
 
230
226
  def host_os
231
227
  detect_os = RbConfig::CONFIG['host_os']
@@ -249,7 +245,7 @@ module Processing
249
245
  if os == :mac
250
246
  data['PROCESSING_ROOT'] = '/Applications/Processing.app/Contents/Java'
251
247
  else
252
- root = "#{ENV['HOME']}/processing-3.0a10"
248
+ root = "#{ENV['HOME']}/processing-3.0a11"
253
249
  data['PROCESSING_ROOT'] = root
254
250
  end
255
251
  data['JRUBY'] = 'true'
@@ -261,8 +257,8 @@ module Processing
261
257
  @os ||= host_os
262
258
  icon = []
263
259
  if os == :mac
264
- icon << '-Xdock:name=Ruby-Processing'
265
- icon << "-Xdock:icon=#{RP5_ROOT}/lib/templates/application/Contents/Resources/sketch.icns"
260
+ icon << '-Xdock:name=JRubyArt'
261
+ icon << "-Xdock:icon=#{K9_ROOT}/lib/templates/application/Contents/Resources/sketch.icns"
266
262
  end
267
263
  icon
268
264
  end
@@ -3,8 +3,8 @@
3
3
  SKETCH_PATH ||= ARGV.shift
4
4
  SKETCH_ROOT ||= File.dirname(SKETCH_PATH)
5
5
 
6
- require_relative '../../jruby_art'
7
- require_relative '../../jruby_art/app'
6
+ # we can safely require app.rb as we are using a jruby runtime
7
+ require_relative '../app'
8
8
 
9
9
  # More processing module
10
10
  module Processing
@@ -1,6 +1,3 @@
1
- # TODO: this is crud. Windows applets are having serious
2
- # trouble with absolute paths.
3
-
4
- require_relative '../runners/base'
1
+ require_relative 'base'
5
2
 
6
3
  Processing.load_and_run_sketch
@@ -1,4 +1,4 @@
1
- require_relative '../runners/base'
1
+ require_relative 'base'
2
2
 
3
3
  module Processing
4
4
  # A sketch loader, observer, and reloader, to tighten
@@ -12,7 +12,7 @@ module Processing
12
12
  start_watching
13
13
  end
14
14
 
15
- # Kicks off a thread to watch the sketch, reloading Ruby-Processing
15
+ # Kicks off a thread to watch the sketch, reloading JRubyArt
16
16
  # and restarting the sketch whenever it changes.
17
17
  def start_watching
18
18
  start_runner
@@ -1,3 +1,3 @@
1
1
  module JRubyArt
2
- VERSION = '0.3.1.pre'
2
+ VERSION = '0.4.0'
3
3
  end
data/lib/rpextras.jar CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  # require 'rpextras'
2
2
 
3
- LibraryProxy = Java::ProcessingCore::AbstractLibrary
3
+ LibraryProxy = Java::MonkstoneCore::AbstractLibrary
4
4
 
5
5
  # classes that inherit from Library are expected to implement
6
6
  # the abstract methods of processing.core.AbstractLibrary
@@ -1,4 +1,3 @@
1
-
2
1
  class Processing::App
3
- include Java::ProcessingCore::VideoInterface
2
+ include Java::MonkstoneVideoevent::VideoInterface
4
3
  end
data/vendors/Rakefile CHANGED
@@ -8,8 +8,8 @@ WARNING = <<-EOS
8
8
 
9
9
  EOS
10
10
 
11
- JRUBYC_VERSION = '9.0.0.0.rc2'
12
- EXAMPLES = '0.2'
11
+ JRUBYC_VERSION = '9.0.0.0'
12
+ EXAMPLES = '0.4'
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", "3c490d1b621db41709e0d093ab36585a50604dfd")
30
+ check_sha1("jruby-complete-#{JRUBYC_VERSION}.jar", "2479278bdd92d85ca37c5d45a4ec4745c50dfccb")
31
31
  end
32
32
 
33
33
  directory "../lib/ruby"
@@ -77,5 +77,5 @@ task :copy_examples => file_name do
77
77
  end
78
78
  sh "rm -r #{HOME_DIR}/k9_samples" if File.exist? "#{HOME_DIR}/k9_samples"
79
79
  sh "cp -r samples4ruby-processing3-#{EXAMPLES} #{HOME_DIR}/k9_samples"
80
- sh "rm -r samples4ruby-processing3-#{EXAMPLES} #{HOME_DIR}/k9_samples"
80
+ sh "rm -r samples4ruby-processing3-#{EXAMPLES}"
81
81
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby_art
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1.pre
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -10,12 +10,12 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-07-09 00:00:00.000000000 Z
13
+ date: 2015-07-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.3'
21
21
  name: bundler
@@ -23,13 +23,13 @@ dependencies:
23
23
  type: :development
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: '1.3'
29
29
  - !ruby/object:Gem::Dependency
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '10.3'
35
35
  name: rake
@@ -37,13 +37,13 @@ dependencies:
37
37
  type: :development
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '10.3'
43
43
  - !ruby/object:Gem::Dependency
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0.9'
49
49
  name: rake-compiler
@@ -51,13 +51,13 @@ dependencies:
51
51
  type: :development
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ~>
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0.9'
57
57
  - !ruby/object:Gem::Dependency
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '5.3'
63
63
  name: minitest
@@ -65,12 +65,12 @@ dependencies:
65
65
  type: :development
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ~>
68
+ - - "~>"
69
69
  - !ruby/object:Gem::Version
70
70
  version: '5.3'
71
71
  description: |2
72
72
  JRubyArt is a ruby wrapper for the processing art framework.
73
- The current version supports processing-3.0a10, and uses jruby-9.0.0.0.rc2
73
+ The current version supports processing-3.0a11, and uses jruby-9.0.0.0
74
74
  as the glue between ruby and java. You can use both processing libraries and ruby
75
75
  gems in your sketches. Features create/run/watch modes. The "watch" mode,
76
76
  provides a nice REPL-ish way to work on your processing sketches. Includes:-
@@ -116,18 +116,18 @@ require_paths:
116
116
  - lib
117
117
  required_ruby_version: !ruby/object:Gem::Requirement
118
118
  requirements:
119
- - - '>='
119
+ - - ">="
120
120
  - !ruby/object:Gem::Version
121
121
  version: '2.1'
122
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - '>'
124
+ - - ">="
125
125
  - !ruby/object:Gem::Version
126
- version: 1.3.1
126
+ version: '0'
127
127
  requirements:
128
128
  - A decent graphics card
129
129
  - java runtime >= 1.8+
130
- - processing = 3.0a10+
130
+ - processing = 3.0a11+
131
131
  rubyforge_project:
132
132
  rubygems_version: 2.4.8
133
133
  signing_key: