Skip to content

Commit 993524d

Browse files
Saas rename step to step type (#341)
1 parent 9310776 commit 993524d

File tree

9 files changed

+29
-92
lines changed

9 files changed

+29
-92
lines changed

lib/interface/cli/commands/root/create.cmd.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const get = new Command({
99
root: true,
1010
command: 'create',
1111
description: 'Create a resource from a file or stdin',
12-
usage: 'Supported resources: \n\t\'context\'\n\t\'pipeline\'\'\n\t\'step\'',
12+
usage: 'Supported resources: \n\t\'context\'\n\t\'pipeline\'\'\n\t\'step-type\'',
1313
webDocs: {
1414
description: 'Create a resource from a file, directory or url',
1515
category: 'Operate On Resources',
@@ -48,9 +48,9 @@ const get = new Command({
4848
await sdk.pipelines.create(data);
4949
console.log(`Pipeline '${name}' created`);
5050
break;
51-
case 'step':
51+
case 'step-type':
5252
await sdk.steps.create(data);
53-
console.log(`Step '${name}' created`);
53+
console.log(`Step-type '${name}' created`);
5454
break;
5555
default:
5656
throw new CFError(`Entity: ${entity} not supported`);

lib/interface/cli/commands/root/replace.cmd.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const annotate = new Command({
99
root: true,
1010
command: 'replace',
1111
description: 'Replace a resource by filename',
12-
usage: 'Supported resources: \n\t\'Context\'\n\t\'Pipeline\'\'\n\t\'Step\'',
12+
usage: 'Supported resources: \n\t\'Context\'\n\t\'Pipeline\'\'\n\t\'Step-type\'',
1313
webDocs: {
1414
description: 'Replace a resource from a file, directory or url',
1515
category: 'Operate On Resources',
@@ -56,11 +56,11 @@ const annotate = new Command({
5656
}, data);
5757
console.log(`Pipeline '${name}' updated`);
5858
break;
59-
case 'step':
59+
case 'step-type':
6060
await sdk.steps.replace({
6161
name,
6262
}, data);
63-
console.log(`Step '${name}' updated`);
63+
console.log(`Step-type '${name}' updated`);
6464
break;
6565
default:
6666
throw new CFError(`Entity: ${entity} not supported`);

lib/interface/cli/commands/step/delete.cmd.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ const { sdk } = require('../../../../logic');
44

55

66
const command = new Command({
7-
command: 'step [name]',
7+
command: 'step-type [name]',
88
parent: deleteRoot,
9-
description: 'Delete a step',
9+
description: 'Delete a step-type',
1010
webDocs: {
11-
category: 'Steps',
12-
title: 'Delete Step',
11+
category: 'Step-types',
12+
title: 'Delete Step-type',
1313
},
1414
builder: (yargs) => {
1515
return yargs
1616
.positional('name', {
17-
describe: 'Step name',
17+
describe: 'Step-type name',
1818
});
1919
},
2020
handler: async (argv) => {
2121
const { name } = argv;
2222

2323
await sdk.steps.delete({ name });
24-
console.log(`Step '${name}' deleted.`);
24+
console.log(`Step-type '${name}' deleted.`);
2525
},
2626
});
2727

lib/interface/cli/commands/step/get.cmd.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ const DEFAULTS = require('../../defaults');
66
const { prepareKeyValueFromCLIEnvOption } = require('../../helpers/general');
77
const Output = require('../../../../output/Output');
88
const { sdk } = require('../../../../logic');
9-
const Step = require('../../../../logic/entities/Step');
9+
const StepType = require('../../../../logic/entities/StepType');
1010

1111
const getRoot = require('../root/get.cmd');
1212

1313

1414
const command = new Command({
15-
command: 'steps [id..]',
16-
aliases: ['step'],
15+
command: 'step-types [id..]',
16+
aliases: ['step-type'],
1717
parent: getRoot,
1818
description: 'Get a specific step or an array of steps',
1919
webDocs: {
@@ -79,14 +79,14 @@ const command = new Command({
7979
for (const id of ids) {
8080
try {
8181
const currStep = await sdk.steps.get({ name: id });
82-
steps.push(Step.fromResponse(currStep));
82+
steps.push(StepType.fromResponse(currStep));
8383
} catch (err) {
8484
if (steps.length) {
8585
Output.print(steps);
8686
}
8787

8888
debug(err.toString());
89-
const message = err.toString().includes('not find') ? `Step '${id}' was not found.` : 'Error occurred';
89+
const message = err.toString().includes('not find') ? `Step-type '${id}' was not found.` : 'Error occurred';
9090
throw new CFError({
9191
cause: err,
9292
message,
@@ -106,7 +106,7 @@ const command = new Command({
106106
official,
107107
tag,
108108
});
109-
Output.print(_.map(_.get(steps, 'docs'), Step.fromResponse));
109+
Output.print(_.map(_.get(steps, 'docs'), StepType.fromResponse));
110110
}
111111
},
112112
});

lib/interface/cli/commands/step/get.completion.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const _ = require('lodash');
22
const steps = () => require('../../../../logic').sdk.steps;
3-
const Step = require('../../../../logic/entities/Step');
3+
const StepType = require('../../../../logic/entities/StepType');
44
const { authContextWrapper } = require('../../completion/helpers');
55

66
const positionalHandler = async ({word, argv}) => {
77
const stps = await steps().list({ limit: 25, offset: 0 });
8-
return _.map(_.get(stps, 'docs'), Step.fromResponse).map(p => p.name);
8+
return _.map(_.get(stps, 'docs'), StepType.fromResponse).map(p => p.name);
99
};
1010

1111
module.exports = {

lib/interface/cli/commands/step/step.sdk.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jest.mock('../../completion/helpers', () => { // eslint-disable-line
1010
};
1111
});
1212

13-
jest.mock('../../../../logic/entities/Step', () => { // eslint-disable-line
13+
jest.mock('../../../../logic/entities/StepType', () => { // eslint-disable-line
1414
return {
1515
fromResponse: res => res,
1616
};

lib/logic/entities/Step.js renamed to lib/logic/entities/StepType.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const Entity = require('./Entity');
22
const _ = require('lodash');
33

4-
class Step extends Entity {
4+
class StepType extends Entity {
55
constructor(data) {
66
super();
7-
this.entityType = 'step';
7+
this.entityType = 'step-type';
88
this.info = data;
99
this.name = this.info.metadata.name;
1010
this.visibility = this.info.metadata.isPublic ? 'public' : 'private';
@@ -18,8 +18,8 @@ class Step extends Entity {
1818
}
1919

2020
static fromResponse(response) {
21-
return new Step(_.pick(response, 'version', 'kind', 'metadata', 'spec'));
21+
return new StepType(_.pick(response, 'version', 'kind', 'metadata', 'spec'));
2222
}
2323
}
2424

25-
module.exports = Step;
25+
module.exports = StepType;

openapi.json

Lines changed: 3 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5395,7 +5395,7 @@
53955395
}
53965396
},
53975397

5398-
"/steps": {
5398+
"/step-types": {
53995399
"get": {
54005400
"responses": {
54015401
"200": {
@@ -5532,70 +5532,7 @@
55325532
}
55335533
}
55345534
},
5535-
"/steps/labels": {
5536-
"get": {
5537-
"responses": {
5538-
"200": {
5539-
"$ref": "#/components/responses/json"
5540-
}
5541-
},
5542-
"tags": [
5543-
"steps"
5544-
],
5545-
"operationId": "steps-get-labels",
5546-
"parameters": [],
5547-
"summary": "Get all labels",
5548-
"x-sdk-interface": "steps.getLabels",
5549-
"x-endpoint": {
5550-
"isEndpoint": false,
5551-
"preMiddleware": [
5552-
"auth.isAuthenticated"
5553-
],
5554-
"postMiddleware": [
5555-
"global.iseMiddleware"
5556-
],
5557-
"handler": "steps.getLabels"
5558-
}
5559-
}
5560-
},
5561-
"/steps/labels/{label}": {
5562-
"get": {
5563-
"responses": {
5564-
"200": {
5565-
"$ref": "#/components/responses/json"
5566-
}
5567-
},
5568-
"tags": [
5569-
"steps"
5570-
],
5571-
"operationId": "steps-get-label-values",
5572-
"parameters": [
5573-
{
5574-
"in": "path",
5575-
"name": "label",
5576-
"schema": {
5577-
"type": "string"
5578-
},
5579-
"required": true,
5580-
"description": "label"
5581-
}
5582-
5583-
],
5584-
"summary": "Get label values",
5585-
"x-sdk-interface": "steps.getLabelValues",
5586-
"x-endpoint": {
5587-
"isEndpoint": false,
5588-
"preMiddleware": [
5589-
"auth.isAuthenticated"
5590-
],
5591-
"postMiddleware": [
5592-
"global.iseMiddleware"
5593-
],
5594-
"handler": "steps.getLabelValues"
5595-
}
5596-
}
5597-
},
5598-
"/steps/names": {
5535+
"/step-types/names": {
55995536
"get": {
56005537
"parameters": [
56015538
{
@@ -5654,7 +5591,7 @@
56545591
}
56555592
}
56565593
},
5657-
"/steps/{name}": {
5594+
"/step-types/{name}": {
56585595
"get": {
56595596
"parameters": [
56605597
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.23.0",
3+
"version": "0.24.0",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)