fix(skills): generate executable download install plans
This commit is contained in:
@@ -55,8 +55,20 @@ describe('buildInstallerPlan', () => {
|
||||
expect(plan.steps).toEqual([
|
||||
{ installerType: 'go', command: 'go install example.com/tool/a@latest' },
|
||||
{ installerType: 'go', command: 'go install example.com/tool/b@latest' },
|
||||
{ installerType: 'download', command: 'download https://example.com/tool.tgz -> /tmp/tool.tgz' },
|
||||
{ installerType: 'download', command: 'curl -fsSL -o /tmp/tool.tgz https://example.com/tool.tgz' },
|
||||
]);
|
||||
expect(plan.skipped).toEqual([]);
|
||||
});
|
||||
|
||||
it('skips download installer when destination is missing', () => {
|
||||
const plan = buildInstallerPlan(
|
||||
[{ type: 'download', url: 'https://example.com/tool.tgz' }],
|
||||
{ hasBinary: () => true },
|
||||
);
|
||||
|
||||
expect(plan.steps).toEqual([]);
|
||||
expect(plan.skipped).toEqual([
|
||||
{ installerType: 'download', reason: 'download destination is required for executable install plans' },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -73,10 +73,13 @@ export function buildInstallerPlan(
|
||||
continue;
|
||||
}
|
||||
|
||||
const destination = installer.destination ?? '<default destination>';
|
||||
if (!installer.destination) {
|
||||
skipped.push({ installerType: 'download', reason: 'download destination is required for executable install plans' });
|
||||
continue;
|
||||
}
|
||||
steps.push({
|
||||
installerType: 'download',
|
||||
command: `download ${installer.url} -> ${destination}`,
|
||||
command: `curl -fsSL -o ${installer.destination} ${installer.url}`,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user