Skip to content

Commit

Permalink
feat: implement JReleaserCatalog command
Browse files Browse the repository at this point in the history
  • Loading branch information
shblue21 committed Apr 9, 2023
1 parent 883f062 commit 45aed80
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tasks/JReleaserTask/commands/catalog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { CommandResponse } from '.';
import * as toolrunner from 'azure-pipelines-task-lib/toolrunner';
import * as tasks from 'azure-pipelines-task-lib/task';
import { ITaskContext } from '../context';
import { AbstractPlatformAwareModelCommand } from './abstractPlatformAwareModelCommand';

export class JReleaserCatalog extends AbstractPlatformAwareModelCommand {
constructor(toolrunner: toolrunner.ToolRunner) {
super(toolrunner);
}

protected setup(ctx: ITaskContext): void {
this.options.unshift('catalog');
}

exec(): Promise<CommandResponse> {
for (const option of this.options) {
this.toolrunner.arg(option);
}
tasks.debug(`Running JReleaser with options: ${this.options.join(' ')}`);

const runnerResult = this.toolrunner.execSync();
if (runnerResult.code === 0) {
return Promise.resolve(new CommandResponse(0));
} else {
return Promise.reject(
new CommandResponse(
1,
`Failed to initialize JReleaser. Exit code: ${runnerResult.code}`,
),
);
}
}
}
1 change: 1 addition & 0 deletions tasks/JReleaserTask/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ export { JReleaserCustom as JReleaserCustomHandler } from './custom';
export { JReleaserAnnounce as JReleaserAnnounceHandler } from './announce';
export { JReleaserRelease as JReleaserReleaseHandler } from './release';
export { JReleaserAssemble as JReleaserAssembleHandler } from './assemble';
export { JReleaserCatalog as JReleaserCatalogHandler } from './catalog';
1 change: 1 addition & 0 deletions tasks/JReleaserTask/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"init": "Init",
"config": "Config",
"assemble": "Assemble",
"catalog": "Catalog",
"release": "Release",
"announce": "Announce",
"custom": "Custom"
Expand Down
1 change: 1 addition & 0 deletions tasks/JReleaserTask/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class Task {
announce: new commands.JReleaserAnnounceHandler(this.toolrunner),
release: new commands.JReleaserReleaseHandler(this.toolrunner),
assemble: new commands.JReleaserAssembleHandler(this.toolrunner),
catalog: new commands.JReleaserCatalogHandler(this.toolrunner),
};
}

Expand Down

0 comments on commit 45aed80

Please sign in to comment.