From 68b537b816620c91aa9fd2aad4ba73243acec077 Mon Sep 17 00:00:00 2001 From: monkstone Date: Fri, 1 Jul 2016 07:21:15 +0100 Subject: [PATCH] tiny changes --- CHANGELOG.md | 2 ++ lib/jruby_art/creators/creator.rb | 6 +++--- lib/jruby_art/java_opts.rb | 20 ++++++++++---------- lib/jruby_art/runner.rb | 7 ++++--- lib/jruby_art/version.rb | 2 +- pom.rb | 2 +- pom.xml | 2 +- 7 files changed, 22 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1270cd6..60eb729a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ +**v1.1.3** Revert using String refinements in `creator.rb`. Refactor java options to `java_opts.rb`. + **v1.1.2** Refactor `runner.rb` to `runner.rb`, `args.rb` and `installer.rb`. The `Installer` classes have the role of installing `jruby-complete`, the examples and providing `setup check` functionality. Refactored and improved default `config.yml` tool, all should make it easier for `collaborators/successors` to follow the code. Refactored `Vec2D` and `Vec3D` `==` and `eql?` methods. New `chooser` library makes it possible to use `select_input` reflection method. **v1.1.1** Even more `data_path` fixes in examples, update to jruby-complete-9.1.2.0 diff --git a/lib/jruby_art/creators/creator.rb b/lib/jruby_art/creators/creator.rb index 95a51891..0f08aeab 100644 --- a/lib/jruby_art/creators/creator.rb +++ b/lib/jruby_art/creators/creator.rb @@ -199,9 +199,9 @@ def create!(path, args) @title = StringExtra.new(main_file).titleize @width = args[0] @height = args[1] - @mode = args[2].upcase unless args[2].nil? - template = @mode.nil? ? basic_template : basic_template_mode - writer.save(template) + return writer.save(basic_template) if args[2].nil? + @mode = args[2].upcase + writer.save(basic_template_mode) end end diff --git a/lib/jruby_art/java_opts.rb b/lib/jruby_art/java_opts.rb index 7c66dd72..88b30cf7 100644 --- a/lib/jruby_art/java_opts.rb +++ b/lib/jruby_art/java_opts.rb @@ -1,21 +1,21 @@ # frozen_string_literal: false # class to parse java_args.txt or java_args in config.yml class JavaOpts - attr_reader :jvm_opts + attr_reader :opts def initialize(sketch_root) arg_file = File.join(sketch_root, 'data/java_args.txt') - @jvm_opts = [] - if FileTest.exist?(arg_file) - @jvm_opts += File.read(arg_file).split(/\s+/) - elsif Processing::RP_CONFIG['java_args'] - @jvm_opts += Processing::RP_CONFIG['java_args'].split(/\s+/) + @opts = [] + @opts += File.read(arg_file).split(/\s+/) if FileTest.exist?(arg_file) + if opts.empty? && Processing::RP_CONFIG.fetch('java_args', false) + @opts += Processing::RP_CONFIG['java_args'].split(/\s+/) end end +end - # wrap java args for jruby - def jruby - return [] if jvm_opts.length == 0 - jvm_opts.map { |arg| "-J#{arg}" } +# wrap args to pass through to jvm from jruby +class JRubyOpts < JavaOpts + def opts + super.map { |arg| "-J#{arg}" } end end diff --git a/lib/jruby_art/runner.rb b/lib/jruby_art/runner.rb index 99c7748b..787d9847 100644 --- a/lib/jruby_art/runner.rb +++ b/lib/jruby_art/runner.rb @@ -146,10 +146,10 @@ def show_version def spin_up(starter_script, sketch, args) runner = "#{K9_ROOT}/lib/jruby_art/runners/#{starter_script}" @options.nojruby = true if Processing::RP_CONFIG['JRUBY'] == 'false' - opts = JavaOpts.new(SKETCH_ROOT) if @options.nojruby + opts = JavaOpts.new(SKETCH_ROOT).opts command = ['java', - opts.jvm_opts, + opts, '-cp', jruby_complete, 'org.jruby.Main', @@ -157,8 +157,9 @@ def spin_up(starter_script, sketch, args) sketch, args].flatten else + opts = JRubyOpts.new(SKETCH_ROOT).opts command = ['jruby', - opts.jruby, + opts, runner, sketch, args].flatten diff --git a/lib/jruby_art/version.rb b/lib/jruby_art/version.rb index 414771d2..18ab07f3 100644 --- a/lib/jruby_art/version.rb +++ b/lib/jruby_art/version.rb @@ -2,5 +2,5 @@ # frozen_string_literal: true # A wrapper for version module JRubyArt - VERSION = '1.1.2' + VERSION = '1.1.3' end diff --git a/pom.rb b/pom.rb index ce842b43..a59f32f8 100644 --- a/pom.rb +++ b/pom.rb @@ -5,7 +5,7 @@ project 'rp5extras', 'https://github.com/ruby-processing/JRubyArt' do model_version '4.0.0' - id 'ruby-processing:rp5extras', '1.1.2' + id 'ruby-processing:rp5extras', '1.1.3' packaging 'jar' description 'rp5extras for JRubyArt' diff --git a/pom.xml b/pom.xml index 2cd61cc2..e22efc92 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE 4.0.0 ruby-processing rp5extras - 1.1.2 + 1.1.3 rp5extras rp5extras for JRubyArt https://github.com/ruby-processing/JRubyArt