Sha256: 31e53d06f01862557a07e772e2935352b061b5a33fab7e75f8438452e936f643
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
import { execSync } from 'child_process' import { cmp, maxSatisfying } from 'semver' import { asyncExec } from './utils' interface CheckResult { shouldUpdate: boolean localVersion: string remoteVersion: string } export async function checkVersions(): Promise<CheckResult> { const { stdout: localStdout } = await asyncExec("gem list --local --exact yoda-language-server") const localVersion = extractVersion(localStdout) const { stdout: remoteStdout } = await asyncExec("gem list --remote --no-prerelease --exact yoda-language-server") const remoteVersion = extractVersion(remoteStdout) return { shouldUpdate: shouldUpdate(localVersion, remoteVersion), localVersion: localVersion, remoteVersion: remoteVersion, } } function shouldUpdate(localVersion: string, remoteVersion: string): boolean { if (!localVersion) { return true } if (!remoteVersion) { return false } return cmp(localVersion, "<", remoteVersion) } function extractVersion(text: string): string { const lines = text.split("\n") for (const line of lines) { const matchData = line.match(/^yoda-language-server\s*\((.+)\)/); if (matchData) { const versions = matchData[1].split(/,\s*/) return maxSatisfying(versions, '*') } } return null }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yoda-language-server-0.10.1 | client/vscode/src/check-versions.ts |
yoda-language-server-0.10.0 | client/vscode/src/check-versions.ts |