adapt-cli 2.1.13 → 3.0.6

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.
Files changed (134) hide show
  1. package/.bowerrc +2 -2
  2. package/.eslintignore +1 -0
  3. package/.eslintrc.json +14 -0
  4. package/.github/CONTRIBUTING.md +8 -0
  5. package/.github/ISSUE_TEMPLATE.md +17 -0
  6. package/.github/pull_request_template.md +25 -0
  7. package/.github/workflows/addtomainproject.yml +19 -0
  8. package/.github/workflows/releases.yml +25 -0
  9. package/.travis.yml +46 -46
  10. package/README.md +266 -266
  11. package/bin/adapt.js +3 -0
  12. package/json/help-create/component.json +9 -9
  13. package/json/help-create/course.json +9 -9
  14. package/json/help-create/question.json +9 -0
  15. package/json/help-create.json +12 -11
  16. package/json/help-devinstall.json +9 -9
  17. package/json/help-install.json +10 -10
  18. package/json/help-ls.json +7 -7
  19. package/json/help-register.json +7 -7
  20. package/json/help-rename.json +7 -7
  21. package/json/help-search.json +8 -8
  22. package/json/help-uninstall.json +7 -7
  23. package/json/help-unregister.json +8 -8
  24. package/json/help-update.json +12 -12
  25. package/json/help-version.json +7 -7
  26. package/json/help.json +19 -19
  27. package/lib/api.js +260 -0
  28. package/lib/cli.js +69 -52
  29. package/lib/commands/authenticate.js +18 -0
  30. package/lib/commands/create/component.js +64 -81
  31. package/lib/commands/create/course.js +26 -81
  32. package/lib/commands/create/question.js +18 -0
  33. package/lib/commands/create.js +94 -90
  34. package/lib/commands/devinstall.js +35 -97
  35. package/lib/commands/help.js +31 -52
  36. package/lib/commands/install.js +16 -907
  37. package/lib/commands/ls.js +9 -24
  38. package/lib/commands/register.js +11 -196
  39. package/lib/commands/rename.js +14 -129
  40. package/lib/commands/search.js +11 -29
  41. package/lib/commands/uninstall.js +9 -136
  42. package/lib/commands/unregister.js +12 -96
  43. package/lib/commands/update.js +12 -867
  44. package/lib/commands/version.js +13 -15
  45. package/lib/integration/AdaptFramework/build.js +42 -0
  46. package/lib/integration/AdaptFramework/clone.js +27 -0
  47. package/lib/integration/AdaptFramework/deleteSrcCore.js +9 -0
  48. package/lib/integration/AdaptFramework/deleteSrcCourse.js +9 -0
  49. package/lib/integration/AdaptFramework/download.js +21 -0
  50. package/lib/integration/AdaptFramework/erase.js +34 -0
  51. package/lib/integration/AdaptFramework/getLatestVersion.js +79 -0
  52. package/lib/integration/AdaptFramework/npmInstall.js +21 -0
  53. package/lib/integration/AdaptFramework.js +19 -0
  54. package/lib/integration/Plugin.js +404 -0
  55. package/lib/integration/PluginManagement/autenticate.js +56 -0
  56. package/lib/integration/PluginManagement/install.js +224 -0
  57. package/lib/integration/PluginManagement/print.js +52 -0
  58. package/lib/integration/PluginManagement/register.js +130 -0
  59. package/lib/integration/PluginManagement/rename.js +101 -0
  60. package/lib/integration/PluginManagement/schemas.js +8 -0
  61. package/lib/integration/PluginManagement/search.js +46 -0
  62. package/lib/integration/PluginManagement/uninstall.js +141 -0
  63. package/lib/integration/PluginManagement/unregister.js +101 -0
  64. package/lib/integration/PluginManagement/update.js +224 -0
  65. package/lib/integration/PluginManagement.js +21 -0
  66. package/lib/integration/Project.js +146 -0
  67. package/lib/integration/Target.js +299 -0
  68. package/lib/integration/getBowerRegistryConfig.js +34 -0
  69. package/lib/logger.js +28 -0
  70. package/lib/util/JSONReadValidate.js +34 -0
  71. package/lib/util/constants.js +38 -0
  72. package/lib/util/createPromptTask.js +7 -0
  73. package/lib/util/download.js +45 -0
  74. package/lib/util/errors.js +58 -0
  75. package/lib/util/extract.js +24 -0
  76. package/lib/util/getDirNameFromImportMeta.js +6 -0
  77. package/lib/util/promises.js +36 -0
  78. package/package.json +74 -49
  79. package/TESTING.md +0 -25
  80. package/bin/adapt +0 -3
  81. package/gruntfile.js +0 -18
  82. package/lib/AdaptConsoleApplication.js +0 -19
  83. package/lib/CommandParser.js +0 -19
  84. package/lib/CommandTranslator.js +0 -16
  85. package/lib/ConsoleRenderer.js +0 -10
  86. package/lib/Constants.js +0 -68
  87. package/lib/JsonLoader.js +0 -40
  88. package/lib/JsonWriter.js +0 -21
  89. package/lib/PackageMeta.js +0 -41
  90. package/lib/Plugin.js +0 -53
  91. package/lib/PluginTypeResolver.js +0 -47
  92. package/lib/Project.js +0 -89
  93. package/lib/RendererHelpers.js +0 -41
  94. package/lib/RepositoryDownloader.js +0 -64
  95. package/lib/Slug.js +0 -5
  96. package/lib/VersionChecker.js +0 -7
  97. package/lib/commands/create/index.js +0 -6
  98. package/lib/commands/index.js +0 -16
  99. package/lib/commands/install/InstallLog.js +0 -32
  100. package/lib/commands/install/InstallTarget.js +0 -259
  101. package/lib/commands/install/extend.js +0 -31
  102. package/lib/download.js +0 -101
  103. package/lib/errors.js +0 -58
  104. package/lib/promise/authenticate.js +0 -58
  105. package/lib/promise/build.js +0 -20
  106. package/lib/promise/cloneInstall.js +0 -35
  107. package/lib/promise/confirmBuild.js +0 -6
  108. package/lib/promise/exec.js +0 -39
  109. package/lib/promise/getRepository.js +0 -26
  110. package/lib/promise/highest.js +0 -109
  111. package/lib/promise/install.js +0 -31
  112. package/lib/promise/installAdaptDependencies.js +0 -30
  113. package/lib/promise/installNodeDependencies.js +0 -28
  114. package/lib/promise/removeTemporaryDownload.js +0 -8
  115. package/lib/promise/replaceTextContent.js +0 -10
  116. package/lib/promise/uninstallPackage.js +0 -15
  117. package/lib/promise/update.js +0 -33
  118. package/lib/promise/util.js +0 -16
  119. package/test/fixtures/adapt-with-plugins.json +0 -6
  120. package/test/specs/command_translation_concerns.js +0 -13
  121. package/test/specs/create_command_concerns.js +0 -22
  122. package/test/specs/create_concerns.js +0 -30
  123. package/test/specs/install_concerns.js +0 -31
  124. package/test/specs/installing_compatible_plugins_concerns.js +0 -126
  125. package/test/specs/installing_incompatible_plugins_concerns.js +0 -103
  126. package/test/specs/ls_concerns.js +0 -28
  127. package/test/specs/plugin_name_concerns.js +0 -82
  128. package/test/specs/project_concerns.js +0 -128
  129. package/test/specs/registration_concerns.js +0 -31
  130. package/test/specs/repository_downloader_concerns.js +0 -55
  131. package/test/specs/search_concerns.js +0 -30
  132. package/test/specs/type_resolution_concerns.js +0 -71
  133. package/test/specs/uninstall_command_concerns.js +0 -64
  134. package/test/specs/uninstall_concerns.js +0 -31
@@ -1,259 +0,0 @@
1
- var bower = require('bower'),
2
- _ = require('lodash'),
3
- Q = require('q'),
4
- readline = require('readline'),
5
- endpointParser = require('bower-endpoint-parser'),
6
- semver = require('semver'),
7
- Plugin = require('../../Plugin'),
8
- InstallLog = require('./InstallLog'),
9
- Constants = require('../../Constants'),
10
- extend = require('./extend');
11
-
12
- var any = '*';
13
- var BOWER_MAX_TRY = 5;
14
-
15
- var InstallTarget = extend(Plugin, {
16
-
17
- constructor: function(name, requestedVersion, isCompatibleEnabled) {
18
- var endpoint = name+'#'+(isCompatibleEnabled ? any : requestedVersion),
19
- ep = endpointParser.decompose(endpoint),
20
- version = /^\*$/.test(ep.target) ? any : ep.target,
21
- proposal;
22
-
23
- Plugin.call(this, ep.name || ep.source, version);
24
-
25
- if (this.version !== any) {
26
- proposal = this.version;
27
- this._isConstrained = true;
28
- this.version = semver.validRange(proposal);
29
-
30
- if (!this.version) {
31
- throw new Error(this.packageName+' "'+proposal+'" is not a valid constraint');
32
- }
33
- }
34
-
35
- // the constraint given by the user
36
- this._requestedVersion = requestedVersion;
37
- // the result of the current query to the server
38
- this._rawInfo = undefined;
39
- // information about a particular version of the plugin
40
- this._versionInfo = undefined;
41
- // the number of attempts made to query the server
42
- this._bowerCmdCount = 0;
43
- // a list of tags denoting the versions of the plugin
44
- this._versions = undefined;
45
- // an index denoting which version is being queried
46
- this._versionIndex = 0;
47
- // whether querying the server for plugin information failed at all
48
- this._isMissingAtRepo = false;
49
- // the most recent version of the plugin compatible with the given framework
50
- this._latestCompatibleVersion = undefined;
51
- // the most recent version of the plugin
52
- this._latestVersion = undefined;
53
- // whether the user supplied a constraint that is not supported by the plugin
54
- this._isBadConstraint = false;
55
- // whether the constraint has been checked for compatibility
56
- this._constraintChecked = false;
57
- // a non-wildcard constraint resolved to the highest version of the plugin that satisfies the constraint and is compatible with the framework
58
- this._resolvedConstraint = undefined;
59
- // the version to be installed
60
- this._versionToInstall = undefined;
61
- },
62
-
63
- getInitialInfo: function() {
64
- return this.getInfo().then(_.bind(processInfo, this));
65
-
66
- function processInfo() {
67
- if (!this._isMissingAtRepo) {
68
- this._latestVersion = this._versionInfo.version;
69
-
70
- if (this._rawInfo.versions) {
71
- this._versions = this._rawInfo.versions;
72
- if (this._versions.length > 0) {
73
- // check if the user supplied a constraint that cannot be met
74
- this._isBadConstraint = semver.maxSatisfying(this._versions, this.version) === null;
75
- }
76
- }
77
- }
78
- }
79
- },
80
-
81
- getInfo: function(deferred) {
82
- // presence of deferred signifies a retry
83
- if (!deferred) this._bowerCmdCount = 0;
84
-
85
- deferred = deferred || Q.defer();
86
-
87
- try {
88
- var versionString = this._versions ? '#'+this._versions[this._versionIndex] : '';
89
- this._bowerCmdCount++;
90
- bower.commands.info(this.packageName+versionString, null, {registry:Constants.getRegistry(), cwd: Constants.cwd}).on('end', _.bind(onSuccess, this)).on('error', _.bind(onFail, this));
91
- } catch(err) {
92
- onFail.call(this, err);
93
- }
94
-
95
- function onSuccess(results) {
96
- this._rawInfo = results;
97
- this._versionInfo = results.latest || results;
98
- deferred.notify();
99
- deferred.resolve(results);
100
- }
101
-
102
- function onFail() {
103
- if (this._bowerCmdCount < BOWER_MAX_TRY) {
104
- this.getInfo(deferred);
105
- } else {
106
- this._isMissingAtRepo = true;
107
- deferred.notify();
108
- deferred.resolve();
109
- }
110
- }
111
-
112
- return deferred.promise;
113
- },
114
-
115
- findCompatibleVersion: function(framework) {
116
- if (this._isMissingAtRepo) return Q.resolve();
117
-
118
- // check if the latest version is compatible
119
- if (semver.satisfies(framework, this._versionInfo.framework)) {
120
- this._latestCompatibleVersion = this._versionInfo.version || '*';
121
- return Q.resolve();
122
- }
123
-
124
- // if the plugin has no tags then there are no other versions to check
125
- if (!this._versions || this._versions.length == 0) return Q.resolve();
126
-
127
- this._versionIndex = 0;
128
-
129
- return this.checkProposedVersion(framework);
130
- },
131
-
132
- checkConstraint: function(framework) {
133
- // check that the plugin exists
134
- if (this._isMissingAtRepo) {
135
- this._constraintChecked = true;
136
- //InstallLog.log(this.packageName, 'cannot resolve constraint due to missing info');
137
- return Q.resolve();
138
- }
139
-
140
- // check that there are other versions to be considered
141
- if (!this._versions || this._versions.length == 0) {
142
- this._constraintChecked = true;
143
- //InstallLog.log(this.packageName, 'cannot resolve constraint because there are no tags');
144
- return Q.resolve();
145
- }
146
-
147
- // check that a valid constraint exists
148
- if (this.version == any || this._isBadConstraint) {
149
- this._constraintChecked = true;
150
- //InstallLog.log(this.packageName, 'cannot resolve constraint because a valid constraint has not been given');
151
- return Q.resolve();
152
- }
153
-
154
- this._versionIndex = 0;
155
-
156
- return this.getInfo().then(_.bind(function() {
157
- return this.checkConstraintCompatibility(framework);
158
- }, this));
159
- },
160
-
161
- // find the highest version that satisfies the constraint and is compatible with the framework
162
- checkConstraintCompatibility: function(framework, deferred) {
163
- deferred = deferred || Q.defer();
164
-
165
- // give up if there is any failure to obtain version info
166
- if (this._isMissingAtRepo) {
167
- this._constraintChecked = true;
168
- //InstallLog.log(this.packageName, 'cannot resolve constraint due to missing info');
169
- deferred.notify();
170
- deferred.resolve();
171
- return deferred.promise;
172
- }
173
-
174
- //InstallLog.log(this.packageName, 'checking', this._versionInfo.version, 'against', this.version, 'framework', framework);
175
-
176
- // check if the version satisfies the constraint and whether the version is compatible
177
- if (semver.satisfies(this._versionInfo.version, this.version) && semver.satisfies(framework, this._versionInfo.framework)) {
178
- this._resolvedConstraint = this._versionInfo.version;
179
- this._constraintChecked = true;
180
- //InstallLog.log(this.packageName, 'resolved constraint to', this._resolvedConstraint);
181
- deferred.notify();
182
- deferred.resolve();
183
- } else {
184
- if (this._versionIndex + 1 < this._versions.length) {
185
- this._versionIndex++;
186
-
187
- this.getInfo().then(_.bind(function() {
188
- return this.checkConstraintCompatibility(framework, deferred);
189
- }, this));
190
-
191
- } else {
192
- this._resolvedConstraint = null;
193
- this._constraintChecked = true;
194
- //InstallLog.log(this.packageName, 'cannot resolve constraint');
195
- deferred.notify();
196
- deferred.resolve();
197
- }
198
- }
199
-
200
- return deferred.promise;
201
- },
202
-
203
- // find the highest version that is compatible with the framework
204
- checkProposedVersion: function(framework, deferred) {
205
- deferred = deferred || Q.defer();
206
-
207
- // give up if there is any failure to obtain version info
208
- if (this._isMissingAtRepo) {
209
- this._latestCompatibleVersion = null;
210
- deferred.notify();
211
- deferred.resolve();
212
- return deferred.promise;
213
- }
214
-
215
- // check that the proposed plugin is compatible with the installed framework
216
- if (semver.satisfies(framework, this._versionInfo.framework)) {
217
- this._latestCompatibleVersion = this._versionInfo.version;
218
- deferred.notify();
219
- deferred.resolve();
220
- } else {
221
- if (this._versionIndex + 1 < this._versions.length) {
222
- this._versionIndex++;
223
-
224
- this.getInfo().then(_.bind(function() {
225
- this.checkProposedVersion(framework, deferred);
226
- }, this));
227
-
228
- } else {
229
- this._latestCompatibleVersion = null;
230
- deferred.notify();
231
- deferred.resolve();
232
- }
233
- }
234
-
235
- return deferred.promise;
236
- },
237
-
238
- markRequestedForInstallation:function() {
239
- if (this._resolvedConstraint != undefined && this._resolvedConstraint != null) {
240
- this._versionToInstall = this._resolvedConstraint;
241
- } else {
242
- this._versionToInstall = semver.maxSatisfying(this._versions, this.version);
243
- }
244
- },
245
-
246
- markLatestCompatibleForInstallation:function() {
247
- this._versionToInstall = this._latestCompatibleVersion;
248
- },
249
-
250
- markLatestForInstallation:function() {
251
- this._versionToInstall = this._latestVersion;
252
- },
253
-
254
- logToConsole:function() {
255
- console.log(this.packageName, this.version, this._versionInfo ? this._versionInfo.framework : 'missing');
256
- }
257
- });
258
-
259
- module.exports = InstallTarget;
@@ -1,31 +0,0 @@
1
- // the Backbone extend function
2
-
3
- var _ = require('lodash');
4
-
5
- module.exports = function(superClass, protoProps, staticProps) {
6
- var parent = superClass;
7
- var child;
8
-
9
- // The constructor function for the new subclass is either defined by you
10
- // (the "constructor" property in your `extend` definition), or defaulted
11
- // by us to simply call the parent constructor.
12
- if (protoProps && _.has(protoProps, 'constructor')) {
13
- child = protoProps.constructor;
14
- } else {
15
- child = function(){ return parent.apply(this, arguments); };
16
- }
17
-
18
- // Add static properties to the constructor function, if supplied.
19
- _.extend(child, parent, staticProps);
20
-
21
- // Set the prototype chain to inherit from `parent`, without calling
22
- // `parent`'s constructor function and add the prototype properties.
23
- child.prototype = _.create(parent.prototype, protoProps);
24
- child.prototype.constructor = child;
25
-
26
- // Set a convenience property in case the parent's prototype is needed
27
- // later.
28
- child.__super__ = parent.prototype;
29
-
30
- return child;
31
- };
package/lib/download.js DELETED
@@ -1,101 +0,0 @@
1
- 'use strict';
2
-
3
- var decompress = require('decompress');
4
- var eachAsync = require('each-async');
5
- var fs = require('fs');
6
- var mkdir = require('mkdirp');
7
- var path = require('path');
8
- var request = require('request');
9
- var through = require('through2');
10
-
11
- /**
12
- * Download a file to a given destination
13
- *
14
- * Options:
15
- *
16
- * - `extract` Try extracting the file
17
- * - `mode` Set mode on the downloaded files
18
- * - `strip` Equivalent to --strip-components for tar
19
- *
20
- * @param {String|Array|Object} url
21
- * @param {String} dest
22
- * @param {Object} opts
23
- * @api public
24
- */
25
-
26
- module.exports = function (url, dest, opts) {
27
- url = Array.isArray(url) ? url : [url];
28
- opts = opts || {};
29
-
30
- var stream = through();
31
- var strip = opts.strip || '0';
32
- var target;
33
-
34
- eachAsync(url, function (url, index, done) {
35
- opts.url = url;
36
- target = path.join(dest, path.basename(url));
37
-
38
- if (url.url && url.name) {
39
- target = path.join(dest, url.name);
40
- opts.url = url.url;
41
- }
42
-
43
- var req = request.get(opts)
44
- .on('response', function (res) {
45
- stream.emit('response', res);
46
- })
47
- .on('data', function (data) {
48
- stream.emit('data', data);
49
- })
50
- .on('error', function (err) {
51
- stream.emit('error', err);
52
- });
53
-
54
- req.on('response', function (res) {
55
- var mime = res.headers['content-type'];
56
- var status = res.statusCode;
57
- var end;
58
-
59
- if (status < 200 || status >= 300) {
60
- stream.emit('error', status);
61
- return;
62
- }
63
-
64
- if (opts.extract && decompress.canExtract(url, mime)) {
65
- var ext;
66
-
67
- if (decompress.canExtract(url)) {
68
- ext = url;
69
- } else {
70
- ext = mime;
71
- }
72
-
73
- end = decompress.extract({
74
- ext: ext,
75
- path: dest,
76
- strip: strip
77
- });
78
- } else {
79
- if (!fs.existsSync(dest)) {
80
- mkdir.sync(dest);
81
- }
82
-
83
- end = fs.createWriteStream(target);
84
- }
85
-
86
- req.pipe(end);
87
-
88
- end.on('close', function () {
89
- if (!opts.extract && opts.mode) {
90
- fs.chmodSync(target, opts.mode);
91
- }
92
-
93
- done();
94
- });
95
- });
96
- }, function () {
97
- stream.emit('close');
98
- });
99
-
100
- return stream;
101
- };
package/lib/errors.js DELETED
@@ -1,58 +0,0 @@
1
- module.exports = {
2
- ERROR_COURSE_DIR: {
3
- code: 0,
4
- message: "Commands must be run in an Adapt project directory"
5
- },
6
- ERROR_INCOMPATIBLE_VALID_REQUEST: {
7
- code: 1,
8
- message: "No compatible version exists (requested version is valid)"
9
- },
10
- ERROR_INCOMPATIBLE_BAD_REQUEST: {
11
- code: 2,
12
- message: "No compatible version exists (requested version is invalid)"
13
- },
14
- ERROR_INCOMPATIBLE: {
15
- code: 3,
16
- message: "No compatible version exists"
17
- },
18
- ERROR_COMPATIBLE_INC_REQUEST: {
19
- code: 4,
20
- message: "Incompatible version requested (compatible version exists)"
21
- },
22
- ERROR_COMPATIBLE_BAD_REQUEST: {
23
- code: 5,
24
- message: "Requested version is invalid"
25
- },
26
- ERROR_UNINSTALL: {
27
- code: 6,
28
- message: "The plugin could not be uninstalled"
29
- },
30
- ERROR_NOT_FOUND: {
31
- code: 7,
32
- message: "The plugin could not be found"
33
- },
34
- ERROR_NOTHING_TO_UPDATE: {
35
- code: 8,
36
- message: "Could not resolve any plugins to update"
37
- },
38
- ERROR_UPDATE_INCOMPATIBLE: {
39
- code: 9,
40
- message: "Incompatible update requested"
41
- },
42
- ERROR_INSTALL_ERROR: {
43
- code: 10,
44
- message: "Unknown installation error"
45
- },
46
- ERROR_UPDATE_ERROR: {
47
- code: 11,
48
- message: "Unknown update error"
49
- },
50
- ERROR_NO_RELEASES: {
51
- code: 12,
52
- message: "No published releases"
53
- },
54
- ERROR_NO_UPDATE: {
55
- code: 13,
56
- message: "No update available"
57
- }
58
- }
@@ -1,58 +0,0 @@
1
- var bower = require('bower'),
2
- chalk = require('chalk'),
3
- inquirer = require('inquirer'),
4
- Q = require('q');
5
-
6
- module.exports = function(properties) {
7
- return Q.fcall(ask, properties).then(login);
8
- };
9
-
10
- function ask(properties) {
11
- var deferred = Q.defer();
12
- var schema = [
13
- {
14
- name: 'username',
15
- message: chalk.cyan('GitHub username')
16
- },
17
- {
18
- name: 'password',
19
- message: chalk.cyan('GitHub password'),
20
- type: 'password',
21
- mask: '*'
22
- }
23
- ];
24
- inquirer.prompt(schema).then(confirmation => {
25
- properties.username = confirmation.username;
26
- properties.password = confirmation.password;
27
- deferred.resolve(properties);
28
- }).catch(err => deferred.reject(err));
29
- return deferred.promise;
30
- }
31
-
32
- function login(properties) {
33
- var deferred = Q.defer();
34
-
35
- bower.commands.login(properties.repository, {interactive:true})
36
- .on('prompt', function (prompts, callback) {
37
- callback({
38
- username:properties.username,
39
- password:properties.password
40
- });
41
- })
42
- .on('end', function (result) {
43
- if (!result || !result.token) {
44
- deferred.reject();
45
- }
46
- else {
47
- //log('end', result);
48
- //log('token ',result.token);
49
- properties.token = result.token;
50
- deferred.resolve(properties);
51
- }
52
- })
53
- .on('error', function (err) {
54
- //log('login:error', err);
55
- deferred.reject(err);
56
- });
57
- return deferred.promise;
58
- }
@@ -1,20 +0,0 @@
1
- var Q = require('q'),
2
- chalk = require('chalk'),
3
- grunt = require('grunt');
4
-
5
- module.exports = function build(properties) {
6
- var deferred = Q.defer(),
7
- cwd = process.cwd();
8
-
9
-
10
-
11
- properties.renderer.log(chalk.cyan('running build'));
12
-
13
- grunt.loadTasks(properties.localDir);
14
-
15
- process.chdir(properties.localDir);
16
- grunt.task.run(['build']);
17
- process.chdir(cwd);
18
-
19
- return properties;
20
- };
@@ -1,35 +0,0 @@
1
- var Q = require('q'),
2
- PackageMeta = require('../PackageMeta'),
3
- path = require('path'),
4
- Plugin = require('../Plugin'),
5
- mkdirp = require('mkdirp'),
6
- exec = require('child_process').exec;
7
-
8
- module.exports = function cloneInstall(plugin, options) {
9
- var deferred = Q.defer();
10
-
11
- PackageMeta.getRepositoryUrl(plugin, options)
12
- .then(function(repoDetails) {
13
- if (!repoDetails) {
14
- console.log(plugin);
15
- throw "Error: Plugin repository url could not be found.";
16
- }
17
- mkdirp(path.resolve(options.localPath, options.directory), function (err) {
18
- if (err) {
19
- return deferred.reject(err);
20
- }
21
- var pluginPath = path.resolve(options.localPath, options.directory, plugin.name);
22
-
23
- var url = repoDetails.url.replace(/^git:\/\//, 'https://');
24
- exec(`git clone ${url} "${pluginPath}"`);
25
- });
26
- })
27
- .then(function(repo){
28
- deferred.resolve(plugin)
29
- })
30
- .fail(function(err) {
31
- deferred.reject(err);
32
- })
33
- .done();
34
- return deferred.promise;
35
- };
@@ -1,6 +0,0 @@
1
- var Q = requie('q'),
2
- build = require('./build');
3
-
4
- module.exports = function () {
5
-
6
- };
@@ -1,39 +0,0 @@
1
- var spawn = require("child_process").spawn;
2
- var Q = require("q");
3
-
4
- /**
5
- * Wrap executing a command in a promise
6
- * @param {string} command command to execute
7
- * @param {Array<string>} args Arguments to the command.
8
- * @param {string} cwd The working directory to run the command in.
9
- * @return {Promise} A promise for the completion of the command.
10
- */
11
- module.exports = function exec(command, args, cwd) {
12
- if (!command || !cwd) {
13
- return Q.reject(new Error("Both command and working directory must be given, not " + command + " and " + cwd));
14
- }
15
- if (args && !args.every(function (arg) {
16
- var type = typeof arg;
17
- return type === "boolean" || type === "string" || type === "number";
18
- })) {
19
- return Q.reject(new Error("All arguments must be a boolean, string or number"));
20
- }
21
-
22
- var deferred = Q.defer();
23
-
24
- var proc = spawn(command, args, {
25
- cwd: cwd,
26
- stdio: global.DEBUG ? "inherit" : "ignore"
27
- });
28
- proc.on("error", function (error) {
29
- deferred.reject(new Error(command + " " + args.join(" ") + " in " + cwd + " encountered error " + error.message));
30
- });
31
- proc.on("exit", function(code) {
32
- if (code !== 0) {
33
- deferred.reject(new Error(command + " " + args.join(" ") + " in " + cwd + " exited with code " + code));
34
- } else {
35
- deferred.resolve();
36
- }
37
- });
38
- return deferred.promise;
39
- };
@@ -1,26 +0,0 @@
1
- var RepositoryDownloader = require('../RepositoryDownloader'),
2
- uuid = require('uuid'),
3
- fs = require('q-io/fs'),
4
- path = require('path'),
5
- Constants = require('../Constants');
6
-
7
- module.exports = function (properties) {
8
- var downloader = new RepositoryDownloader({
9
- repository: properties.repository || Constants.FrameworkRepository,
10
- branch : properties.branch
11
- }),
12
- tmp = properties.tmp = path.join(Constants.HomeDirectory, '.adapt', 'tmp', uuid.v1());
13
-
14
- return downloader.fetch(tmp)
15
- .then(function (fileName) {
16
- return fs.copyTree(getDownloadedSourcePath(properties, fileName), properties.localDir)
17
- .then(function () {
18
- return properties;
19
- });
20
- });
21
- };
22
-
23
- function getDownloadedSourcePath(properties, fileName) {
24
- var fName = fileName ? fs.base(fileName, fs.extension(fileName)) : ((properties.repositoryName || Constants.FrameworkRepositoryName) + '-' + properties.branch);
25
- return path.join(properties.tmp, fName);
26
- }