Sha256: 1486585b667290e2403acd7f1d7ac1d975cd4ac920c091360b6db2a121b287c9

Contents?: true

Size: 656 Bytes

Versions: 21

Compression:

Stored size: 656 Bytes

Contents

require 'shellwords'

module Opal
  module CliRunners
    class Phantomjs
      def initialize(output = $stdout)
        @output = output
      end
      attr_reader :output, :exit_status

      def run(code, argv)
        unless argv.empty?
          raise ArgumentError, 'Program arguments are not supported on the PhantomJS runner'
        end

        phantomjs = IO.popen(command, 'w', out: output) do |io|
          io.write(code)
        end
        @exit_status = $?.exitstatus
      end

      def command
        script_path = File.expand_path('../phantom.js', __FILE__)
        "phantomjs #{script_path.shellescape}"
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
opal-0.9.4 lib/opal/cli_runners/phantomjs.rb
opal-0.9.3 lib/opal/cli_runners/phantomjs.rb
opal-0.9.2 lib/opal/cli_runners/phantomjs.rb
opal-0.9.0 lib/opal/cli_runners/phantomjs.rb
opal-0.9.0.rc1 lib/opal/cli_runners/phantomjs.rb
opal-0.9.0.beta2 lib/opal/cli_runners/phantomjs.rb
opal-0.9.0.beta1 lib/opal/cli_runners/phantomjs.rb
opal-0.8.1 lib/opal/cli_runners/phantomjs.rb
opal-0.8.1.rc1 lib/opal/cli_runners/phantomjs.rb
opal-wedge-0.9.0.dev lib/opal/cli_runners/phantomjs.rb
opal-0.8.0 lib/opal/cli_runners/phantomjs.rb
opal-0.8.0.rc3 lib/opal/cli_runners/phantomjs.rb
opal-0.8.0.rc2 lib/opal/cli_runners/phantomjs.rb
opal-0.8.0.rc1 lib/opal/cli_runners/phantomjs.rb
opal-0.8.0.beta1 lib/opal/cli_runners/phantomjs.rb
opal-0.7.2 lib/opal/cli_runners/phantomjs.rb
opal-0.7.1 lib/opal/cli_runners/phantomjs.rb
opal-0.7.0 lib/opal/cli_runners/phantomjs.rb
opal-0.7.0.rc1 lib/opal/cli_runners/phantomjs.rb
opal-0.7.0.beta3 lib/opal/cli_runners/phantomjs.rb