Sha256: 0b9acf14571777f38b56109b3644133f1d095181e9021a21e8e7d774328a6d29

Contents?: true

Size: 650 Bytes

Versions: 11

Compression:

Stored size: 650 Bytes

Contents

# frozen_string_literal: true

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

module Opal
  module CliRunners
    # Gjs is GNOME's JavaScript runtime based on Mozilla SpiderMonkey
    class Gjs
      def self.call(data)
        exe = ENV['GJS_PATH'] || 'gjs'

        opts = Shellwords.shellwords(ENV['GJS_OPTS'] || '')

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

      class MissingGjs < RunnerError
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
opal-1.5.1 lib/opal/cli_runners/gjs.rb
opal-1.5.0 lib/opal/cli_runners/gjs.rb
opal-1.5.0.rc1 lib/opal/cli_runners/gjs.rb
opal-1.4.1 lib/opal/cli_runners/gjs.rb
opal-1.4.0 lib/opal/cli_runners/gjs.rb
opal-1.4.0.alpha1 lib/opal/cli_runners/gjs.rb
opal-1.3.2 lib/opal/cli_runners/gjs.rb
opal-1.3.1 lib/opal/cli_runners/gjs.rb
opal-1.3.0 lib/opal/cli_runners/gjs.rb
opal-1.3.0.rc1 lib/opal/cli_runners/gjs.rb
opal-1.3.0.alpha1 lib/opal/cli_runners/gjs.rb