Sha256: 6f952dd1192766c33a22f8840a521faf94d4d10789f3044b26e3dcaf46b8517d

Contents?: true

Size: 681 Bytes

Versions: 33

Compression:

Stored size: 681 Bytes

Contents

# frozen_string_literal: true

require 'opal/paths'
require 'opal/cli_runners/system_runner'

module Opal
  module CliRunners
    class Nashorn
      def self.call(data)
        # Allow to change path if using GraalVM, see:
        # https://github.com/graalvm/graaljs/blob/master/docs/user/NashornMigrationGuide.md#launcher-name-js
        exe = ENV['NASHORN_PATH'] || 'jjs'

        SystemRunner.call(data) do |tempfile|
          [exe, tempfile.path, *data[:argv]]
        end
      rescue Errno::ENOENT
        raise MissingNashorn, 'Please install JDK or GraalVM to be able to run Opal scripts.'
      end

      class MissingNashorn < RunnerError
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
opal-1.8.3.rc1 lib/opal/cli_runners/nashorn.rb
opal-1.8.2 lib/opal/cli_runners/nashorn.rb
opal-1.8.1 lib/opal/cli_runners/nashorn.rb
opal-1.8.0 lib/opal/cli_runners/nashorn.rb
opal-1.8.0.beta1 lib/opal/cli_runners/nashorn.rb
opal-1.7.4 lib/opal/cli_runners/nashorn.rb
opal-1.8.0.alpha1 lib/opal/cli_runners/nashorn.rb
opal-1.7.3 lib/opal/cli_runners/nashorn.rb
opal-1.7.2 lib/opal/cli_runners/nashorn.rb
opal-1.7.1 lib/opal/cli_runners/nashorn.rb
opal-1.7.0 lib/opal/cli_runners/nashorn.rb
opal-1.7.0.rc1 lib/opal/cli_runners/nashorn.rb
opal-1.6.1 lib/opal/cli_runners/nashorn.rb
opal-1.6.0 lib/opal/cli_runners/nashorn.rb
opal-1.6.0.rc1 lib/opal/cli_runners/nashorn.rb
opal-1.6.0.alpha1 lib/opal/cli_runners/nashorn.rb
opal-1.5.1 lib/opal/cli_runners/nashorn.rb
opal-1.5.0 lib/opal/cli_runners/nashorn.rb
opal-1.5.0.rc1 lib/opal/cli_runners/nashorn.rb
opal-1.4.1 lib/opal/cli_runners/nashorn.rb