Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModuleConfig.cfc
More file actions
Latest commit
72 lines (52 loc) · 2.4 KB
/
Copy pathModuleConfig.cfc
File metadata and controls
72 lines (52 loc) · 2.4 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
63
64
65
66
67
68
69
70
71
72
component {
functionconfigure() {
settings= {
// Turn the entire module on/off
'enable':true,
// Turn the CLI check on/off
'CLIcheck':true,
// Turn the system modules check on/off
'systemModulesCheck':true,
// Follow the CommandBox bleeding edge
'latest':false
};
}
functiononCLIStart( interceptData ) {
varcr=chr( 10 );
try {
// Only run for interactive shell
if( interceptData.shellType=='interactive'&&isBoolean( settings.enable ) &&settings.enable ) {
// Abort if there is a dateLastChecked setting, it's a date, and it's within the last day
if( !isNull( settings.dateLastChecked ) &&isDate( settings.dateLastChecked ) &&dateDiff( 'd', settings.dateLastChecked, now() ) <1 ) {
return;
}
if( wirebox.getInstance( 'configService' ).getSetting( 'offlineMode', false ) ) {
shell.printString( 'CommandBox is in offline mode, skipping update checks.'&cr );
return;
}
if( isBoolean( settings.CLIcheck ) &&settings.CLIcheck ) {
shell.printString( cr );
shell.printString( 'Checking to see if your CLI version is current...'&cr );
shell.callCommand( 'upgrade'& ( settings.latest?' --latest':'' ) );
}
if( isBoolean( settings.systemModulesCheck ) &&settings.systemModulesCheck ) {
shell.printString( cr );
shell.printString( 'Checking to see if your system modules are current...'&cr );
shell.printString(
wirebox.getInstance( name='commandDSL', initArguments={ name:'outdated' } )
.flags( 'system', 'hideUpToDate' )
.run( returnOutput=true )
);
}
configService=wirebox.getInstance( 'configService' );
varconfigSettings=ConfigService.getconfigSettings();
configSettings[ 'modules' ][ 'commandbox-update-check' ][ 'dateLastChecked' ] =now();
configService.setConfigSettings( configSettings );
}
} catch ( anye ) {
shell.printString( 'Ouch! I was not able to check for updates for some reason. Make sure you are connected to the internet.'&cr );
shell.printString( e.message&cr );
shell.printString( cr );
}
}
}