Skip to content

Commit

Permalink
Add tags to ExtensionPack metadata (#543)
Browse files Browse the repository at this point in the history
fixes #542
  • Loading branch information
cdupuis authored and johnsonr committed Oct 2, 2018
1 parent acbdd59 commit 1db68ea
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/api-helper/misc/extensionPack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ export function metadata(name?: string): ExtensionPackMetadata {
name: name ? `${pj.name}:${name.toLocaleLowerCase()}` : pj.name,
vendor: pj.author && pj.author.name ? pj.author.name : pj.author,
version: pj.version ? pj.version : "",
tags: pj.keywords ? pj.keywords : [],
};
}
14 changes: 14 additions & 0 deletions lib/api/machine/ExtensionPack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,25 @@ import { MachineConfigurer } from "./MachineConfigurer";

export interface ExtensionPackMetadata {

/**
* Name of the extension pack
*/
name: string;

/**
* Vendor or author of this extension pack
*/
vendor: string;

/**
* Version of extension pack
*/
version: string;

/**
* Optional tags of extension pack
*/
tags?: string | string[];
}

/**
Expand Down
29 changes: 29 additions & 0 deletions test/api-helper/misc/extensionPack.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright © 2018 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import * as assert from "power-assert";
import { metadata } from "../../../lib/api-helper/misc/extensionPack";

describe("extensionPack", () => {

it("should correctly read metadata from package.json", () => {
const epm = metadata("test");
assert.equal(epm.name, "@atomist/sdm:test");
assert.equal(epm.vendor, "Atomist");
assert.equal(epm.tags.length, 5);
});

});

0 comments on commit 1db68ea

Please sign in to comment.