@@ -28,6 +28,7 @@ import require$$0$9 from 'diagnostics_channel';
2828import require$$2$2 from 'child_process';
2929import require$$6$1 from 'timers';
3030import { chmodSync } from 'node:fs';
31+ import { join } from 'node:path';
3132
3233var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3334
@@ -29857,10 +29858,10 @@ class GpgCli {
2985729858 }
2985829859 }
2985929860 async import(ascPath) {
29860- await execOutput(this.name, ['--import', ascPath]);
29861+ await execOutput(this.name, ['--import', ascPath], { silent: false, failOnStdErr: false } );
2986129862 }
2986229863 async verify(sigPath, binPath) {
29863- await execOutput(this.name, ['--verify', sigPath, binPath]);
29864+ await execOutput(this.name, ['--verify', sigPath, binPath], { silent: false, failOnStdErr: false } );
2986429865 }
2986529866 async help() {
2986629867 const { stdout } = await execOutput(this.name, ['--help']);
@@ -29914,6 +29915,10 @@ class TrdlCli {
2991429915 const { stdout } = await execOutput(this.name, ['list']);
2991529916 return stdout.slice(1).map(parseLineToItem);
2991629917 }
29918+ async version() {
29919+ const { stdout } = await execOutput(this.name, ['version'], { silent: false });
29920+ return stdout.join('');
29921+ }
2991729922}
2991829923function parseLineToItem(line) {
2991929924 const [name, url, default_, channel] = line.trim().split(/ +/);
@@ -29998,13 +30003,14 @@ async function downloadParallel(binUrl, sigUrl, ascUrl) {
2999830003function findTrdlCache(toolName, toolVersion) {
2999930004 return toolCacheExports.find(toolName, toolVersion);
3000030005}
30001- async function installTrdl(toolName, toolVersion, binPath ) {
30006+ async function installTrdl(binPath, toolName, toolVersion ) {
3000230007 // install tool
30003- const installedPath = await toolCacheExports.cacheFile(binPath, toolName, toolName, toolVersion);
30004- // set permissions
30005- chmodSync(installedPath, 0o755);
30008+ const cachedPath = await toolCacheExports.cacheFile(binPath, toolName, toolName, toolVersion);
3000630009 // add tool to $PATH
30007- coreExports.addPath(installedPath);
30010+ coreExports.addPath(cachedPath);
30011+ const cachedFile = join(cachedPath, toolName);
30012+ // set permissions
30013+ chmodSync(cachedFile, 0o755);
3000830014}
3000930015async function Run() {
3001030016 const trdlCli = new TrdlCli();
@@ -30014,11 +30020,11 @@ async function Run() {
3001430020}
3001530021async function Do(trdlCli, gpgCli, inputs) {
3001630022 coreExports.startGroup('Install or self-update trdl.');
30017- coreExports.debug (format(`parsed inputs=%o`, inputs));
30023+ coreExports.info (format(`parsed inputs=%o`, inputs));
3001830024 const defaults = trdlCli.defaults();
30019- coreExports.debug (format(`trdl defaults=%o`, defaults));
30025+ coreExports.info (format(`trdl defaults=%o`, defaults));
3002030026 const options = await getOptions(inputs, defaults);
30021- coreExports.debug (format(`installation options=%o`, options));
30027+ coreExports.info (format(`installation options=%o`, options));
3002230028 const toolCache = findTrdlCache(defaults.repo, options.version);
3002330029 if (toolCache) {
3002430030 coreExports.info(`Installation skipped. trdl@v${options.version} is found at path ${toolCache}.`);
@@ -30030,16 +30036,18 @@ async function Do(trdlCli, gpgCli, inputs) {
3003030036 }
3003130037 await gpgCli.mustGnuGP();
3003230038 const [binUrl, sigUrl, ascUrl] = formatDownloadUrls(options.version);
30033- coreExports.debug (format('%s bin_url =%s', defaults.repo, binUrl));
30034- coreExports.debug (format('%s sig_url =%s', defaults.repo, sigUrl));
30035- coreExports.debug (format('%s asc_url =%s', defaults.repo, ascUrl));
30036- coreExports.info('Downloading signatures.');
30039+ coreExports.info (format('%s binUrl =%s', defaults.repo, binUrl));
30040+ coreExports.info (format('%s sigUrl =%s', defaults.repo, sigUrl));
30041+ coreExports.info (format('%s ascUrl =%s', defaults.repo, ascUrl));
30042+ coreExports.info('Downloading binary and signatures.');
3003730043 const [binPath, sigPath, ascPath] = await downloadParallel(binUrl, sigUrl, ascUrl);
3003830044 coreExports.info('Importing and verifying gpg keys.');
3003930045 await gpgCli.import(ascPath);
3004030046 await gpgCli.verify(sigPath, binPath);
3004130047 coreExports.info('Installing trdl and adding it to the $PATH.');
30042- await installTrdl(defaults.repo, options.version, binPath);
30048+ await installTrdl(binPath, defaults.repo, options.version);
30049+ const version = await trdlCli.version();
30050+ coreExports.info(format('Installed version: trdl@%s', version));
3004330051 coreExports.endGroup();
3004430052}
3004530053
0 commit comments