Sha256: f329c7b85fbba394a3828a613a055cbbec5b8b1bfa89374b76f6b70d112990b7

Contents?: true

Size: 711 Bytes

Versions: 4

Compression:

Stored size: 711 Bytes

Contents

module AccessLint
  class Runner
    RUNNER_PATH = File.expand_path("../../../vendor/access-lint/bin/auditor.js", __FILE__)
    attr_reader :output

    def initialize(target)
      @target = target
    end

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

      if !phantomjs_installed?
        raise AccessLint::RunnerError.new("Please install PhantomJS. Visit http://phantomjs.org/ for instructions.")
      else
        raise AccessLint::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

4 entries across 4 versions & 1 rubygems

Version Path
access_lint-0.1.3 lib/access_lint/runner.rb
access_lint-0.1.2 lib/access_lint/runner.rb
access_lint-0.1.1 lib/access_lint/runner.rb
access_lint-0.1.0 lib/access_lint/runner.rb