adapt-cli 2.1.13 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/.eslintrc.json +14 -0
- package/README.md +150 -150
- package/bin/adapt.js +3 -0
- package/json/help-create/question.json +9 -0
- package/json/help-create.json +2 -1
- package/lib/api.js +260 -0
- package/lib/cli.js +61 -44
- package/lib/commands/authenticate.js +18 -0
- package/lib/commands/create/component.js +55 -72
- package/lib/commands/create/course.js +25 -80
- package/lib/commands/create/question.js +18 -0
- package/lib/commands/create.js +80 -85
- package/lib/commands/devinstall.js +35 -97
- package/lib/commands/help.js +31 -52
- package/lib/commands/install.js +16 -907
- package/lib/commands/ls.js +9 -24
- package/lib/commands/register.js +10 -195
- package/lib/commands/rename.js +13 -128
- package/lib/commands/search.js +10 -28
- package/lib/commands/uninstall.js +9 -136
- package/lib/commands/unregister.js +11 -95
- package/lib/commands/update.js +12 -867
- package/lib/commands/version.js +12 -14
- package/lib/integration/AdaptFramework/build.js +39 -0
- package/lib/integration/AdaptFramework/clone.js +27 -0
- package/lib/integration/AdaptFramework/deleteSrcCore.js +9 -0
- package/lib/integration/AdaptFramework/deleteSrcCourse.js +9 -0
- package/lib/integration/AdaptFramework/download.js +21 -0
- package/lib/integration/AdaptFramework/erase.js +34 -0
- package/lib/integration/AdaptFramework/getLatestVersion.js +79 -0
- package/lib/integration/AdaptFramework/npmInstall.js +21 -0
- package/lib/integration/AdaptFramework.js +19 -0
- package/lib/integration/Plugin.js +403 -0
- package/lib/integration/PluginManagement/autenticate.js +56 -0
- package/lib/integration/PluginManagement/install.js +222 -0
- package/lib/integration/PluginManagement/print.js +52 -0
- package/lib/integration/PluginManagement/register.js +130 -0
- package/lib/integration/PluginManagement/rename.js +101 -0
- package/lib/integration/PluginManagement/schemas.js +8 -0
- package/lib/integration/PluginManagement/search.js +46 -0
- package/lib/integration/PluginManagement/uninstall.js +141 -0
- package/lib/integration/PluginManagement/unregister.js +101 -0
- package/lib/integration/PluginManagement/update.js +224 -0
- package/lib/integration/PluginManagement.js +21 -0
- package/lib/integration/Project.js +146 -0
- package/lib/integration/Target.js +296 -0
- package/lib/integration/getBowerRegistryConfig.js +34 -0
- package/lib/logger.js +28 -0
- package/lib/util/JSONReadValidate.js +34 -0
- package/lib/util/constants.js +38 -0
- package/lib/util/createPromptTask.js +7 -0
- package/lib/util/download.js +45 -0
- package/lib/util/errors.js +58 -0
- package/lib/util/extract.js +24 -0
- package/lib/util/getDirNameFromImportMeta.js +6 -0
- package/lib/util/promises.js +36 -0
- package/package.json +20 -29
- package/TESTING.md +0 -25
- package/bin/adapt +0 -3
- package/gruntfile.js +0 -18
- package/lib/AdaptConsoleApplication.js +0 -19
- package/lib/CommandParser.js +0 -19
- package/lib/CommandTranslator.js +0 -16
- package/lib/ConsoleRenderer.js +0 -10
- package/lib/Constants.js +0 -68
- package/lib/JsonLoader.js +0 -40
- package/lib/JsonWriter.js +0 -21
- package/lib/PackageMeta.js +0 -41
- package/lib/Plugin.js +0 -53
- package/lib/PluginTypeResolver.js +0 -47
- package/lib/Project.js +0 -89
- package/lib/RendererHelpers.js +0 -41
- package/lib/RepositoryDownloader.js +0 -64
- package/lib/Slug.js +0 -5
- package/lib/VersionChecker.js +0 -7
- package/lib/commands/create/index.js +0 -6
- package/lib/commands/index.js +0 -16
- package/lib/commands/install/InstallLog.js +0 -32
- package/lib/commands/install/InstallTarget.js +0 -259
- package/lib/commands/install/extend.js +0 -31
- package/lib/download.js +0 -101
- package/lib/errors.js +0 -58
- package/lib/promise/authenticate.js +0 -58
- package/lib/promise/build.js +0 -20
- package/lib/promise/cloneInstall.js +0 -35
- package/lib/promise/confirmBuild.js +0 -6
- package/lib/promise/exec.js +0 -39
- package/lib/promise/getRepository.js +0 -26
- package/lib/promise/highest.js +0 -109
- package/lib/promise/install.js +0 -31
- package/lib/promise/installAdaptDependencies.js +0 -30
- package/lib/promise/installNodeDependencies.js +0 -28
- package/lib/promise/removeTemporaryDownload.js +0 -8
- package/lib/promise/replaceTextContent.js +0 -10
- package/lib/promise/uninstallPackage.js +0 -15
- package/lib/promise/update.js +0 -33
- package/lib/promise/util.js +0 -16
- package/test/fixtures/adapt-with-plugins.json +0 -6
- package/test/specs/command_translation_concerns.js +0 -13
- package/test/specs/create_command_concerns.js +0 -22
- package/test/specs/create_concerns.js +0 -30
- package/test/specs/install_concerns.js +0 -31
- package/test/specs/installing_compatible_plugins_concerns.js +0 -126
- package/test/specs/installing_incompatible_plugins_concerns.js +0 -103
- package/test/specs/ls_concerns.js +0 -28
- package/test/specs/plugin_name_concerns.js +0 -82
- package/test/specs/project_concerns.js +0 -128
- package/test/specs/registration_concerns.js +0 -31
- package/test/specs/repository_downloader_concerns.js +0 -55
- package/test/specs/search_concerns.js +0 -30
- package/test/specs/type_resolution_concerns.js +0 -71
- package/test/specs/uninstall_command_concerns.js +0 -64
- package/test/specs/uninstall_concerns.js +0 -31
@@ -1,30 +0,0 @@
|
|
1
|
-
var sinon = require('sinon'),
|
2
|
-
expect = require('expect.js');
|
3
|
-
|
4
|
-
describe('Given I have an application', function () {
|
5
|
-
var AdaptConsoleApplication = require('../../lib/AdaptConsoleApplication'),
|
6
|
-
CommandParser = require('../../lib/CommandParser'),
|
7
|
-
searchResults = [
|
8
|
-
"blah"
|
9
|
-
],
|
10
|
-
commands = {
|
11
|
-
search: sinon.stub().yields(null, searchResults)
|
12
|
-
},
|
13
|
-
outputDevice = {
|
14
|
-
log: sinon.stub()
|
15
|
-
},
|
16
|
-
argsv = function () {
|
17
|
-
return ['node', 'search-concerns.js'].concat(Array.prototype.slice.call(arguments));
|
18
|
-
},
|
19
|
-
app = new AdaptConsoleApplication(commands, outputDevice);
|
20
|
-
|
21
|
-
describe('when I execute a search command for a term', function () {
|
22
|
-
it('should perform a search for the term', function (done) {
|
23
|
-
var search_command = new CommandParser(argsv('search', 'term'));
|
24
|
-
app.do(search_command, function (err, results) {
|
25
|
-
expect(commands.search.calledWith(outputDevice, 'term')).to.be(true);
|
26
|
-
done();
|
27
|
-
});
|
28
|
-
});
|
29
|
-
});
|
30
|
-
});
|
@@ -1,71 +0,0 @@
|
|
1
|
-
var sinon = require('sinon'),
|
2
|
-
expect = require('expect.js');
|
3
|
-
|
4
|
-
describe('Given I have a plugin type resolver', function () {
|
5
|
-
var PluginTypeResolver = require('../../lib/PluginTypeResolver'),
|
6
|
-
resolver = new PluginTypeResolver();
|
7
|
-
|
8
|
-
describe('when I resolve the keyword for a component', function () {
|
9
|
-
it('should provide a type of component', function () {
|
10
|
-
var keywords = ['adapt-component'];
|
11
|
-
|
12
|
-
expect(resolver.resolve(keywords).typename).to.be('component');
|
13
|
-
expect(resolver.resolve(keywords).belongsTo).to.be('components');
|
14
|
-
});
|
15
|
-
});
|
16
|
-
|
17
|
-
describe('when I resolve the keyword for an extension', function () {
|
18
|
-
it('should provide a type of extension', function () {
|
19
|
-
var keywords = ['adapt-extension'];
|
20
|
-
|
21
|
-
expect(resolver.resolve(keywords).typename).to.be('extension');
|
22
|
-
expect(resolver.resolve(keywords).belongsTo).to.be('extensions');
|
23
|
-
});
|
24
|
-
});
|
25
|
-
|
26
|
-
describe('when I resolve the keyword for a menu', function () {
|
27
|
-
it('should provide a type of menu', function () {
|
28
|
-
var keywords = ['adapt-menu'];
|
29
|
-
|
30
|
-
expect(resolver.resolve(keywords).belongsTo).to.be('menu');
|
31
|
-
expect(resolver.resolve(keywords).belongsTo).to.be('menu');
|
32
|
-
});
|
33
|
-
});
|
34
|
-
|
35
|
-
describe('when I resolve the keyword for a theme', function () {
|
36
|
-
it('should provide a type of theme', function () {
|
37
|
-
var keywords = ['adapt-theme'];
|
38
|
-
|
39
|
-
expect(resolver.resolve(keywords).belongsTo).to.be('theme');
|
40
|
-
expect(resolver.resolve(keywords).belongsTo).to.be('theme');
|
41
|
-
});
|
42
|
-
});
|
43
|
-
|
44
|
-
describe('when I have no keywords', function () {
|
45
|
-
it('should provide the default type', function () {
|
46
|
-
var keywords = undefined;
|
47
|
-
|
48
|
-
expect(resolver.resolve(keywords).typename).to.be(resolver.defaultType.typename);
|
49
|
-
expect(resolver.resolve(keywords).belongsTo).to.be(resolver.defaultType.belongsTo);
|
50
|
-
});
|
51
|
-
});
|
52
|
-
|
53
|
-
describe('when I have conflicting keywords', function () {
|
54
|
-
it('should provide the first matching type', function () {
|
55
|
-
var keywords = ['adapt-theme', 'adapt-extension'];
|
56
|
-
|
57
|
-
expect(resolver.resolve(keywords).typename).to.be('theme');
|
58
|
-
expect(resolver.resolve(keywords).belongsTo).to.be('theme');
|
59
|
-
});
|
60
|
-
});
|
61
|
-
|
62
|
-
describe('when I have an unknown keyword', function () {
|
63
|
-
it('should provide the first matching type', function () {
|
64
|
-
var keywords = ['unknown-keyword', 'adapt-theme'];
|
65
|
-
|
66
|
-
expect(resolver.resolve(keywords).typename).to.be('theme');
|
67
|
-
expect(resolver.resolve(keywords).belongsTo).to.be('theme');
|
68
|
-
});
|
69
|
-
});
|
70
|
-
|
71
|
-
});
|
@@ -1,64 +0,0 @@
|
|
1
|
-
var fs = require('fs'),
|
2
|
-
mockery = require('mockery'),
|
3
|
-
sinon = require('sinon'),
|
4
|
-
expect = require('expect.js'),
|
5
|
-
Q = require('q'),
|
6
|
-
Project = require('../../lib/Project'),
|
7
|
-
Plugin = require('../../lib/Plugin');
|
8
|
-
|
9
|
-
describe('Given I have an uninstall command', function () {
|
10
|
-
describe('when I uninstall a plugin', function () {
|
11
|
-
var bower = {
|
12
|
-
commands: {}
|
13
|
-
},
|
14
|
-
PackageMeta = {
|
15
|
-
},
|
16
|
-
renderer = {
|
17
|
-
log: sinon.stub()
|
18
|
-
};
|
19
|
-
|
20
|
-
before(function () {
|
21
|
-
fs.writeFileSync('./adapt.json', JSON.stringify(require('../fixtures/adapt.json')));
|
22
|
-
|
23
|
-
mockery.enable();
|
24
|
-
mockery.warnOnUnregistered(false);
|
25
|
-
|
26
|
-
bower.commands.uninstall = sinon.stub().returns({
|
27
|
-
on: function (event, done) {
|
28
|
-
if(event === 'end') {
|
29
|
-
setTimeout(done, 10, true);
|
30
|
-
}
|
31
|
-
return this;
|
32
|
-
}
|
33
|
-
});
|
34
|
-
mockery.registerMock('bower', bower);
|
35
|
-
|
36
|
-
PackageMeta.getKeywords = sinon.stub().returns(Q.fcall(function () {
|
37
|
-
return ['adapt-component'];
|
38
|
-
}));
|
39
|
-
mockery.registerMock('../PackageMeta', PackageMeta);
|
40
|
-
});
|
41
|
-
|
42
|
-
it('should get the keywords', function (done) {
|
43
|
-
var command = require('../../lib/commands/uninstall');
|
44
|
-
command.uninstall(renderer, 'my-plugin', function () {
|
45
|
-
expect(PackageMeta.getKeywords.called).to.be(true);
|
46
|
-
done();
|
47
|
-
});
|
48
|
-
});
|
49
|
-
|
50
|
-
it('should invoke the bower uninstall command', function (done) {
|
51
|
-
var command = require('../../lib/commands/uninstall');
|
52
|
-
command.uninstall(renderer, 'my-plugin', function () {
|
53
|
-
expect(bower.commands.uninstall.called).to.be(true);
|
54
|
-
done();
|
55
|
-
});
|
56
|
-
});
|
57
|
-
|
58
|
-
after(function () {
|
59
|
-
fs.unlinkSync('./adapt.json');
|
60
|
-
mockery.disable();
|
61
|
-
});
|
62
|
-
});
|
63
|
-
|
64
|
-
});
|
@@ -1,31 +0,0 @@
|
|
1
|
-
var sinon = require('sinon'),
|
2
|
-
expect = require('expect.js');
|
3
|
-
|
4
|
-
describe('Given I have an application', function () {
|
5
|
-
var AdaptConsoleApplication = require('../../lib/AdaptConsoleApplication'),
|
6
|
-
CommandParser = require('../../lib/CommandParser'),
|
7
|
-
uninstallResult = {
|
8
|
-
success: true
|
9
|
-
},
|
10
|
-
commands = {
|
11
|
-
uninstall: sinon.stub().yields(null, uninstallResult)
|
12
|
-
},
|
13
|
-
outputDevice = {
|
14
|
-
log: sinon.stub()
|
15
|
-
},
|
16
|
-
argsv = function () {
|
17
|
-
return ['node', 'search-concerns.js'].concat(Array.prototype.slice.call(arguments));
|
18
|
-
},
|
19
|
-
app = new AdaptConsoleApplication(commands, outputDevice);
|
20
|
-
|
21
|
-
describe('when I execute an uninstall command for an existing package', function () {
|
22
|
-
it('should uninstall the package', function (done) {
|
23
|
-
var uninstall_command = new CommandParser(argsv('uninstall', 'package-name'));
|
24
|
-
app.do(uninstall_command, function (err, results) {
|
25
|
-
expect(commands.uninstall.calledWith(outputDevice, 'package-name')).to.be(true);
|
26
|
-
done();
|
27
|
-
});
|
28
|
-
});
|
29
|
-
});
|
30
|
-
|
31
|
-
});
|