Sha256: 5475c44139ef3785e1440f39a87ed6db5d116aa46f082cd0f1efe6b4f97a9fba

Contents?: true

Size: 732 Bytes

Versions: 5

Compression:

Stored size: 732 Bytes

Contents

module Entree
  class Runner
    RUNNER_PATH = File.expand_path("../../../vendor/HTML_CodeSniffer/Contrib/PhantomJS/HTMLCS_Run.js", __FILE__)
    attr_reader :output

    def initialize(target)
      @target = target
    end

    def run
      @output = `phantomjs #{RUNNER_PATH} #{@target} WCAG2AA json`
      return if audit_success?

      if !phantomjs_installed?
        fail Entree::RunnerError.new("Please install PhantomJS. Visit http://phantomjs.org/ for instructions.")
      else
        fail Entree::RunnerError.new("PhantomJS exited without success: #{@output}")
      end
    end

    private

    def audit_success?
      $?.success?
    end

    def phantomjs_installed?
      $?.exitstatus != 127
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
entree-0.0.5 lib/entree/runner.rb
entree-0.0.4 lib/entree/runner.rb
entree-0.0.3 lib/entree/runner.rb
entree-0.0.2 lib/entree/runner.rb
entree-0.0.1 lib/entree/runner.rb