Skip to content

Commit

Permalink
tiny changes
Browse files Browse the repository at this point in the history
  • Loading branch information
monkstone committed Jul 1, 2016
1 parent df85d2b commit 68b537b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/jruby_art/creators/creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 10 additions & 10 deletions lib/jruby_art/java_opts.rb
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions lib/jruby_art/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,20 @@ 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',
runner,
sketch,
args].flatten
else
opts = JRubyOpts.new(SKETCH_ROOT).opts
command = ['jruby',
opts.jruby,
opts,
runner,
sketch,
args].flatten
Expand Down
2 changes: 1 addition & 1 deletion lib/jruby_art/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# frozen_string_literal: true
# A wrapper for version
module JRubyArt
VERSION = '1.1.2'
VERSION = '1.1.3'
end
2 changes: 1 addition & 1 deletion pom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
<modelVersion>4.0.0</modelVersion>
<groupId>ruby-processing</groupId>
<artifactId>rp5extras</artifactId>
<version>1.1.2</version>
<version>1.1.3</version>
<name>rp5extras</name>
<description>rp5extras for JRubyArt</description>
<url>https://github.com/ruby-processing/JRubyArt</url>
Expand Down

0 comments on commit 68b537b

Please sign in to comment.