diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6758248731719d1a35c8ce2002230fe3115dc0df..3adeea046890b67033cf469da798394c587b8c75 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,7 +54,7 @@ jruby_1.7: - master script: - ruby -v - - JRUBY_OPTS="-J-Djruby.launch.inproc=true" ruby scheck.rb + - ruby scheck.rb --jruby jruby_9.1: image: jruby:9.1 @@ -65,7 +65,7 @@ jruby_9.1: - master script: - ruby -v - - JRUBY_OPTS="-J-Djruby.launch.inproc=true" ruby scheck.rb + - ruby scheck.rb --jruby rubocop: stage: linting diff --git a/scheck.rb b/scheck.rb index 09a45c3140e80f69db32d89167897891385c3fce..17f3696eb7a301dc3e0f5bbdf6adaca97ca9daf1 100644 --- a/scheck.rb +++ b/scheck.rb @@ -1,8 +1,23 @@ #!/usr/bin/env ruby -ret = 0 +jruby = ARGV.length == 1 +ret = 0 + +require 'jruby' if jruby + Dir["**/*.rb"].each do |f| - res = `ruby -c #{f}` + res = String.new + if jruby + begin + JRuby.parse(File.read(f)) + res = 'Syntax OK' + rescue SyntaxError => e + puts e.to_s + end + else + res = `ruby -c #{f}` + end + if res.empty? ret = 1 puts "#{f} FAILED!"