lib/shoes/swt/generate_backend.rb in shoes-swt-4.0.0.pre7 vs lib/shoes/swt/generate_backend.rb in shoes-swt-4.0.0.pre8
- old
+ new
@@ -1,7 +1,38 @@
+# frozen_string_literal: true
+
require 'rbconfig'
-def generate_backend(path)
- options = "-J-XstartOnFirstThread" if RbConfig::CONFIG["host_os"] =~ /darwin/
+class Shoes
+ module SelectedBackend
+ class << self
+ def validate
+ if RUBY_ENGINE != "jruby"
+ puts <<-EOS
- "jruby #{options} #{path}/shoes-swt"
+*******************************************************************************
+The shoes-swt backend requires a 9.X version of JRuby.
+
+You are running the following Ruby instead:
+
+ #{RUBY_DESCRIPTION}
+
+Please download JRuby from http://jruby.org (or your favorite Ruby version
+manager), then check our https://github.com/shoes/shoes4#installing-shoes-4 to
+get Shoes installed.
+
+Sorry for the inconvenience!
+*******************************************************************************
+
+EOS
+ exit 1
+ end
+ end
+
+ def generate(path)
+ options = "-J-XstartOnFirstThread" if RbConfig::CONFIG["host_os"] =~ /darwin/
+
+ "jruby #{options} #{path}/shoes-swt"
+ end
+ end
+ end
end