-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeployments.dart
More file actions
62 lines (54 loc) · 1.63 KB
/
deployments.dart
File metadata and controls
62 lines (54 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import 'dart:io';
import 'package:raygun_cli/deployments/deployments_api.dart';
import 'package:args/args.dart';
import '../config_props.dart';
class Deployments {
final ArgResults command;
final bool verbose;
Deployments({
required this.command,
required this.verbose,
});
Future<void> notify() async {
if (!command.wasParsed('version')) {
print('Error: Missing "--version"');
print(' Please provide "--version" via argument');
exit(2);
}
final version = command.option('version') as String;
final ownerName = command.option('owner-name');
final emailAddress = command.option('email-address');
final comment = command.option('comment');
final scmIdentifier = command.option('scm-identifier');
final scmType = command.option('scm-type');
final apiKey = ConfigProp.apiKey.load(command);
final token = ConfigProp.token.load(command);
if (verbose) {
print('token: $token');
print('api-key: $apiKey');
print('version: $version');
print('owner-name: $ownerName');
print('email-address: $emailAddress');
print('comment: $comment');
print('scm-identifier: $scmIdentifier');
print('scm-type: $scmType');
}
final success = await createDeployment(
token: token,
apiKey: apiKey,
version: version,
ownerName: ownerName,
emailAddress: emailAddress,
comment: comment,
scmIdentifier: scmIdentifier,
scmType: scmType,
);
if (success) {
print('Deployment created successfully');
exit(0);
} else {
print('Failed to create deployment');
exit(2);
}
}
}