Skip to content

Commit e6d91de

Browse files
committed
More specific checks and warnings for processing core
1 parent 722e4b4 commit e6d91de

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

lib/jruby_art/core.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
# module encapsulates a check that the PROCESSING_ROOT exists
3+
module Core
4+
def self.check?(path)
5+
if File.directory?(path)
6+
core_path = File.join(path, 'core/library/core.jar')
7+
return true if File.exist?(core_path)
8+
warn format('%s jar does not exist', core_path)
9+
else warn format('%s directory does not exist', path)
10+
end
11+
end
12+
end
13+
14+
# Provided processing distributions have the same nested structure ie:-
15+
# "core/library/core.jar" we can find "core.jar" when PROCESSING_ROOT exists

lib/jruby_art/installer.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ def set_processing_root
3131
end
3232

3333
def root_exist?
34-
return false if config.empty?
35-
File.exist? config['PROCESSING_ROOT']
34+
Core.check?(config['PROCESSING_ROOT'])
3635
end
3736

3837
def config
@@ -55,12 +54,13 @@ def show_version
5554

5655
# Configuration checker
5756
class Check < Installer
57+
require_relative 'core'
5858
def install
5959
show_version
6060
return super unless config
6161
installed = File.exist? File.join(gem_root, 'lib/ruby/jruby-complete.jar')
62-
proot = ' PROCESSING_ROOT = Not Set!!!' unless root_exist?
63-
proot ||= " PROCESSING_ROOT = #{config['PROCESSING_ROOT']}"
62+
proot = ' PROCESSING_ROOT = Not Set Correctly!!!' unless root_exist?
63+
proot ||= " PROCESSING_ROOT = #{config['PROCESSING_ROOT']}"
6464
sketchbook = " sketchbook_path = #{config['sketchbook_path']}"
6565
template = " template = #{config['template']}"
6666
java_args = " java_args = #{config['java_args']}"

0 commit comments

Comments
 (0)