Added a manifest create command

This commit is contained in:
Wade Wegner 2017-03-11 10:24:31 -08:00
Родитель 4cde9ab42f
Коммит 4789d4e427
4 изменённых файлов: 54 добавлений и 1 удалений

22
commands/create.js Normal file
Просмотреть файл

@ -0,0 +1,22 @@
(function () {
'use strict';
module.exports = {
topic: 'source',
command: 'create',
description: 'Create a manifest file for your open source project',
help: 'help text for force:source:manifest:create',
flags: [{
name: 'path',
char: 'p',
description: 'Path for your source',
required: true,
hasValue: true
}],
run(context) {
console.log(context.flags.path);
}
};
}());

Просмотреть файл

@ -1,4 +1,5 @@
const oss = require('./commands/oss.js');
const manifestCreate = require('./commands/create.js');
(function () {
'use strict';
@ -13,6 +14,6 @@ const oss = require('./commands/oss.js');
description: 'community commands from Trailhead'
};
exports.commands = [oss];
exports.commands = [oss, manifestCreate];
}());

12
lib/manifest.js Normal file
Просмотреть файл

@ -0,0 +1,12 @@
module.exports = {
// get the sfdx-oss-manifest.json file
createManifest: (path, result) => {
const manifestPath = 'result.json';
result(manifestPath);
}
};

Просмотреть файл

@ -1,5 +1,7 @@
const assert = require('chai').assert;
const files = require('../lib/files.js');
const manifest = require('../lib/manifest.js');
const path = require('path');
const shell = require('shelljs');
(function () {
@ -55,6 +57,22 @@ const shell = require('shelljs');
});
});
describe('creating manifest', () => {
it('manifest create should return a string pointing to the new manifest file', (done) => {
manifest.createManifest(path, (manifestPath) => {
assert.isNotNull(manifestPath);
assert.equal(path.extname(manifestPath), '.json');
done();
});
});
});
after(function() {
});