Skip to content

Commit 57dd46d

Browse files
unity-cli@v1.1.3 (#19)
- make LicenseClient.GetActiveEntitlements public
1 parent 00579cd commit 57dd46d

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rage-against-the-pixel/unity-cli",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"description": "A command line utility for the Unity Game Engine.",
55
"author": "RageAgainstThePixel",
66
"license": "MIT",
@@ -65,4 +65,4 @@
6565
"ts-node": "^10.9.2",
6666
"typescript": "^5.9.3"
6767
}
68-
}
68+
}

src/license-client.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ export class LicensingClient {
319319
* @throws Error if activation fails or required parameters are missing.
320320
*/
321321
public async Activate(licenseType: LicenseType, servicesConfig: string | undefined = undefined, serial: string | undefined = undefined, username: string | undefined = undefined, password: string | undefined = undefined): Promise<void> {
322-
let activeLicenses = await this.showEntitlements();
322+
let activeLicenses = await this.GetActiveEntitlements();
323323

324324
if (activeLicenses.includes(licenseType)) {
325325
this.logger.info(`License of type '${licenseType}' is already active, skipping activation`);
@@ -398,14 +398,18 @@ export class LicensingClient {
398398
return;
399399
}
400400

401-
const activeLicenses = await this.showEntitlements();
401+
const activeLicenses = await this.GetActiveEntitlements();
402402

403403
if (activeLicenses.includes(licenseType)) {
404404
await this.returnLicense(licenseType);
405405
}
406406
}
407407

408-
private async showEntitlements(): Promise<LicenseType[]> {
408+
/**
409+
* Shows the currently active entitlements/licenses.
410+
* @returns A list of active license types.
411+
*/
412+
public async GetActiveEntitlements(): Promise<LicenseType[]> {
409413
const output = await this.exec([`--showEntitlements`]);
410414
const matches = output.matchAll(/Product Name: (?<license>.+)/g);
411415
const licenses: LicenseType[] = [];
@@ -450,7 +454,7 @@ export class LicensingClient {
450454

451455
await this.exec(args);
452456

453-
const activeLicenses = await this.showEntitlements();
457+
const activeLicenses = await this.GetActiveEntitlements();
454458

455459
if (!activeLicenses.includes(licenseType)) {
456460
throw new Error(`Failed to activate license of type '${licenseType}'`);
@@ -462,7 +466,7 @@ export class LicensingClient {
462466
private async returnLicense(licenseType: LicenseType): Promise<void> {
463467
await this.exec([`--return-ulf`]);
464468

465-
const activeLicenses = await this.showEntitlements();
469+
const activeLicenses = await this.GetActiveEntitlements();
466470

467471
if (activeLicenses.includes(licenseType)) {
468472
throw new Error(`Failed to return license of type '${licenseType}'`);

0 commit comments

Comments
 (0)