-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
111 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ export const NoPrepareTools = [ | |
'npm', | ||
'pnpm', | ||
'renovate', | ||
'wally', | ||
'yarn', | ||
'yarn-slim', | ||
]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import fs from 'node:fs/promises'; | ||
import { join } from 'node:path'; | ||
import { execa } from 'execa'; | ||
import { inject, injectable } from 'inversify'; | ||
import { InstallToolBaseService } from '../install-tool/install-tool-base.service'; | ||
import { | ||
CompressionService, | ||
EnvService, | ||
HttpService, | ||
PathService, | ||
} from '../services'; | ||
import { getDistro } from '../utils'; | ||
|
||
@injectable() | ||
export class InstallWallyService extends InstallToolBaseService { | ||
readonly name = 'wally'; | ||
|
||
constructor( | ||
@inject(EnvService) envSvc: EnvService, | ||
@inject(PathService) pathSvc: PathService, | ||
@inject(HttpService) private http: HttpService, | ||
@inject(CompressionService) private compress: CompressionService, | ||
) { | ||
super(pathSvc, envSvc); | ||
} | ||
|
||
override async install(version: string): Promise<void> { | ||
const distro = await getDistro(); | ||
|
||
// wally requires libssl3 which is not easily installable on focal | ||
if (distro.versionCode === 'focal') { | ||
throw new Error(`Unsupported distro: ${distro.versionCode}`); | ||
} | ||
|
||
const baseUrl = `https://github.com/UpliftGames/wally/releases/download/v${version}/`; | ||
const filename = `wally-v${version}-linux.zip`; | ||
|
||
const file = await this.http.download({ | ||
url: `${baseUrl}${filename}`, | ||
}); | ||
|
||
// TODO: create recursive | ||
if (!(await this.pathSvc.findToolPath(this.name))) { | ||
await this.pathSvc.createToolPath(this.name); | ||
} | ||
|
||
const path = join( | ||
await this.pathSvc.createVersionedToolPath(this.name, version), | ||
'bin', | ||
); | ||
await fs.mkdir(path); | ||
await this.compress.extract({ | ||
file, | ||
cwd: path, | ||
}); | ||
} | ||
|
||
override async link(version: string): Promise<void> { | ||
const src = join(this.pathSvc.versionedToolPath(this.name, version), 'bin'); | ||
|
||
await this.shellwrapper({ srcDir: src }); | ||
} | ||
|
||
override async test(_version: string): Promise<void> { | ||
await execa(this.name, ['--version'], { stdio: ['inherit', 'inherit', 1] }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters