@appcircle/codepush-cli 0.0.3-alpha.1 → 0.0.3

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.
@@ -69,51 +69,6 @@ const confirm = (message = "Are you sure?") => {
69
69
  });
70
70
  };
71
71
  exports.confirm = confirm;
72
- function accessKeyAdd(command) {
73
- return exports.sdk.addAccessKey(command.name, command.ttl).then((accessKey) => {
74
- (0, exports.log)(`Successfully created the "${command.name}" access key: ${accessKey.key}`);
75
- (0, exports.log)("Make sure to save this key value somewhere safe, since you won't be able to view it from the CLI again!");
76
- });
77
- }
78
- function accessKeyPatch(command) {
79
- const willUpdateName = isCommandOptionSpecified(command.newName) && command.oldName !== command.newName;
80
- const willUpdateTtl = isCommandOptionSpecified(command.ttl);
81
- if (!willUpdateName && !willUpdateTtl) {
82
- throw new Error("A new name and/or TTL must be provided.");
83
- }
84
- return exports.sdk.patchAccessKey(command.oldName, command.newName, command.ttl).then((accessKey) => {
85
- let logMessage = "Successfully ";
86
- if (willUpdateName) {
87
- logMessage += `renamed the access key "${command.oldName}" to "${command.newName}"`;
88
- }
89
- if (willUpdateTtl) {
90
- const expirationDate = moment(accessKey.expires).format("LLLL");
91
- if (willUpdateName) {
92
- logMessage += ` and changed its expiration date to ${expirationDate}`;
93
- }
94
- else {
95
- logMessage += `changed the expiration date of the "${command.oldName}" access key to ${expirationDate}`;
96
- }
97
- }
98
- (0, exports.log)(`${logMessage}.`);
99
- });
100
- }
101
- function accessKeyList(command) {
102
- throwForInvalidOutputFormat(command.format);
103
- return exports.sdk.getAccessKeys().then((accessKeys) => {
104
- printAccessKeys(command.format, accessKeys);
105
- });
106
- }
107
- function accessKeyRemove(command) {
108
- return (0, exports.confirm)().then((wasConfirmed) => {
109
- if (wasConfirmed) {
110
- return exports.sdk.removeAccessKey(command.accessKey).then(() => {
111
- (0, exports.log)(`Successfully removed the "${command.accessKey}" access key.`);
112
- });
113
- }
114
- (0, exports.log)("Access key removal cancelled.");
115
- });
116
- }
117
72
  function appAdd(command) {
118
73
  return exports.sdk.addApp(command.appName).then((app) => {
119
74
  (0, exports.log)('Successfully added the "' + command.appName + '" app, along with the following default deployments:');
@@ -342,14 +297,6 @@ function execute(command) {
342
297
  switch (command.type) {
343
298
  // Must not be logged in
344
299
  case cli.CommandType.login:
345
- case cli.CommandType.register:
346
- if (connectionInfo) {
347
- throw new Error("You are already logged in from this machine.");
348
- }
349
- break;
350
- // It does not matter whether you are logged in or not
351
- case cli.CommandType.link:
352
- break;
353
300
  // Must be logged in
354
301
  default:
355
302
  if (!!exports.sdk)
@@ -361,14 +308,6 @@ function execute(command) {
361
308
  break;
362
309
  }
363
310
  switch (command.type) {
364
- case cli.CommandType.accessKeyAdd:
365
- return accessKeyAdd(command);
366
- case cli.CommandType.accessKeyPatch:
367
- return accessKeyPatch(command);
368
- case cli.CommandType.accessKeyList:
369
- return accessKeyList(command);
370
- case cli.CommandType.accessKeyRemove:
371
- return accessKeyRemove(command);
372
311
  case cli.CommandType.appAdd:
373
312
  return appAdd(command);
374
313
  case cli.CommandType.appList:
@@ -393,8 +332,6 @@ function execute(command) {
393
332
  return deploymentRemove(command);
394
333
  case cli.CommandType.deploymentRename:
395
334
  return deploymentRename(command);
396
- case cli.CommandType.link:
397
- return link(command);
398
335
  case cli.CommandType.login:
399
336
  return login(command);
400
337
  case cli.CommandType.logout:
@@ -403,18 +340,12 @@ function execute(command) {
403
340
  return patch(command);
404
341
  case cli.CommandType.promote:
405
342
  return promote(command);
406
- case cli.CommandType.register:
407
- return register(command);
408
343
  case cli.CommandType.release:
409
344
  return (0, exports.release)(command);
410
345
  case cli.CommandType.releaseReact:
411
346
  return (0, exports.releaseReact)(command);
412
347
  case cli.CommandType.rollback:
413
348
  return rollback(command);
414
- case cli.CommandType.sessionList:
415
- return sessionList(command);
416
- case cli.CommandType.sessionRemove:
417
- return sessionRemove(command);
418
349
  default:
419
350
  // We should never see this message as invalid commands should be caught by the argument parser.
420
351
  throw new Error("Invalid command: " + JSON.stringify(command));
@@ -32,65 +32,6 @@ function showHelp(showRootDescription) {
32
32
  }
33
33
  }
34
34
  exports.showHelp = showHelp;
35
- function accessKeyAdd(commandName, yargs) {
36
- isValidCommand = true;
37
- yargs
38
- .usage(USAGE_PREFIX + " access-key " + commandName + " <accessKeyName>")
39
- .demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
40
- .example("access-key " + commandName + ' "VSTS Integration"', 'Creates a new access key with the name "VSTS Integration", which expires in 60 days')
41
- .example("access-key " + commandName + ' "One time key" --ttl 5m', 'Creates a new access key with the name "One time key", which expires in 5 minutes')
42
- .option("ttl", {
43
- default: "60d",
44
- demand: false,
45
- description: "Duration string which specifies the amount of time that the access key should remain valid for (e.g 5m, 60d, 1y)",
46
- type: "string",
47
- });
48
- addCommonConfiguration(yargs);
49
- }
50
- function accessKeyPatch(commandName, yargs) {
51
- isValidCommand = true;
52
- yargs
53
- .usage(USAGE_PREFIX + " access-key " + commandName + " <accessKeyName>")
54
- .demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
55
- .example("access-key " + commandName + ' "Key for build server" --name "Key for CI machine"', 'Renames the access key named "Key for build server" to "Key for CI machine"')
56
- .example("access-key " + commandName + ' "Key for build server" --ttl 7d', 'Updates the access key named "Key for build server" to expire in 7 days')
57
- .option("name", {
58
- default: null,
59
- demand: false,
60
- description: "Display name for the access key",
61
- type: "string",
62
- })
63
- .option("ttl", {
64
- default: null,
65
- demand: false,
66
- description: "Duration string which specifies the amount of time that the access key should remain valid for (e.g 5m, 60d, 1y)",
67
- type: "string",
68
- });
69
- addCommonConfiguration(yargs);
70
- }
71
- function accessKeyList(commandName, yargs) {
72
- isValidCommand = true;
73
- yargs
74
- .usage(USAGE_PREFIX + " access-key " + commandName + " [options]")
75
- .demand(/*count*/ 0, /*max*/ 0)
76
- .example("access-key " + commandName, "Lists your access keys in tabular format")
77
- .example("access-key " + commandName + " --format json", "Lists your access keys in JSON format")
78
- .option("format", {
79
- default: "table",
80
- demand: false,
81
- description: 'Output format to display your access keys with ("json" or "table")',
82
- type: "string",
83
- });
84
- addCommonConfiguration(yargs);
85
- }
86
- function accessKeyRemove(commandName, yargs) {
87
- isValidCommand = true;
88
- yargs
89
- .usage(USAGE_PREFIX + " access-key " + commandName + " <accessKeyName>")
90
- .demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
91
- .example("access-key " + commandName + ' "VSTS Integration"', 'Removes the "VSTS Integration" access key');
92
- addCommonConfiguration(yargs);
93
- }
94
35
  function addCommonConfiguration(yargs) {
95
36
  yargs
96
37
  .wrap(/*columnLimit*/ null)
@@ -151,29 +92,6 @@ function removeCollaborator(commandName, yargs) {
151
92
  .example("collaborator " + commandName + " MyApp foo@bar.com", 'Removes foo@bar.com as a collaborator from app "MyApp"');
152
93
  addCommonConfiguration(yargs);
153
94
  }
154
- function sessionList(commandName, yargs) {
155
- isValidCommand = true;
156
- yargs
157
- .usage(USAGE_PREFIX + " session " + commandName + " [options]")
158
- .demand(/*count*/ 0, /*max*/ 0)
159
- .example("session " + commandName, "Lists your sessions in tabular format")
160
- .example("session " + commandName + " --format json", "Lists your login sessions in JSON format")
161
- .option("format", {
162
- default: "table",
163
- demand: false,
164
- description: 'Output format to display your login sessions with ("json" or "table")',
165
- type: "string",
166
- });
167
- addCommonConfiguration(yargs);
168
- }
169
- function sessionRemove(commandName, yargs) {
170
- isValidCommand = true;
171
- yargs
172
- .usage(USAGE_PREFIX + " session " + commandName + " <machineName>")
173
- .demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
174
- .example("session " + commandName + ' "John\'s PC"', 'Removes the existing login session from "John\'s PC"');
175
- addCommonConfiguration(yargs);
176
- }
177
95
  function deploymentHistoryClear(commandName, yargs) {
178
96
  isValidCommand = true;
179
97
  yargs
@@ -237,20 +155,6 @@ function deploymentHistory(commandName, yargs) {
237
155
  yargs
238
156
  .usage(USAGE_PREFIX + " <command>")
239
157
  .demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option argument.
240
- .command("access-key", "View and manage the access keys associated with your account", (yargs) => {
241
- isValidCommandCategory = true;
242
- yargs
243
- .usage(USAGE_PREFIX + " access-key <command>")
244
- .demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments.
245
- .command("add", "Create a new access key associated with your account", (yargs) => accessKeyAdd("add", yargs))
246
- .command("patch", "Update the name and/or TTL of an existing access key", (yargs) => accessKeyPatch("patch", yargs))
247
- .command("remove", "Remove an existing access key", (yargs) => accessKeyRemove("remove", yargs))
248
- .command("rm", "Remove an existing access key", (yargs) => accessKeyRemove("rm", yargs))
249
- .command("list", "List the access keys associated with your account", (yargs) => accessKeyList("list", yargs))
250
- .command("ls", "List the access keys associated with your account", (yargs) => accessKeyList("ls", yargs))
251
- .check((argv, aliases) => isValidCommand); // Report unrecognized, non-hyphenated command category.
252
- addCommonConfiguration(yargs);
253
- })
254
158
  .command("app", "View and manage your CodePush apps", (yargs) => {
255
159
  isValidCommandCategory = true;
256
160
  yargs
@@ -335,16 +239,6 @@ yargs
335
239
  .command("h", "Display the release history for a deployment", (yargs) => deploymentHistory("h", yargs))
336
240
  .check((argv, aliases) => isValidCommand); // Report unrecognized, non-hyphenated command category.
337
241
  addCommonConfiguration(yargs);
338
- })
339
- .command("link", "Link an additional authentication provider (e.g. GitHub) to an existing CodePush account", (yargs) => {
340
- isValidCommandCategory = true;
341
- isValidCommand = true;
342
- yargs
343
- .usage(USAGE_PREFIX + " link")
344
- .demand(/*count*/ 0, /*max*/ 1) //set 'max' to one to allow usage of serverUrl undocument parameter for testing
345
- .example("link", "Links an account on the CodePush server")
346
- .check((argv, aliases) => isValidCommand); // Report unrecognized, non-hyphenated command category.
347
- addCommonConfiguration(yargs);
348
242
  })
349
243
  .command("login", "Authenticate with the CodePush server in order to begin managing your apps", (yargs) => {
350
244
  isValidCommandCategory = true;
@@ -498,16 +392,6 @@ yargs
498
392
  return isValidRollout(argv);
499
393
  });
500
394
  addCommonConfiguration(yargs);
501
- })
502
- .command("register", "Register a new CodePush account", (yargs) => {
503
- isValidCommandCategory = true;
504
- isValidCommand = true;
505
- yargs
506
- .usage(USAGE_PREFIX + " register")
507
- .demand(/*count*/ 0, /*max*/ 1) //set 'max' to one to allow usage of serverUrl undocument parameter for testing
508
- .example("register", "Registers a new CodePush account")
509
- .check((argv, aliases) => isValidCommand); // Report unrecognized, non-hyphenated command category.
510
- addCommonConfiguration(yargs);
511
395
  })
512
396
  .command("release", "Release an update to an app deployment", (yargs) => {
513
397
  yargs
@@ -738,18 +622,6 @@ yargs
738
622
  type: "string",
739
623
  });
740
624
  addCommonConfiguration(yargs);
741
- })
742
- .command("session", "View and manage the current login sessions associated with your account", (yargs) => {
743
- isValidCommandCategory = true;
744
- yargs
745
- .usage(USAGE_PREFIX + " session <command>")
746
- .demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments.
747
- .command("remove", "Remove an existing login session", (yargs) => sessionRemove("remove", yargs))
748
- .command("rm", "Remove an existing login session", (yargs) => sessionRemove("rm", yargs))
749
- .command("list", "List the current login sessions associated with your account", (yargs) => sessionList("list", yargs))
750
- .command("ls", "List the current login sessions associated with your account", (yargs) => sessionList("ls", yargs))
751
- .check((argv, aliases) => isValidCommand); // Report unrecognized, non-hyphenated command category.
752
- addCommonConfiguration(yargs);
753
625
  })
754
626
  .alias("v", "version")
755
627
  .version(packageJson.version)
@@ -766,48 +638,6 @@ function createCommand() {
766
638
  const arg3 = argv._[3];
767
639
  const arg4 = argv._[4];
768
640
  switch (arg0) {
769
- case "access-key":
770
- switch (arg1) {
771
- case "add":
772
- if (arg2) {
773
- cmd = { type: cli.CommandType.accessKeyAdd };
774
- const accessKeyAddCmd = cmd;
775
- accessKeyAddCmd.name = arg2;
776
- const ttlOption = argv["ttl"];
777
- if (isDefined(ttlOption)) {
778
- accessKeyAddCmd.ttl = parseDurationMilliseconds(ttlOption);
779
- }
780
- }
781
- break;
782
- case "patch":
783
- if (arg2) {
784
- cmd = { type: cli.CommandType.accessKeyPatch };
785
- const accessKeyPatchCmd = cmd;
786
- accessKeyPatchCmd.oldName = arg2;
787
- const newNameOption = argv["name"];
788
- const ttlOption = argv["ttl"];
789
- if (isDefined(newNameOption)) {
790
- accessKeyPatchCmd.newName = newNameOption;
791
- }
792
- if (isDefined(ttlOption)) {
793
- accessKeyPatchCmd.ttl = parseDurationMilliseconds(ttlOption);
794
- }
795
- }
796
- break;
797
- case "list":
798
- case "ls":
799
- cmd = { type: cli.CommandType.accessKeyList };
800
- cmd.format = argv["format"];
801
- break;
802
- case "remove":
803
- case "rm":
804
- if (arg2) {
805
- cmd = { type: cli.CommandType.accessKeyRemove };
806
- cmd.accessKey = arg2;
807
- }
808
- break;
809
- }
810
- break;
811
641
  case "app":
812
642
  switch (arg1) {
813
643
  case "add":
@@ -910,12 +740,6 @@ function createCommand() {
910
740
  break;
911
741
  }
912
742
  break;
913
- case "link":
914
- cmd = {
915
- type: cli.CommandType.link,
916
- serverUrl: getServerUrl(arg1),
917
- };
918
- break;
919
743
  case "login":
920
744
  cmd = { type: cli.CommandType.login };
921
745
  const loginCommand = cmd;
@@ -957,11 +781,6 @@ function createCommand() {
957
781
  deploymentPromoteCommand.appStoreVersion = argv["targetBinaryVersion"];
958
782
  }
959
783
  break;
960
- case "register":
961
- cmd = { type: cli.CommandType.register };
962
- const registerCommand = cmd;
963
- registerCommand.serverUrl = getServerUrl(arg1);
964
- break;
965
784
  case "release":
966
785
  if (arg1 && arg2 && arg3) {
967
786
  cmd = { type: cli.CommandType.release };
@@ -1016,22 +835,6 @@ function createCommand() {
1016
835
  rollbackCommand.targetRelease = argv["targetRelease"];
1017
836
  }
1018
837
  break;
1019
- case "session":
1020
- switch (arg1) {
1021
- case "list":
1022
- case "ls":
1023
- cmd = { type: cli.CommandType.sessionList };
1024
- cmd.format = argv["format"];
1025
- break;
1026
- case "remove":
1027
- case "rm":
1028
- if (arg2) {
1029
- cmd = { type: cli.CommandType.sessionRemove };
1030
- cmd.machineName = arg2;
1031
- }
1032
- break;
1033
- }
1034
- break;
1035
838
  }
1036
839
  return cmd;
1037
840
  }
@@ -5,32 +5,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.CommandType = void 0;
6
6
  var CommandType;
7
7
  (function (CommandType) {
8
- CommandType[CommandType["accessKeyAdd"] = 0] = "accessKeyAdd";
9
- CommandType[CommandType["accessKeyPatch"] = 1] = "accessKeyPatch";
10
- CommandType[CommandType["accessKeyList"] = 2] = "accessKeyList";
11
- CommandType[CommandType["accessKeyRemove"] = 3] = "accessKeyRemove";
12
- CommandType[CommandType["appAdd"] = 4] = "appAdd";
13
- CommandType[CommandType["appList"] = 5] = "appList";
14
- CommandType[CommandType["appDeploymentKeyList"] = 6] = "appDeploymentKeyList";
15
- CommandType[CommandType["appRemove"] = 7] = "appRemove";
16
- CommandType[CommandType["appRename"] = 8] = "appRename";
17
- CommandType[CommandType["debug"] = 9] = "debug";
18
- CommandType[CommandType["deploymentAdd"] = 10] = "deploymentAdd";
19
- CommandType[CommandType["deploymentHistory"] = 11] = "deploymentHistory";
20
- CommandType[CommandType["deploymentHistoryClear"] = 12] = "deploymentHistoryClear";
21
- CommandType[CommandType["deploymentList"] = 13] = "deploymentList";
22
- CommandType[CommandType["deploymentMetrics"] = 14] = "deploymentMetrics";
23
- CommandType[CommandType["deploymentRemove"] = 15] = "deploymentRemove";
24
- CommandType[CommandType["deploymentRename"] = 16] = "deploymentRename";
25
- CommandType[CommandType["link"] = 17] = "link";
26
- CommandType[CommandType["login"] = 18] = "login";
27
- CommandType[CommandType["logout"] = 19] = "logout";
28
- CommandType[CommandType["patch"] = 20] = "patch";
29
- CommandType[CommandType["promote"] = 21] = "promote";
30
- CommandType[CommandType["register"] = 22] = "register";
31
- CommandType[CommandType["release"] = 23] = "release";
32
- CommandType[CommandType["releaseReact"] = 24] = "releaseReact";
33
- CommandType[CommandType["rollback"] = 25] = "rollback";
34
- CommandType[CommandType["sessionList"] = 26] = "sessionList";
35
- CommandType[CommandType["sessionRemove"] = 27] = "sessionRemove";
8
+ CommandType[CommandType["appAdd"] = 0] = "appAdd";
9
+ CommandType[CommandType["appList"] = 1] = "appList";
10
+ CommandType[CommandType["appDeploymentKeyList"] = 2] = "appDeploymentKeyList";
11
+ CommandType[CommandType["appRemove"] = 3] = "appRemove";
12
+ CommandType[CommandType["appRename"] = 4] = "appRename";
13
+ CommandType[CommandType["debug"] = 5] = "debug";
14
+ CommandType[CommandType["deploymentAdd"] = 6] = "deploymentAdd";
15
+ CommandType[CommandType["deploymentHistory"] = 7] = "deploymentHistory";
16
+ CommandType[CommandType["deploymentHistoryClear"] = 8] = "deploymentHistoryClear";
17
+ CommandType[CommandType["deploymentList"] = 9] = "deploymentList";
18
+ CommandType[CommandType["deploymentMetrics"] = 10] = "deploymentMetrics";
19
+ CommandType[CommandType["deploymentRemove"] = 11] = "deploymentRemove";
20
+ CommandType[CommandType["deploymentRename"] = 12] = "deploymentRename";
21
+ CommandType[CommandType["login"] = 13] = "login";
22
+ CommandType[CommandType["logout"] = 14] = "logout";
23
+ CommandType[CommandType["patch"] = 15] = "patch";
24
+ CommandType[CommandType["promote"] = 16] = "promote";
25
+ CommandType[CommandType["release"] = 17] = "release";
26
+ CommandType[CommandType["releaseReact"] = 18] = "releaseReact";
27
+ CommandType[CommandType["rollback"] = 19] = "rollback";
36
28
  })(CommandType || (exports.CommandType = CommandType = {}));
package/bin/test/cli.js CHANGED
@@ -256,138 +256,6 @@ describe("CLI", () => {
256
256
  afterEach(() => {
257
257
  sandbox.restore();
258
258
  });
259
- it("accessKeyAdd creates access key with name and default ttl", (done) => {
260
- var command = {
261
- type: cli.CommandType.accessKeyAdd,
262
- name: "Test name",
263
- };
264
- cmdexec.execute(command).done(() => {
265
- sinon.assert.calledTwice(log);
266
- assert.equal(log.args[0].length, 1);
267
- var actual = log.args[0][0];
268
- var expected = `Successfully created the "Test name" access key: key123`;
269
- assert.equal(actual, expected);
270
- actual = log.args[1][0];
271
- expected = "Make sure to save this key value somewhere safe, since you won't be able to view it from the CLI again!";
272
- assert.equal(actual, expected);
273
- done();
274
- });
275
- });
276
- it("accessKeyAdd creates access key with name and specified ttl", (done) => {
277
- var ttl = 10000;
278
- var command = {
279
- type: cli.CommandType.accessKeyAdd,
280
- name: "Test name",
281
- ttl,
282
- };
283
- cmdexec.execute(command).done(() => {
284
- sinon.assert.calledTwice(log);
285
- assert.equal(log.args[0].length, 1);
286
- var actual = log.args[0][0];
287
- var expected = `Successfully created the "Test name" access key: key123`;
288
- assert.equal(actual, expected);
289
- actual = log.args[1][0];
290
- expected = "Make sure to save this key value somewhere safe, since you won't be able to view it from the CLI again!";
291
- assert.equal(actual, expected);
292
- done();
293
- });
294
- });
295
- it("accessKeyPatch updates access key with new name", (done) => {
296
- var command = {
297
- type: cli.CommandType.accessKeyPatch,
298
- oldName: "Test name",
299
- newName: "Updated name",
300
- };
301
- cmdexec.execute(command).done(() => {
302
- sinon.assert.calledOnce(log);
303
- assert.equal(log.args[0].length, 1);
304
- var actual = log.args[0][0];
305
- var expected = `Successfully renamed the access key "Test name" to "Updated name".`;
306
- assert.equal(actual, expected);
307
- done();
308
- });
309
- });
310
- it("accessKeyPatch updates access key with new ttl", (done) => {
311
- var ttl = 10000;
312
- var command = {
313
- type: cli.CommandType.accessKeyPatch,
314
- oldName: "Test name",
315
- ttl,
316
- };
317
- cmdexec.execute(command).done(() => {
318
- sinon.assert.calledOnce(log);
319
- assert.equal(log.args[0].length, 1);
320
- var actual = log.args[0][0];
321
- var expected = `Successfully changed the expiration date of the "Test name" access key to Wednesday, August 17, 2016 12:07 PM.`;
322
- assert.equal(actual, expected);
323
- done();
324
- });
325
- });
326
- it("accessKeyPatch updates access key with new name and ttl", (done) => {
327
- var ttl = 10000;
328
- var command = {
329
- type: cli.CommandType.accessKeyPatch,
330
- oldName: "Test name",
331
- newName: "Updated name",
332
- ttl,
333
- };
334
- cmdexec.execute(command).done(() => {
335
- sinon.assert.calledOnce(log);
336
- assert.equal(log.args[0].length, 1);
337
- var actual = log.args[0][0];
338
- var expected = `Successfully renamed the access key "Test name" to "Updated name" and changed its expiration date to Wednesday, August 17, 2016 12:07 PM.`;
339
- assert.equal(actual, expected);
340
- done();
341
- });
342
- });
343
- it("accessKeyList lists access key name and expires fields", (done) => {
344
- var command = {
345
- type: cli.CommandType.accessKeyList,
346
- format: "json",
347
- };
348
- cmdexec.execute(command).done(() => {
349
- sinon.assert.calledOnce(log);
350
- assert.equal(log.args[0].length, 1);
351
- var actual = log.args[0][0];
352
- var expected = [
353
- {
354
- createdTime: 0,
355
- name: "Test name",
356
- expires: NOW + DEFAULT_ACCESS_KEY_MAX_AGE,
357
- },
358
- ];
359
- assertJsonDescribesObject(actual, expected);
360
- done();
361
- });
362
- });
363
- it("accessKeyRemove removes access key", (done) => {
364
- var command = {
365
- type: cli.CommandType.accessKeyRemove,
366
- accessKey: "8",
367
- };
368
- var removeAccessKey = sandbox.spy(cmdexec.sdk, "removeAccessKey");
369
- cmdexec.execute(command).done(() => {
370
- sinon.assert.calledOnce(removeAccessKey);
371
- sinon.assert.calledWithExactly(removeAccessKey, "8");
372
- sinon.assert.calledOnce(log);
373
- sinon.assert.calledWithExactly(log, 'Successfully removed the "8" access key.');
374
- done();
375
- });
376
- });
377
- it("accessKeyRemove does not remove access key if cancelled", (done) => {
378
- var command = {
379
- type: cli.CommandType.accessKeyRemove,
380
- accessKey: "8",
381
- };
382
- var removeAccessKey = sandbox.spy(cmdexec.sdk, "removeAccessKey");
383
- wasConfirmed = false;
384
- cmdexec.execute(command).done(() => {
385
- sinon.assert.notCalled(removeAccessKey);
386
- sinon.assert.calledOnce(log);
387
- sinon.assert.calledWithExactly(log, "Access key removal cancelled.");
388
- done();
389
- });
390
- });
391
259
  it("appAdd reports new app name and ID", (done) => {
392
260
  var command = {
393
261
  type: cli.CommandType.appAdd,
@@ -1202,72 +1070,6 @@ describe("CLI", () => {
1202
1070
  })
1203
1071
  .done();
1204
1072
  });
1205
- it("sessionList lists session name and expires fields", (done) => {
1206
- var command = {
1207
- type: cli.CommandType.sessionList,
1208
- format: "json",
1209
- };
1210
- cmdexec.execute(command).done(() => {
1211
- sinon.assert.calledOnce(log);
1212
- assert.equal(log.args[0].length, 1);
1213
- var actual = log.args[0][0];
1214
- var expected = [
1215
- {
1216
- loggedInTime: 0,
1217
- machineName: TEST_MACHINE_NAME,
1218
- },
1219
- ];
1220
- assertJsonDescribesObject(actual, expected);
1221
- done();
1222
- });
1223
- });
1224
- it("sessionRemove removes session", (done) => {
1225
- var machineName = TEST_MACHINE_NAME;
1226
- var command = {
1227
- type: cli.CommandType.sessionRemove,
1228
- machineName: machineName,
1229
- };
1230
- var removeSession = sandbox.spy(cmdexec.sdk, "removeSession");
1231
- cmdexec.execute(command).done(() => {
1232
- sinon.assert.calledOnce(removeSession);
1233
- sinon.assert.calledWithExactly(removeSession, machineName);
1234
- sinon.assert.calledOnce(log);
1235
- sinon.assert.calledWithExactly(log, `Successfully removed the login session for "${machineName}".`);
1236
- done();
1237
- });
1238
- });
1239
- it("sessionRemove does not remove session if cancelled", (done) => {
1240
- var machineName = TEST_MACHINE_NAME;
1241
- var command = {
1242
- type: cli.CommandType.sessionRemove,
1243
- machineName: machineName,
1244
- };
1245
- var removeSession = sandbox.spy(cmdexec.sdk, "removeSession");
1246
- wasConfirmed = false;
1247
- cmdexec.execute(command).done(() => {
1248
- sinon.assert.notCalled(removeSession);
1249
- sinon.assert.calledOnce(log);
1250
- sinon.assert.calledWithExactly(log, "Session removal cancelled.");
1251
- done();
1252
- });
1253
- });
1254
- it("sessionRemove does not remove current session", (done) => {
1255
- var machineName = os.hostname();
1256
- var command = {
1257
- type: cli.CommandType.sessionRemove,
1258
- machineName: machineName,
1259
- };
1260
- wasConfirmed = false;
1261
- cmdexec
1262
- .execute(command)
1263
- .then(() => {
1264
- done(new Error("Did not throw error."));
1265
- })
1266
- .catch(() => {
1267
- done();
1268
- })
1269
- .done();
1270
- });
1271
1073
  function releaseHelperFunction(command, done, expectedError) {
1272
1074
  cmdexec.execute(command).done(() => {
1273
1075
  throw "Error Expected";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcircle/codepush-cli",
3
- "version": "0.0.3-alpha.1",
3
+ "version": "0.0.3",
4
4
  "description": "Management CLI for the CodePush service",
5
5
  "main": "./script/cli.js",
6
6
  "scripts": {