<commit_before>﻿Import-Module AU
Import-Module "$PSScriptRoot\..\..\scripts\au_extensions.psm1"

$domain   = 'https://slproweb.com'
$releases = "$domain/products/Win32OpenSSL.html"

function global:au_BeforeUpdate { Get-RemoteFiles -Purge -NoSuffix }

function global:au_AfterUpdate { Set-DescriptionFromReadme -SkipFirst 1 }

function global:au_SearchReplace {
  @{
    ".\legal\VERIFICATION.txt" = @{
      "(?i)(^\s*location on\:?\s*)\<.*\>" = "`${1}<$releases>"
      "(?i)(\s*32\-Bit Software.*)\<.*\>" = "`${1}<$($Latest.URL32)>"
      "(?i)(\s*64\-Bit Software.*)\<.*\>" = "`${1}<$($Latest.URL64)>"
      "(?i)(^\s*checksum\s*type\:).*"     = "`${1} $($Latest.ChecksumType32)"
      "(?i)(^\s*checksum(32)?\:).*"       = "`${1} $($Latest.Checksum32)"
      "(?i)(^\s*checksum64\:).*"          = "`${1} $($Latest.Checksum64)"
    }
    ".\tools\chocolateyInstall.ps1" = @{
      "(?i)(^\s*file\s*=\s*`"[$]toolsPath\\).*`""   = "`${1}$($Latest.FileName32)`""
      "(?i)(^\s*file64\s*=\s*`"[$]toolsPath\\).*`"" = "`${1}$($Latest.FileName64)`""
    }
  }
}
function global:au_GetLatest {
  $download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing

  $re = 'Win32.*Light.*\.exe$'
  $url32 = $domain + ($download_page.Links | ? href -match $re | select -first 1 -expand href)

  $re = 'Win64.*Light.*\.exe$'
  $url64 = $domain + ($download_page.links | ? href -match $re | select -first 1 -expand href)

  $verRe = '[\-]|\.exe'
  $version32 = $url32 -split "$verRe" | select -last 1 -skip 1
  $version64 = $url64 -split "$verRe" | select -last 1 -skip 1
  if ($version32 -ne $version64) {
    throw "32bit version do not match the 64bit version"
  }

  if (Test-Path "$PSScriptRoot\LastVersion.txt") {
    $lastVersion = Get-Content "$PSScriptRoot\LastVersion.txt"
    if ($lastVersion -ne $version32) { $global:au_Force = $true }
    }
    Set-Content "$PSScriptRoot\LastVersion.txt" -Value $version32

  @{
    URL32 = $url32
    URL64 = $url64
    Version = $version32 -replace '_','.' -split '[a-z]' | select -first 1
  }
}

update -ChecksumFor none<commit_msg>(OpenSSL.Light) Changed to pad the revision, instead of date hack<commit_after>﻿Import-Module AU
Import-Module "$PSScriptRoot\..\..\scripts\au_extensions.psm1"

$domain   = 'https://slproweb.com'
$releases = "$domain/products/Win32OpenSSL.html"

$padUnderVersion = '1.1.1'

function global:au_BeforeUpdate { Get-RemoteFiles -Purge -NoSuffix }

function global:au_AfterUpdate { Set-DescriptionFromReadme -SkipFirst 1 }

function global:au_SearchReplace {
  @{
    ".\legal\VERIFICATION.txt" = @{
      "(?i)(^\s*location on\:?\s*)\<.*\>" = "`${1}<$releases>"
      "(?i)(\s*32\-Bit Software.*)\<.*\>" = "`${1}<$($Latest.URL32)>"
      "(?i)(\s*64\-Bit Software.*)\<.*\>" = "`${1}<$($Latest.URL64)>"
      "(?i)(^\s*checksum\s*type\:).*"     = "`${1} $($Latest.ChecksumType32)"
      "(?i)(^\s*checksum(32)?\:).*"       = "`${1} $($Latest.Checksum32)"
      "(?i)(^\s*checksum64\:).*"          = "`${1} $($Latest.Checksum64)"
    }
    ".\tools\chocolateyInstall.ps1" = @{
      "(?i)(^\s*file\s*=\s*`"[$]toolsPath\\).*`""   = "`${1}$($Latest.FileName32)`""
      "(?i)(^\s*file64\s*=\s*`"[$]toolsPath\\).*`"" = "`${1}$($Latest.FileName64)`""
    }
  }
}
function global:au_GetLatest {
  $download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing

  $re = 'Win32.*Light.*\.exe$'
  $url32 = $domain + ($download_page.Links | ? href -match $re | select -first 1 -expand href)

  $re = 'Win64.*Light.*\.exe$'
  $url64 = $domain + ($download_page.links | ? href -match $re | select -first 1 -expand href)

  $verRe = '[\-]|\.exe'
  $version32 = ($url32 -split "$verRe" | select -last 1 -skip 1) -replace '_','.'
  $version64 = ($url64 -split "$verRe" | select -last 1 -skip 1) -replace '_','.'
  if ($version32 -ne $version64) {
    throw "32bit version do not match the 64bit version"
  }
  $rev = ([byte][char]$version32[$version32.Length - 1]) - 97
  $version32 = $version32 -replace '[a-z]+$',".$rev"

  if ([version]$version32 -lt [version]'1.1.1') {
    # Because previous package updates used dates, we need a number that ends up being larger
    $revisionLen = '8' # Will end up with version '1.1.0.40000000'
  } else {
    $revisionLen = '4'
  }

  @{
    URL32 = $url32
    URL64 = $url64
    Version = Get-PaddedVersion $version32 -OnlyBelowVersion $padUnderVersion -RevisionLength $revisionLen
  }
}

update -ChecksumFor none
{'fraction_non_alphanumeric': 0.23369565217391305, 'fraction_numerical': 0.043251811594202896, 'mean_word_length': 3.3261508325171403, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4991732', 'n_tokens_mistral': 1855, 'n_tokens_neox': 1676, 'n_words': 315}