Sha256: 0a3ad3cda6c2a30bd5c768ead542d037cd14e0fdb18a19e101e548b0c49754d8

Contents?: true

Size: 915 Bytes

Versions: 4

Compression:

Stored size: 915 Bytes

Contents

# frozen_string_literal: true
module ProxyPacRb
  module Cli
    # Find proxy for url
    class LintProxyPac < Thor::Group
      include Shared

      class_option :proxy_pac, type: :array, desc: 'Proxy.pac-file(s)', aliases: '-p', required: true

      def pre_init
        enable_debug_mode
      end

      def set_variables
        @proxy_pacs = options[:proxy_pac].map { |p| ProxyPacFile.new source: p }
        @loader     = ProxyPacLoader.new
        @linter     = ProxyPacLinter.new
      end

      def test_proxy_pac
        @proxy_pacs.each do |p|
          @loader.load(p)
          @linter.lint(p)

          if p.valid?
            $stderr.puts %(proxy.pac "#{p.source}" is of type #{p.type} and is valid.)
            true
          else
            $stderr.puts %(proxy.pac "#{p.source}" is of type #{p.type} and is invalid.)

            false
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
proxy_pac_rb-3.0.0 lib/proxy_pac_rb/cli/lint_proxy_pac.rb
proxy_pac_rb-2.1.0 lib/proxy_pac_rb/cli/lint_proxy_pac.rb
proxy_pac_rb-2.0.0 lib/proxy_pac_rb/cli/lint_proxy_pac.rb
proxy_pac_rb-1.0.0 lib/proxy_pac_rb/cli/lint_proxy_pac.rb