Sha256: b63ba5a1e1b4278213ace79590acbd50ef63506fc657bc2394d8f3f899ed16c8

Contents?: true

Size: 597 Bytes

Versions: 15

Compression:

Stored size: 597 Bytes

Contents

require 'shellwords'

module Opal
  module CliRunners
    class Phantomjs
      SCRIPT_PATH = File.expand_path('../phantom.js', __FILE__)

      def initialize(options)
        @output = options.fetch(:output, $stdout)
      end
      attr_reader :output, :exit_status

      def run(code, argv)
        command = [
          'phantomjs',
          SCRIPT_PATH.shellescape,
          *argv.map(&:shellescape)
        ].join(' ')

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

        @exit_status = $?.exitstatus
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
opal-0.10.6 lib/opal/cli_runners/phantomjs.rb
opal-0.10.6.beta lib/opal/cli_runners/phantomjs.rb
opal-0.10.5 lib/opal/cli_runners/phantomjs.rb
opal-0.10.4 lib/opal/cli_runners/phantomjs.rb
opal-0.10.3 lib/opal/cli_runners/phantomjs.rb
opal-0.10.2 lib/opal/cli_runners/phantomjs.rb
opal-0.10.1 lib/opal/cli_runners/phantomjs.rb
opal-0.10.0 lib/opal/cli_runners/phantomjs.rb
opal-0.10.0.rc2 lib/opal/cli_runners/phantomjs.rb
opal-0.10.0.rc1 lib/opal/cli_runners/phantomjs.rb
opal-0.10.0.beta5 lib/opal/cli_runners/phantomjs.rb
opal-0.10.0.beta4 lib/opal/cli_runners/phantomjs.rb
opal-0.10.0.beta3 lib/opal/cli_runners/phantomjs.rb
opal-0.10.0.beta2 lib/opal/cli_runners/phantomjs.rb
opal-0.10.0.beta1 lib/opal/cli_runners/phantomjs.rb