jruby_art 1.2.5 → 1.2.6

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: d1b91cea8de9bdd46bff4b9d7f87eb566d37db6a
4
- data.tar.gz: 5acbc932e3a7b9ba2fc4dbbe11a83145eec1aa18
3
+ metadata.gz: 78fe78d9b4fc7d9ed32a9334a6c476018c8e605c
4
+ data.tar.gz: d9d3a711138cdb6e0dc0e1fe44522f68bed34003
5
5
  SHA512:
6
- metadata.gz: 2dee4798bfb73b5c99c2884747bb855fc38cbd22a67b5fe9200d695229e85509841b2d6f06c276e434c9e1ed50d2171711a42c5a04258c674e396afd8df65ae6
7
- data.tar.gz: 60ca9549ffa124cdf2d695f7539e7aaf2709986f715f303c2ddae395fc5a45b4728af4e3c10c5f49f891058d77c6aee56f20f1a05108fec0c0e44e8dd1db5c5a
6
+ metadata.gz: 845ddebe3786fec96a9dc18a89f19c2ca8b35ac747754933871ecb6f9e0874cda1167bdfb8982778a1c5034fb11134b4dc2e06fe2c82115d5813d9a684287ef2
7
+ data.tar.gz: b95e566503b2ac46c9ee32908c10a135243338aad858faf364a45128f5973c7cacd6844f3d9b2a406481182af1ffa93ec2eddd924e3f01fa8b3f6f907c21d4cd
data/lib/jruby_art.rb CHANGED
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
2
2
  # JRubyArt is for Code Art.
3
3
  # Send suggestions, ideas, and hate-mail to mamba2928 [at] gmail.com
4
4
  # Also, send samples and libraries.
data/lib/jruby_art/app.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: false
2
-
3
2
  require 'java'
4
3
  require_relative '../rpextras'
5
4
  require_relative '../jruby_art/helper_methods'
@@ -31,7 +30,7 @@ module Processing
31
30
  key_pressed: :keyPressed,
32
31
  key_released: :keyReleased,
33
32
  key_typed: :keyTyped
34
- }
33
+ }.freeze
35
34
  # All sketches extend this class
36
35
  class App < PApplet
37
36
  include HelperMethods, Math, MathTool, Render
@@ -87,7 +86,7 @@ module Processing
87
86
  def library_loaded?(library_name)
88
87
  self.class.library_loaded?(library_name)
89
88
  end
90
-
89
+
91
90
  # Since processing-3.0 you should prefer setting the sketch width and
92
91
  # height and renderer using the size method in the settings loop of the
93
92
  # sketch (as with vanilla processing) but is hidden see created java.
@@ -108,7 +107,7 @@ module Processing
108
107
  # NB: this is the processing runSketch() method as used by processing.py
109
108
  run_sketch
110
109
  end
111
-
110
+
112
111
  def size(*args)
113
112
  w, h, mode = *args
114
113
  @width ||= w
@@ -129,8 +128,8 @@ module Processing
129
128
 
130
129
  def data_path(dat)
131
130
  dat_root = File.join(SKETCH_ROOT, 'data')
132
- Dir.mkdir(dat_root) unless File.exist?(dat_root)
133
- File.join(dat_root, dat)
131
+ Dir.mkdir(dat_root) unless File.exist?(dat_root)
132
+ File.join(dat_root, dat)
134
133
  end
135
134
 
136
135
  def sketch_size(x, y)
@@ -181,8 +180,8 @@ module Processing
181
180
  def import_opengl
182
181
  # Include processing opengl classes that we'd like to use:
183
182
  %w(FontTexture FrameBuffer LinePath LineStroker PGL
184
- PGraphics2D PGraphics3D PGraphicsOpenGL PShader
185
- PShapeOpenGL Texture).each do |klass|
183
+ PGraphics2D PGraphics3D PGraphicsOpenGL PShader
184
+ PShapeOpenGL Texture).each do |klass|
186
185
  java_import format('processing.opengl.%s', klass)
187
186
  end
188
187
  end
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: false
3
2
 
4
3
  require 'yaml'
@@ -9,7 +8,7 @@ module Processing
9
8
  config_path = '~/.jruby_art/config.yml'
10
9
  begin
11
10
  CONFIG_FILE_PATH = File.expand_path(config_path)
12
- RP_CONFIG = (YAML.load_file(CONFIG_FILE_PATH))
11
+ RP_CONFIG = YAML.load_file(CONFIG_FILE_PATH)
13
12
  rescue
14
13
  warn(format('WARN: you need to set PROCESSING_ROOT in %s', config_path))
15
14
  end
@@ -181,7 +181,7 @@ module Processing
181
181
 
182
182
  private
183
183
 
184
- FIXNUM_COL = -> (x) { x.is_a?(Fixnum) }
184
+ FIXNUM_COL = -> (x) { x.is_a?(Integer) }
185
185
  STRING_COL = -> (x) { x.is_a?(String) }
186
186
  FLOAT_COL = -> (x) { x.is_a?(Float) }
187
187
  # parse single argument color int/double/String
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- # frozen_string_literal: false
3
-
1
+ # frozen_string_literal: true
4
2
  # Axis aligned bounding box class (AABB would clash with Toxicgem)
5
3
  class AaBb
6
4
  attr_reader :center, :extent
@@ -1,5 +1,4 @@
1
- # encoding: utf-8
2
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
3
2
  # Re-open Numeric so that we can do simple degree and radian conversions
4
3
  # conversion factors are 180 / Math::PI and Math::PI / 180
5
4
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
  require 'yaml'
3
3
 
4
- VERSION = '3.2.1'.freeze # processing version
4
+ VERSION = '3.2.3'.freeze # processing version
5
5
 
6
6
  # Abstract Installer class
7
7
  class Installer
@@ -84,7 +84,7 @@ class UnpackSamples < Installer
84
84
  end
85
85
 
86
86
  # JRuby-Complete installer
87
- class JRubyComplete < Installer
87
+ class JRubyCompleteInstall < Installer
88
88
  def install
89
89
  system "cd #{gem_root}/vendors && rake"
90
90
  return if root_exist?
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ class JRubyComplete
3
+ def self.complete
4
+ rcomplete = File.join(K9_ROOT, 'lib/ruby/jruby-complete.jar')
5
+ return [rcomplete] if FileTest.exist?(rcomplete)
6
+ warn "#{rcomplete} does not exist\nTry running `k9 --install`"
7
+ exit
8
+ end
9
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+ require_relative '../jruby_art/jruby_complete'
3
+ require_relative '../jruby_art/java_opts'
4
+ module Processing
5
+ # The command class check for configuration and options, before creating and
6
+ # executing the jruby (or java) command to run the sketch
7
+ class Launcher
8
+ attr_reader :runner, :args, :filename
9
+ def initialize(runner:, args:, filename:)
10
+ @runner = runner
11
+ @args = args
12
+ @filename = filename
13
+ end
14
+
15
+ # Trade in this Ruby instance for a JRuby instance, loading in a starter
16
+ # script and passing it some arguments. Unless you set JRUBY: false in
17
+ # ~/.jruby_art/config.yml, an installed version of jruby is used instead
18
+ # of our vendored one. Note the use of jruby-complete might make using
19
+ # other gems in your sketches hard (but not impossible)....
20
+ def cmd(root)
21
+ cmda = jruby_command(root)
22
+ begin
23
+ exec(*cmda)
24
+ # exec replaces the Ruby process with the JRuby one.
25
+ rescue Java::JavaLang::ClassNotFoundException
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ # avoiding multiline ternary etc
32
+ def jruby_command(root)
33
+ installed = Processing::RP_CONFIG.fetch('JRUBY', true)
34
+ opts = JRubyOpts.new(root).opts
35
+ return ['jruby', opts, runner, filename, args].flatten if installed
36
+ opts = JavaOpts.new(root).opts
37
+ complete = JRubyComplete.complete
38
+ ['java', opts, '-cp', complete, 'org.jruby.Main', runner, filename, args].flatten
39
+ end
40
+ end
41
+ end
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: false
3
2
 
4
3
  require_relative '../jruby_art'
@@ -29,10 +28,10 @@ module Processing
29
28
  message = 'no such file to load -- %s'
30
29
  args.each do |lib|
31
30
  loaded = load_ruby_library(lib) || load_java_library(lib)
32
- fail(LoadError.new, format(message, lib)) unless loaded
31
+ raise(LoadError.new, format(message, lib)) unless loaded
33
32
  end
34
33
  end
35
- alias_method :load_library, :load_libraries
34
+ alias load_library load_libraries
36
35
 
37
36
  # For pure ruby libraries.
38
37
  # The library should have an initialization ruby file
@@ -83,7 +82,7 @@ module Processing
83
82
  end
84
83
 
85
84
  def get_platform_specific_library_paths(basename)
86
- # for MacOSX, but does this even work, or does Mac return '64'?
85
+ # for MacOS, but does this even work, or does Mac return '64'?
87
86
  bits = 'universal'
88
87
  if java.lang.System.getProperty('sun.arch.data.model') == '32' ||
89
88
  java.lang.System.getProperty('java.vm.name').index('32')
@@ -118,6 +117,6 @@ module Processing
118
117
  end
119
118
  end
120
119
  nil
121
- end
120
+ end
122
121
  end
123
122
  end
@@ -6,7 +6,7 @@ require 'rbconfig'
6
6
  require_relative '../jruby_art/config'
7
7
  require_relative '../jruby_art/version'
8
8
  require_relative '../jruby_art/java_opts'
9
-
9
+ require_relative '../jruby_art/launcher'
10
10
  # processing wrapper module
11
11
  module Processing
12
12
  # Utility class to handle the different commands that the 'k9' command
@@ -136,7 +136,7 @@ module Processing
136
136
 
137
137
  def install
138
138
  require_relative '../jruby_art/installer'
139
- JRubyComplete.new(K9_ROOT, host_os).install
139
+ JRubyCompleteInstall.new(K9_ROOT, host_os).install
140
140
  UnpackSamples.new(K9_ROOT, host_os).install
141
141
  end
142
142
 
@@ -156,42 +156,23 @@ module Processing
156
156
 
157
157
  private
158
158
 
159
- # Trade in this Ruby instance for a JRuby instance, loading in a starter
160
- # script and passing it some arguments. Unless you set JRUBY: false in
161
- # ~/.jruby_art/config.yml, an installed version of jruby is used instead
162
- # of our vendored one. Note the use of jruby-complete might make using
163
- # other gems in your sketches hard (but not impossible)....
159
+ # We now build and execute the command arguments in the Launcher class.
160
+ # Here we only need to supply the starter script, filename and args if any,
161
+ # the Launcher class checks config (is executable java or jruby?)
162
+ # and for any options in java_args.txt or config
164
163
  def spin_up(starter_script, filename, argc)
165
- runner = "#{K9_ROOT}/lib/jruby_art/runners/#{starter_script}"
166
- if Processing::RP_CONFIG.fetch('JRUBY', true)
167
- opts = JRubyOpts.new(SKETCH_ROOT).opts
168
- command = ['jruby',
169
- opts,
170
- runner,
171
- filename,
172
- argc].flatten
173
- else
174
- opts = JavaOpts.new(SKETCH_ROOT).opts
175
- command = ['java',
176
- opts,
177
- '-cp',
178
- jruby_complete,
179
- 'org.jruby.Main',
180
- runner,
181
- filename,
182
- argc].flatten
183
- end
184
- begin
185
- exec(*command)
186
- # exec replaces the Ruby process with the JRuby one.
187
- rescue Java::JavaLang::ClassNotFoundException
188
- end
164
+ launch = Launcher.new(
165
+ runner: "#{K9_ROOT}/lib/jruby_art/runners/#{starter_script}",
166
+ args: argc,
167
+ filename: filename
168
+ )
169
+ launch.cmd(SKETCH_ROOT)
189
170
  end
190
171
 
191
172
  # NB: We really do mean to use 'and' not '&&' for flow control purposes
192
173
 
193
174
  def ensure_exists(filename)
194
- puts "Couldn't find: #{filename}" and exit unless FileTest.exist?(filename)
175
+ puts("Couldn't find: #{filename}") and exit unless FileTest.exist?(filename)
195
176
  end
196
177
 
197
178
  def jruby_complete
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- # frozen_string_literal: false
3
-
1
+ # frozen_string_literal: true
4
2
  SKETCH_PATH ||= ARGV.shift
5
3
  SKETCH_ROOT ||= File.absolute_path(File.dirname(SKETCH_PATH))
6
4
 
@@ -10,13 +8,13 @@ require_relative '../app'
10
8
  # More processing module
11
9
  module Processing
12
10
  # For use with "bare" sketches that don't want to define a class or methods
13
- BARE_WRAP = <<-EOS
11
+ BARE_WRAP = <<-EOS.freeze
14
12
  class Sketch < Processing::App
15
13
  %s
16
14
  end
17
15
  EOS
18
16
 
19
- NAKED_WRAP = <<-EOS
17
+ NAKED_WRAP = <<-EOS.freeze
20
18
  class Sketch < Processing::App
21
19
  def setup
22
20
  sketch_title 'Nude Sketch'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: false
3
2
  # A pry shell for live coding.
4
3
  # Will start with your sketch.
@@ -8,11 +7,11 @@ Processing.load_and_run_sketch
8
7
  class PryException < StandardError
9
8
  end
10
9
 
11
- MESSAGE = "You need to 'jruby -S gem install pry' for 'live' mode"
10
+ MESSAGE = "You need to 'jruby -S gem install pry' for 'live' mode".freeze
12
11
 
13
12
  if Gem::Specification.find_all_by_name('pry').any?
14
13
  require 'pry'
15
14
  $app.pry
16
15
  else
17
- fail(PryException.new, MESSAGE)
16
+ raise(PryException.new, MESSAGE)
18
17
  end
@@ -1,5 +1,4 @@
1
- # encoding: utf-8
2
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
3
2
  require_relative 'base'
4
3
 
5
4
  Processing.load_and_run_sketch
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: false
3
2
  require_relative 'base'
4
3
  require_relative '../config'
@@ -11,7 +10,7 @@ module Processing
11
10
  # the feedback between code and effect.
12
11
  class Watcher
13
12
  # Sic a new Processing::Watcher on the sketch
14
- WATCH_MESSAGE ||= <<-EOS
13
+ WATCH_MESSAGE ||= <<-EOS.freeze
15
14
  Warning:
16
15
  To protect you from running watch mode in a top level
17
16
  directory with lots of nested ruby or GLSL files we
@@ -54,7 +53,7 @@ module Processing
54
53
  warn format(wformat, File.basename(SKETCH_PATH))
55
54
  puts format(tformat, e.backtrace.join("\n\t"))
56
55
  end
57
-
56
+
58
57
  def start_original
59
58
  @runner = Thread.start do
60
59
  report_errors do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # A wrapper for version
3
3
  module JRubyArt
4
- VERSION = '1.2.5'.freeze
4
+ VERSION = '1.2.6'.freeze
5
5
  end
data/lib/rpextras.jar CHANGED
Binary file
@@ -1,5 +1,3 @@
1
- # require 'rpextras'
2
- #@todo fix how we call Library Proxy
3
1
  java_import Java::MonkstoneCore::LibraryProxy
4
2
 
5
3
 
data/vendors/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rake/clean'
2
2
 
3
- WARNING = <<-EOS
3
+ WARNING = <<-EOS.freeze
4
4
  WARNING: you may not have wget installed, you could just download
5
5
  the correct version of jruby-complete to the vendors folder, and
6
6
  re-run k9 setup install instead of installing wget. Some systems
@@ -8,8 +8,8 @@ WARNING = <<-EOS
8
8
 
9
9
  EOS
10
10
 
11
- JRUBYC_VERSION = '9.1.5.0'
12
- EXAMPLES = '1.6'
11
+ JRUBYC_VERSION = '9.1.6.0'
12
+ EXAMPLES = '1.7'
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_sha256("jruby-complete-#{JRUBYC_VERSION}.jar", "7711fe1d09bb98727a43f5aaef5ea3a205500568bc2fa718cb7ef77dd3800519")
30
+ check_sha256("jruby-complete-#{JRUBYC_VERSION}.jar", "2a45c5f24deb538343c3a9b9a3b29bbeb11fa9d91cf8649271bd07d2e1aa28cb")
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: jruby_art
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-10-18 00:00:00.000000000 Z
13
+ date: 2016-11-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -61,6 +61,8 @@ files:
61
61
  - lib/jruby_art/helpers/numeric.rb
62
62
  - lib/jruby_art/installer.rb
63
63
  - lib/jruby_art/java_opts.rb
64
+ - lib/jruby_art/jruby_complete.rb
65
+ - lib/jruby_art/launcher.rb
64
66
  - lib/jruby_art/library_loader.rb
65
67
  - lib/jruby_art/runner.rb
66
68
  - lib/jruby_art/runners/base.rb
@@ -98,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
100
  version: '0'
99
101
  requirements:
100
102
  - A decent graphics card
101
- - java runtime >= 1.8.0_102+
103
+ - java runtime >= 1.8.0_111+
102
104
  - processing = 3.2.1+
103
105
  rubyforge_project:
104
106
  rubygems_version: 2.6.3