jruby_art 1.2.1 → 1.2.2

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: e477bba7efa66be3f3e7e7074c59c17ae2c96cc9
4
- data.tar.gz: b8d58ad635bc669934b145fb32c0dcfa8d4d4387
3
+ metadata.gz: f668fbc71962abf201d373a8b3cac768c81ea269
4
+ data.tar.gz: 2abb81363bb489fb397c51443c7c33d477bfcbc2
5
5
  SHA512:
6
- metadata.gz: 8f7e9e1bcc6ffc15dadd07590c8432730b10adf08a895b2885d3ba7ed148603e0758cba31452a42ea8e7e7689712477842e5287abcde717318b025d2168fba8e
7
- data.tar.gz: d797473e7e1d44bed8fd151c9cd43a5327a9bea031b27783c5d89212f8ffa60523fe07021d948b1e78d5dcec4aa92894b5f09d88dea0ec71395ef0c9f3ef5ed8
6
+ metadata.gz: 03cb1b70cf248937f86cee8d6c135e861232e07279352fdbd194d294eebd04b68eab1b75a780e8ff80b64eedaacf76015bbf0e321daff36c4de7e26125aa20c5
7
+ data.tar.gz: 9821714651eaec453b93ff15ebd9268092a27fb01aaa2989f4933f472bb7d19955fadea645a324bb0fabc31cab5ebe58286f8aae70a8cf0b18ff87db620b61b0
data/lib/jruby_art.rb CHANGED
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: false
3
2
  # JRubyArt is for Code Art.
4
3
  # Send suggestions, ideas, and hate-mail to mamba2928 [at] gmail.com
data/lib/jruby_art/app.rb CHANGED
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: false
3
2
 
4
3
  require 'java'
@@ -38,10 +37,10 @@ module Processing
38
37
  include HelperMethods, Math, MathTool, Render
39
38
  # Alias some methods for familiarity for Shoes coders.
40
39
  # surface replaces :frame, but needs field_reader for access
41
- alias_method :oval, :ellipse
42
- alias_method :stroke_width, :stroke_weight
43
- alias_method :rgb, :color
44
- alias_method :gray, :color
40
+ alias oval ellipse
41
+ alias stroke_width stroke_weight
42
+ alias rgb color
43
+ alias gray color
45
44
  field_reader :surface
46
45
 
47
46
  def sketch_class
@@ -63,7 +62,7 @@ module Processing
63
62
  library_loader ||= LibraryLoader.new
64
63
  library_loader.load_library(*args)
65
64
  end
66
- alias_method :load_library, :load_libraries
65
+ alias load_library load_libraries
67
66
 
68
67
  def library_loaded?(library_name)
69
68
  library_loader.library_loaded?(library_name)
@@ -194,6 +193,10 @@ module Processing
194
193
  module Proxy
195
194
  include Math, HelperMethods, Java::ProcessingCore::PConstants
196
195
 
196
+ def respond_to_missing?(name, include_private = false)
197
+ $app.respond_to?(name) || super
198
+ end
199
+
197
200
  def method_missing(name, *args)
198
201
  return $app.send(name, *args) if $app && $app.respond_to?(name)
199
202
  super
@@ -1,128 +1,101 @@
1
- EMACS = <<-CODE
2
1
  # frozen_string_literal: false
3
- require 'jruby_art'
4
- require 'jruby_art/app'
5
-
6
- Processing::App::SKETCH_PATH = __FILE__.freeze
7
-
8
- class %s < Processing::App
9
- def settings
10
- %s
11
- end
12
-
13
- def setup
14
- %s
15
- end
16
-
17
- def draw
2
+ # The SketchParameters class knows how to format, size, title & class name
3
+ class SketchParameters
4
+ attr_reader :name, :args
5
+ def initialize(name:, args:)
6
+ @name = name
7
+ @args = args
18
8
  end
19
- end
20
-
21
- %s.new unless defined? $app
22
9
 
23
- CODE
24
-
25
- CLASS = <<-CODE
26
- class %s < Processing::App
27
- def settings
28
- %s
10
+ def class_name
11
+ name.split('_').collect(&:capitalize).join
29
12
  end
30
13
 
31
- def setup
32
- %s
14
+ def sketch_title
15
+ human = name.split('_').collect(&:capitalize).join(' ')
16
+ format("sketch_title '%s'", human)
33
17
  end
34
18
 
35
- def draw
19
+ def sketch_size
20
+ mode = args.length == 3 ? format(', %s', args[2].upcase) : ''
21
+ return 'size 200, 200' if args.empty?
22
+ format('size %d, %d%s', args[0].to_i, args[1].to_i, mode)
36
23
  end
37
24
  end
38
25
 
39
- CODE
40
-
41
- METHOD = <<-CODE
42
- def %s
43
- %s
44
- end
45
-
46
- CODE
47
-
48
- require_relative '../helpers/string_extra'
49
-
50
- # Sketch writer class
26
+ # The file writer can write a sketch when given instance of Sketch type
51
27
  class SketchWriter
52
- attr_reader :file, :args, :sketch, :name
28
+ attr_reader :file, :param
53
29
 
54
30
  def initialize(path, args)
55
- @args = args
56
- @name = path
57
- underscore = StringExtra.new(path).underscore
58
- @file = format('%s/%s.rb', File.dirname(path), underscore)
59
- end
60
-
61
- def create!(type)
62
- case type
63
- when /bare/
64
- @sketch = Sketch.new.bare(name, args)
65
- when /class/
66
- @sketch = Sketch.new.class_wrapped(name, args)
67
- when /emacs/
68
- @sketch = Sketch.new.emacs(name, args)
69
- end
70
- save(sketch)
31
+ @param = SketchParameters.new(name: path, args: args)
32
+ @file = format('%s/%s.rb', File.dirname(path), path)
71
33
  end
72
34
 
73
- def save(sketch)
74
- File.open(file, 'w+') do |f|
75
- f.write(sketch)
76
- end
35
+ def write(creator)
36
+ sketch = creator.code(param)
37
+ File.open(file, 'w+') { |f| f.write sketch.join("\n") }
77
38
  end
78
39
  end
79
40
 
80
- # Sketch class
41
+ # Implements methods and class_methods omits blank line after draw
42
+ # uses private method_lines to format method lines
81
43
  class Sketch
82
- def bare(name = 'sketch', args = [])
83
- [settings(args), setup(name), draw].join
84
- end
44
+ BLANK ||= ''.freeze
45
+ INDENT ||= ' '.freeze
85
46
 
86
- def class_wrapped(name = 'sketch', args = [])
87
- class_name = StringExtra.new(name).camelize
88
- format(CLASS, class_name, size(args[0], args[1], args[2]), name(name))
47
+ def methods(param, indent)
48
+ lines = []
49
+ lines.concat method_lines('settings', param.sketch_size, indent)
50
+ lines.concat method_lines('setup', param.sketch_title, indent)
51
+ lines.concat method_lines('draw', BLANK, indent)
89
52
  end
90
53
 
91
- def emacs(name = 'sketch', args = [])
92
- class_name = StringExtra.new(name).camelize
93
- format(
94
- EMACS,
95
- class_name,
96
- size(args[0], args[1], args[2]),
97
- name(name),
98
- class_name
99
- )
54
+ def class_methods(param)
55
+ lines = [format('class %s < Processing::App', param.class_name)]
56
+ lines.concat methods(param, INDENT)
57
+ lines << 'end'
100
58
  end
101
59
 
102
- def size(width = 200, height = 200, mode = nil)
103
- return format('size %s, %s', width, height) if mode.nil?
104
- format('size %s, %s, %s', width, height, mode.upcase)
105
- end
60
+ private
106
61
 
107
- def settings(args = [])
108
- return format(METHOD, 'settings', size) if args.empty?
109
- return format(
110
- METHOD,
111
- 'settings',
112
- size(args[0], args[1])
113
- ) if args.length == 2
114
- format(METHOD, 'settings', size(args[0], args[1], args[2]))
62
+ def method_lines(name, content, indent)
63
+ one = format('%sdef %s', indent, name)
64
+ two = content.empty? ? BLANK : format(' %s%s', indent, content)
65
+ three = format('%send', indent)
66
+ return [one, two, three] if /draw/ =~ name
67
+ [one, two, three, BLANK]
115
68
  end
69
+ end
116
70
 
117
- def name(title = 'Sketch')
118
- format("sketch_title '%s'", StringExtra.new(title).humanize)
71
+ # The sketch class creates an array of formatted sketch lines
72
+ class BareSketch < Sketch
73
+ def code(param)
74
+ methods(param, BLANK)
119
75
  end
76
+ end
120
77
 
121
- def setup(title)
122
- format(METHOD, 'setup', name(title))
78
+ # A simple class wrapped sketch
79
+ class ClassSketch < Sketch
80
+ def code(param)
81
+ lines = ['# frozen_string_literal: false', BLANK]
82
+ lines.concat class_methods(param)
123
83
  end
84
+ end
124
85
 
125
- def draw
126
- format(METHOD, 'draw', '')
86
+ # A sketch that will run with jruby, for emacs etc
87
+ class EmacsSketch < Sketch
88
+ def code(param)
89
+ lines = [
90
+ '# frozen_string_literal: false',
91
+ "require 'jruby_art'",
92
+ "require 'jruby_art/app'",
93
+ BLANK,
94
+ 'Processing::App::SKETCH_PATH = __FILE__.freeze',
95
+ BLANK
96
+ ]
97
+ lines.concat class_methods(param)
98
+ lines << BLANK
99
+ lines << format('%s.new unless defined? $app', param.class_name)
127
100
  end
128
101
  end
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: false
3
2
  # processing module wrapper
4
3
  require_relative '../rpextras'
@@ -22,15 +21,17 @@ module Processing
22
21
  def kamera(
23
22
  eye: Vec3D.new(width / 2.0, height / 2.0, (height / 2.0) / tan(PI * 30.0 / 180.0)),
24
23
  center: Vec3D.new(width / 2.0, height / 2.0, 0),
25
- up: Vec3D.new(0, 1.0, 0))
24
+ up: Vec3D.new(0, 1.0, 0)
25
+ )
26
26
  camera(eye.x, eye.y, eye.z, center.x, center.y, center.z, up.x, up.y, up.z)
27
27
  end
28
-
28
+
29
29
  def perspektiv(
30
30
  fov: Math::PI / 3.0,
31
31
  aspect_ratio: width.to_f / height,
32
32
  near_z: (height / 20.0) / tan(fov / 2.0),
33
- far_z: (height * 5) / tan(fov / 2.0))
33
+ far_z: (height * 5) / tan(fov / 2.0)
34
+ )
34
35
  perspective(fov, aspect_ratio, near_z, far_z)
35
36
  end
36
37
 
@@ -49,7 +50,7 @@ module Processing
49
50
  def lerp_color(*args)
50
51
  args.length > 3 ? self.class.lerp_color(*args) : super(*args)
51
52
  end
52
-
53
+
53
54
  # hue, sat, brightness in range 0..1.0 returns RGB color int
54
55
  def hsb_color(hue, sat, brightness)
55
56
  Java::Monkstone::ColorUtil.hsbToRgB(hue, sat, brightness)
@@ -59,14 +60,14 @@ module Processing
59
60
  return super(*args) unless args.length == 1
60
61
  super(hex_color(args[0]))
61
62
  end
62
-
63
+
63
64
  def web_to_color_array(web)
64
65
  Java::Monkstone::ColorUtil.webArray(web)
65
66
  end
66
-
67
+
67
68
  def int_to_ruby_colors(hex)
68
69
  Java::Monkstone::ColorUtil.rubyString(hex)
69
- end
70
+ end
70
71
 
71
72
  # Overrides Processing convenience function thread, which takes a String
72
73
  # arg (for a function) to more rubylike version, takes a block...
@@ -74,7 +75,7 @@ module Processing
74
75
  if block_given?
75
76
  Thread.new(&block)
76
77
  else
77
- fail ArgumentError, 'thread must be called with a block', caller
78
+ raise ArgumentError, 'thread must be called with a block', caller
78
79
  end
79
80
  end
80
81
 
@@ -100,7 +101,7 @@ module Processing
100
101
  when 6
101
102
  return dist3d(*args)
102
103
  else
103
- fail ArgumentError, 'takes 4 or 6 parameters'
104
+ raise ArgumentError, 'takes 4 or 6 parameters'
104
105
  end
105
106
  end
106
107
 
@@ -112,7 +113,7 @@ module Processing
112
113
  # There's just so many functions in Processing,
113
114
  # Here's a convenient way to look for them.
114
115
  def find_method(method_name)
115
- reg = Regexp.new("#{method_name}", true)
116
+ reg = Regexp.new(method_name.to_s, true)
116
117
  methods.sort.select { |meth| reg.match(meth) }
117
118
  end
118
119
 
@@ -120,7 +121,7 @@ module Processing
120
121
  # some methods. Add to this list as needed.
121
122
  def proxy_java_fields
122
123
  fields = %w(key frameRate mousePressed keyPressed)
123
- methods = fields.map { |field| java_class.declared_field(field) }
124
+ methods = fields.map { |field| java_class.declared_field(field) }
124
125
  @declared_fields = Hash[fields.zip(methods)]
125
126
  end
126
127
 
@@ -190,11 +191,11 @@ module Processing
190
191
  Java::Monkstone::ColorUtil.colorLong(a)
191
192
  when STRING_COL
192
193
  return Java::Monkstone::ColorUtil.colorString(a) if a =~ /#\h+/
193
- fail StandardError, 'Dodgy Hexstring'
194
+ raise StandardError, 'Dodgy Hexstring'
194
195
  when FLOAT_COL
195
196
  Java::Monkstone::ColorUtil.colorDouble(a)
196
197
  else
197
- fail StandardError, 'Dodgy Color Conversion'
198
+ raise StandardError, 'Dodgy Color Conversion'
198
199
  end
199
200
  end
200
201
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
  require 'yaml'
3
3
 
4
- VERSION = '3.1.1'.freeze # processing version
4
+ VERSION = '3.2.1'.freeze # processing version
5
5
 
6
6
  # Abstract Installer class
7
7
  class Installer
@@ -49,6 +49,7 @@ class Installer
49
49
  # Display the current version of JRubyArt.
50
50
  def show_version
51
51
  puts format('JRubyArt version %s', JRubyArt::VERSION)
52
+ puts format('Expected Processing version %s', VERSION)
52
53
  end
53
54
  end
54
55
 
@@ -2,7 +2,8 @@
2
2
  # frozen_string_literal: false
3
3
 
4
4
  require_relative '../jruby_art'
5
- require_relative 'sketchbook'
5
+ require_relative 'config'
6
+ # require_relative 'sketchbook'
6
7
  # The processing wrapper module
7
8
  module Processing
8
9
  # Encapsulate library loader functionality as a class
@@ -10,7 +11,7 @@ module Processing
10
11
  attr_reader :sketchbook_library_path
11
12
 
12
13
  def initialize
13
- @sketchbook_library_path = File.join(Sketchbook.find_path, 'libraries')
14
+ @sketchbook_library_path = File.join(Processing::RP_CONFIG['sketchbook_path'], 'libraries')
14
15
  @loaded_libraries = Hash.new(false)
15
16
  end
16
17
 
@@ -107,7 +107,10 @@ module Processing
107
107
  def create
108
108
  require_relative '../jruby_art/creators/sketch_writer'
109
109
  config = Processing::RP_CONFIG.fetch('template', 'bare')
110
- SketchWriter.new(filename, argc).create!(config)
110
+ sketch = BareSketch.new if /bare/ =~ config
111
+ sketch = ClassSketch.new if /class/ =~ config
112
+ sketch = EmacsSketch.new if /emacs/ =~ config
113
+ SketchWriter.new(File.basename(filename, '.rb'), argc).write(sketch)
111
114
  end
112
115
 
113
116
  # Export as app not implemented
@@ -10,13 +10,13 @@ require_relative '../app'
10
10
  # More processing module
11
11
  module Processing
12
12
  # For use with "bare" sketches that don't want to define a class or methods
13
- BARE_WRAP = <<-EOS
13
+ BARE_WRAP = <<~EOS
14
14
  class Sketch < Processing::App
15
15
  %s
16
16
  end
17
17
  EOS
18
18
 
19
- NAKED_WRAP = <<-EOS
19
+ NAKED_WRAP = <<~EOS
20
20
  class Sketch < Processing::App
21
21
  def setup
22
22
  sketch_title 'Nude Sketch'
@@ -30,7 +30,7 @@ module Processing
30
30
  # Kicks off a thread to watch the sketch, reloading JRubyArt
31
31
  # and restarting the sketch whenever it changes.
32
32
  def start_watching
33
- start_runner
33
+ start_original
34
34
  Kernel.loop do
35
35
  if @files.find { |file| FileTest.exist?(file) && File.stat(file).mtime > @time }
36
36
  puts 'reloading sketch...'
@@ -54,10 +54,8 @@ module Processing
54
54
  warn format(wformat, File.basename(SKETCH_PATH))
55
55
  puts format(tformat, e.backtrace.join("\n\t"))
56
56
  end
57
-
58
- def start_runner
59
- @runner.kill if @runner && @runner.alive?
60
- @runner = nil
57
+
58
+ def start_original
61
59
  @runner = Thread.start do
62
60
  report_errors do
63
61
  Processing.load_and_run_sketch
@@ -65,6 +63,13 @@ module Processing
65
63
  end
66
64
  end
67
65
 
66
+ def start_runner
67
+ @runner.kill if @runner && @runner.alive?
68
+ @runner.join
69
+ @runner = nil
70
+ start_original
71
+ end
72
+
68
73
  def reload_files_to_watch
69
74
  @files = Dir.glob(File.join(SKETCH_ROOT, '**/*.{rb,glsl}'))
70
75
  count = @files.length
@@ -1,6 +1,5 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
  # A wrapper for version
4
3
  module JRubyArt
5
- VERSION = '1.2.1'.freeze
4
+ VERSION = '1.2.2'.freeze
6
5
  end
data/lib/rpextras.jar CHANGED
Binary file
data/vendors/Rakefile CHANGED
@@ -8,8 +8,8 @@ WARNING = <<-EOS
8
8
 
9
9
  EOS
10
10
 
11
- JRUBYC_VERSION = '9.1.2.0'
12
- EXAMPLES = '1.3'
11
+ JRUBYC_VERSION = '9.1.3.0'
12
+ EXAMPLES = '1.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_sha256("jruby-complete-#{JRUBYC_VERSION}.jar", "b9a6838ff7bbb0b3eda4eeba26017329572bc2fa014008a069b3848482275283")
30
+ check_sha256("jruby-complete-#{JRUBYC_VERSION}.jar", "99cae715f87b9829b44a5a7295f200fc7295114f0887b160a3cf613bf93544a0")
31
31
  end
32
32
 
33
33
  directory "../lib/ruby"
@@ -71,7 +71,7 @@ end
71
71
  desc "copy examples"
72
72
  task :copy_examples => file_name do
73
73
  if MAC_OR_LINUX.nil?
74
- sh "unzip #{EXAMPLES},zip"
74
+ sh "unzip #{EXAMPLES}.zip"
75
75
  else
76
76
  sh "tar xzvf #{EXAMPLES}.tar.gz"
77
77
  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: 1.2.1
4
+ version: 1.2.2
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-07-19 00:00:00.000000000 Z
13
+ date: 2016-08-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -62,7 +62,6 @@ files:
62
62
  - lib/jruby_art/helper_methods.rb
63
63
  - lib/jruby_art/helpers/aabb.rb
64
64
  - lib/jruby_art/helpers/numeric.rb
65
- - lib/jruby_art/helpers/string_extra.rb
66
65
  - lib/jruby_art/installer.rb
67
66
  - lib/jruby_art/java_opts.rb
68
67
  - lib/jruby_art/library_loader.rb
@@ -71,7 +70,6 @@ files:
71
70
  - lib/jruby_art/runners/live.rb
72
71
  - lib/jruby_art/runners/run.rb
73
72
  - lib/jruby_art/runners/watch.rb
74
- - lib/jruby_art/sketchbook.rb
75
73
  - lib/jruby_art/version.rb
76
74
  - lib/rpextras.jar
77
75
  - library/boids/boids.rb
@@ -82,7 +80,7 @@ files:
82
80
  - library/slider/slider.rb
83
81
  - library/video_event/video_event.rb
84
82
  - vendors/Rakefile
85
- homepage: http://ruby-processing.github.io/JRubyArt/
83
+ homepage: https://ruby-processing.github.io/JRubyArt/
86
84
  licenses:
87
85
  - MIT
88
86
  metadata: {}
@@ -95,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
93
  requirements:
96
94
  - - ">="
97
95
  - !ruby/object:Gem::Version
98
- version: '2.2'
96
+ version: '2.3'
99
97
  required_rubygems_version: !ruby/object:Gem::Requirement
100
98
  requirements:
101
99
  - - ">="
@@ -103,8 +101,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
101
  version: '0'
104
102
  requirements:
105
103
  - A decent graphics card
106
- - java runtime >= 1.8.0_92+
107
- - processing = 3.1.0+
104
+ - java runtime >= 1.8.0_102+
105
+ - processing = 3.2.1+
108
106
  rubyforge_project:
109
107
  rubygems_version: 2.6.3
110
108
  signing_key:
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: false
2
- require 'forwardable'
3
- # reverting to StringExtra class, from a module with String refinements
4
- class StringExtra
5
- extend Forwardable
6
- def_delegators(:@str, :upcase, :capitalize, :length, :downcase, :gsub)
7
- def initialize(str)
8
- @str = str
9
- end
10
-
11
- def titleize
12
- underscore
13
- .gsub(/_id$/, '').tr('_', ' ').capitalize
14
- .gsub(/\b([a-z])/) { Regexp.last_match[1].capitalize }
15
- end
16
-
17
- def humanize
18
- gsub(/_id$/, '').tr('_', ' ').capitalize
19
- end
20
-
21
- def camelize
22
- gsub(%r{/\/(.?)/}) { '::' + Regexp.last_match[1].upcase }
23
- .gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
24
- end
25
-
26
- def underscore
27
- gsub(/::/, '/')
28
- .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
29
- .gsub(/([a-z\d])([A-Z])/, '\1_\2')
30
- .tr('-', '_')
31
- .downcase
32
- end
33
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: false
2
- # Utility to find sketchbook and hence java libraries
3
- module Sketchbook
4
- def self.find_path
5
- preferences_paths = []
6
- sketchbook_paths = []
7
- sketchbook_path = Processing::RP_CONFIG.fetch('sketchbook_path', false)
8
- return sketchbook_path if sketchbook_path
9
- [
10
- "'Application Data/Processing'", 'AppData/Roaming/Processing',
11
- 'Library/Processing', 'Documents/Processing',
12
- '.processing', 'sketchbook'
13
- ].each do |prefix|
14
- spath = format('%s/%s', ENV['HOME'], prefix)
15
- pref_path = format('%s/preferences.txt', spath)
16
- preferences_paths << pref_path if FileTest.file?(pref_path)
17
- sketchbook_paths << spath if FileTest.directory?(spath)
18
- end
19
- return sketchbook_paths.first if preferences_paths.empty?
20
- lines = IO.readlines(preferences_paths.first)
21
- matchedline = lines.grep(/^sketchbook/).first
22
- matchedline[/=(.+)/].delete('=')
23
- end
24
- end