Sha256: 4e18fe9daec86344d5a4816e6ead2f46869d2c3737a9908cb14b1bce87768c82

Contents?: true

Size: 684 Bytes

Versions: 11

Compression:

Stored size: 684 Bytes

Contents

#!/usr/bin/env ruby

<% Array(lookup('gem_path')).each do |p| -%>
$LOAD_PATH.unshift '<%= p %>'
<% end -%>

require 'git_hook-pre_receive'
require 'pac'

class PacFileSyntaxChecker
  def check(files)
    files.each do |f|
      begin
        pac = PAC.source f.content
        pac.find('http://www.example.com')
      rescue => e
        $stderr.puts "Maybe I found a syntax error in file \"#{f.name}\". Please check files locally again, e.g with a pac file tester, fix the error and send update via git. The original error was: #{e.message}"
        exit 1
      end
    end
  end
end

parser = Git::PreReceiveHookParser.new($stdin.read)
PacFileSyntaxChecker.new.check(parser.files)

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
local_pac-0.1.13 files/git-hook.erb
local_pac-0.1.11 files/git-hook.erb
local_pac-0.1.10 files/git-hook.erb
local_pac-0.1.9 files/git-hook.erb
local_pac-0.1.8 files/git-hook.erb
local_pac-0.1.7 files/git-hook.erb
local_pac-0.1.6 files/git-hook.erb
local_pac-0.1.5 files/git-hook.erb
local_pac-0.1.4 files/git-hook.erb
local_pac-0.1.3 files/git-hook.erb
local_pac-0.1.2 files/git-hook.erb