mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-23 11:36:10 +08:00
docker: isAvailable use get
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
c89aa60986
commit
765b23685c
@ -50,7 +50,7 @@ describe('configDir', () => {
|
|||||||
describe('isAvailable', () => {
|
describe('isAvailable', () => {
|
||||||
it('cli', () => {
|
it('cli', () => {
|
||||||
const execSpy = jest.spyOn(exec, 'getExecOutput');
|
const execSpy = jest.spyOn(exec, 'getExecOutput');
|
||||||
Docker.isAvailable();
|
Docker.isAvailable;
|
||||||
// eslint-disable-next-line jest/no-standalone-expect
|
// eslint-disable-next-line jest/no-standalone-expect
|
||||||
expect(execSpy).toHaveBeenCalledWith(`docker`, undefined, {
|
expect(execSpy).toHaveBeenCalledWith(`docker`, undefined, {
|
||||||
silent: true,
|
silent: true,
|
||||||
|
@ -39,7 +39,7 @@ export class Buildx {
|
|||||||
this.context = opts.context;
|
this.context = opts.context;
|
||||||
this.inputs = new Inputs(this.context);
|
this.inputs = new Inputs(this.context);
|
||||||
this.install = new Install({standalone: opts.standalone});
|
this.install = new Install({standalone: opts.standalone});
|
||||||
this.standalone = opts?.standalone ?? !Docker.isAvailable();
|
this.standalone = opts?.standalone ?? !Docker.isAvailable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCommand(args: Array<string>) {
|
public getCommand(args: Array<string>) {
|
||||||
|
@ -23,7 +23,7 @@ export class Docker {
|
|||||||
return process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
return process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isAvailable(): boolean {
|
static get isAvailable(): boolean {
|
||||||
let dockerAvailable = false;
|
let dockerAvailable = false;
|
||||||
exec
|
exec
|
||||||
.getExecOutput('docker', undefined, {
|
.getExecOutput('docker', undefined, {
|
||||||
@ -45,7 +45,7 @@ export class Docker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static async printVersion(standalone?: boolean) {
|
public static async printVersion(standalone?: boolean) {
|
||||||
const noDocker = standalone ?? !Docker.isAvailable();
|
const noDocker = standalone ?? !Docker.isAvailable;
|
||||||
if (noDocker) {
|
if (noDocker) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ export class Docker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static async printInfo(standalone?: boolean) {
|
public static async printInfo(standalone?: boolean) {
|
||||||
const noDocker = standalone ?? !Docker.isAvailable();
|
const noDocker = standalone ?? !Docker.isAvailable;
|
||||||
if (noDocker) {
|
if (noDocker) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user