DanGough / Nevergreen

This module is an alternative to Evergreen, and allows you to find the latest version and download URL for various Windows apps. Evergreen uses API queries to obtain its data whereas this module is more focussed on web scraping. This is more prone to breaking when websites are changed, hence the name.
The Unlicense
77 stars 18 forks source link

[New App Request] Apache JMeter (On Proposals list) #85

Open AScott-WWF opened 4 months ago

AScott-WWF commented 4 months ago

Script:

# Get-ApacheJMeter.ps1

# Define AppName
$AppName = "Apache JMeter"

$ReleaseUrl = "https://jmeter.apache.org/download_jmeter.cgi"
$InstallInstructionsUrl = "https://jmeter.apache.org/usermanual/get-started.html"

Write-Verbose "Obtaining $($AppName) Release Versions from $($ReleaseUrl)...`n"

# Main script to fetch and process links
$AppVersions = @(
        @{AppName = $($AppName); Type = 'zip'; Pattern = '[^_]\.zip$'}
)

foreach ($AppVersion in $AppVersions) {
    $SearchCount = 1 # This may need increasing as future versions are released

    $URL = Get-Link -Uri $ReleaseUrl -MatchProperty href -Pattern $AppVersion.Pattern
    [version]$Version = Get-Version -String $URL

    #Build each link with File Type specific versions
    $ReleaseNotesUrl = "https://jmeter.apache.org/changes_history.html"
    Write-Verbose "$($AppName) (Version: $($Version)) Release notes are available here: $($ReleaseNotesUrl)"

    do {
        if ($URL) {
            New-NevergreenApp -Name $($AppVersion.AppName) -Version $($Version) -Uri $($URL) -Architecture 'multi' -Type $($AppVersion.Type)
            break
        }

        $SearchCount--
    } until ($SearchCount -eq 0)

    if ($SearchCount -eq 0) {
        Write-Warning "Could not find release for $($AppName) $($AppVersion.Type)"
    }
}

Write-Verbose "$($AppName) Install instructions are available here: $($InstallInstructionsUrl)"