jruby_art 1.2.7 → 1.2.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4da6eeb261a073b3c3f6112d128ec968be2ac318
4
- data.tar.gz: 58976723ac243d117a2fa73bc2629c6181b77c39
3
+ metadata.gz: ebf4e0e9543d34a691190a32b124c92c83acb263
4
+ data.tar.gz: 5f5c169933e317f65d1efeffa9fcdc8086c83c01
5
5
  SHA512:
6
- metadata.gz: fccd6b7fd496ca222f3bb42407df58b727ea07005cfe2ee2c4cbd3bfda38ae44ac4f23c88f75a90c9babf72e2df1fbad2d8976f1f55960085a9b5523d88d71bc
7
- data.tar.gz: f3b67a676d082efdde7795b57beef2af35f56a13435f2708169570959c2080dfd4d52abb271e928b2ae8ec33ff9a8a916380122a1b6164311ad23a7c95d31d43
6
+ metadata.gz: '091a86a696a90c174d5c8d506adc2f656bfaf4ed473b19fa55f9da8d2faa320b47ab3e07e0be44d38f910df603bbd4b8203b2036c3a2d993fd12e056285cc2ec'
7
+ data.tar.gz: 8d3861eb7bcb6f8105b97c36536805738c346aae8e7c7ecd4145ba28793b13cbcf3b7cf341699f085ef05dcf1a6a4f1831a77f83f921f6b589784484477bfe22
data/lib/jruby_art/app.rb CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  # frozen_string_literal: false
2
3
  require 'java'
3
4
  require_relative '../rpextras'
@@ -55,10 +56,10 @@ module Processing
55
56
 
56
57
  class << self
57
58
  # Handy getters and setters on the class go here:
58
- attr_accessor :sketch_class, :library_loader
59
+ attr_reader :sketch_class, :library_loader
59
60
 
60
61
  def load_libraries(*args)
61
- library_loader ||= LibraryLoader.new
62
+ @library_loader ||= LibraryLoader.new
62
63
  library_loader.load_library(*args)
63
64
  end
64
65
  alias load_library load_libraries
@@ -93,9 +94,10 @@ module Processing
93
94
  # Options are no longer relevant, define post_initialize method to use
94
95
  # custom options (see Sandi Metz POODR)
95
96
 
96
- def initialize
97
+ def initialize(options = {})
97
98
  super()
98
99
  $app = self
100
+ post_initialize(options)
99
101
  proxy_java_fields
100
102
  mix_proxy_into_inner_classes
101
103
  java.lang.Thread.default_uncaught_exception_handler = proc do |_thread_, exception|
@@ -121,8 +123,8 @@ module Processing
121
123
  surface.set_title(title)
122
124
  end
123
125
 
124
- def sketch_path(spath = nil)
125
- return super() if spath.nil?
126
+ def sketch_path(spath = '')
127
+ return super() if spath.empty?
126
128
  super(spath)
127
129
  end
128
130
 
@@ -13,4 +13,42 @@ module Processing
13
13
  warn(format('WARN: you need to set PROCESSING_ROOT in %s', config_path))
14
14
  end
15
15
  end
16
+
17
+ WIN_PATTERNS = [
18
+ /bccwin/i,
19
+ /cygwin/i,
20
+ /djgpp/i,
21
+ /ming/i,
22
+ /mswin/i,
23
+ /wince/i
24
+ ].freeze
25
+
26
+ # This class knows about supported JRubyArt operating systems
27
+ class HostOS
28
+ def self.os
29
+ detect_os = RbConfig::CONFIG['host_os']
30
+ case detect_os
31
+ when /mac|darwin/ then :mac
32
+ when /linux/ then :linux
33
+ when /solaris|bsd/ then :unix
34
+ else
35
+ WIN_PATTERNS.find { |reg| detect_os =~ reg }
36
+ raise "unsupported os: #{detect_os.inspect}" if Regexp.last_match.nil?
37
+ :windows
38
+ end
39
+ end
40
+ end
41
+
42
+ OS ||= HostOS.os
43
+ end
44
+
45
+ # This class encapulates knowledge of processing sketchbook structure
46
+ class Sketchbook
47
+ def self.path
48
+ File.join(Processing::RP_CONFIG['sketchbook_path'], 'libraries')
49
+ end
50
+
51
+ def self.library(name)
52
+ Dir["#{path}/#{name}/library/\*.jar"]
53
+ end
16
54
  end
@@ -31,13 +31,13 @@ class Installer
31
31
  end
32
32
 
33
33
  def root_exist?
34
- return false if config.nil?
34
+ return false if config.empty?
35
35
  File.exist? config['PROCESSING_ROOT']
36
36
  end
37
37
 
38
38
  def config
39
39
  k9config = File.expand_path("#{home}/.jruby_art/config.yml")
40
- return nil unless File.exist? k9config
40
+ return '' unless File.exist? k9config
41
41
  YAML.load_file(k9config)
42
42
  end
43
43
 
@@ -109,7 +109,7 @@ module Processing
109
109
  "#{Processing::RP_CONFIG['PROCESSING_ROOT']}/modes/java/libraries/#{library_name}/library",
110
110
  "#{K9_ROOT}/library/#{library_name}/library",
111
111
  "#{K9_ROOT}/library/#{library_name}",
112
- "#{@sketchbook_library_path}/#{library_name}/library"
112
+ "#{Sketchbook.path}/#{library_name}/library"
113
113
  ].each do |jpath|
114
114
  if File.exist?(jpath) && !Dir.glob(format('%s/*.%s', jpath, ext)).empty?
115
115
  return jpath
@@ -136,13 +136,13 @@ module Processing
136
136
 
137
137
  def install
138
138
  require_relative '../jruby_art/installer'
139
- JRubyCompleteInstall.new(K9_ROOT, host_os).install
140
- UnpackSamples.new(K9_ROOT, host_os).install
139
+ JRubyCompleteInstall.new(K9_ROOT, OS).install
140
+ UnpackSamples.new(K9_ROOT, OS).install
141
141
  end
142
142
 
143
143
  def check
144
144
  require_relative '../jruby_art/installer'
145
- Check.new(K9_ROOT, host_os).install
145
+ Check.new(K9_ROOT, OS).install
146
146
  end
147
147
 
148
148
  # Show the standard help/usage message.
@@ -183,24 +183,7 @@ module Processing
183
183
  end
184
184
 
185
185
  def libraries
186
- %w(video sound).map { |library| sketchbook_library(library) }.flatten
187
- end
188
-
189
- def sketchbook_library(name)
190
- Dir["#{Processing::RP_CONFIG['sketchbook_path']}/libraries/#{name}/library/\*.jar"]
191
- end
192
-
193
- def host_os
194
- detect_os = RbConfig::CONFIG['host_os']
195
- case detect_os
196
- when /mac|darwin/ then :mac
197
- when /linux/ then :linux
198
- when /solaris|bsd/ then :unix
199
- else
200
- WIN_PATTERNS.find { |r| detect_os =~ r }
201
- raise "unknown os: #{detect_os.inspect}" if Regexp.last_match.nil?
202
- :windows
203
- end
186
+ %w(video sound).map { |library| Sketchbook.library(library) }.flatten
204
187
  end
205
188
  end # class Runner
206
189
  end # module Processing
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # A wrapper for version
3
3
  module JRubyArt
4
- VERSION = '1.2.7'.freeze
4
+ VERSION = '1.2.8'.freeze
5
5
  end
data/lib/rpextras.jar CHANGED
Binary file
data/vendors/Rakefile CHANGED
@@ -9,7 +9,7 @@ WARNING = <<-EOS.freeze
9
9
  EOS
10
10
 
11
11
  JRUBYC_VERSION = '9.1.7.0'
12
- EXAMPLES = '1.8'
12
+ EXAMPLES = '1.9'
13
13
  HOME_DIR = ENV['HOME']
14
14
  MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
15
15
 
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.7
4
+ version: 1.2.8
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: 2017-01-12 00:00:00.000000000 Z
13
+ date: 2017-01-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - A decent graphics card
103
103
  - java runtime >= 1.8.0_111+
104
- - processing = 3.2.1+
104
+ - processing = 3.2.4+
105
105
  rubyforge_project:
106
106
  rubygems_version: 2.6.8
107
107
  signing_key: