-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathinit.cfc
More file actions
42 lines (32 loc) · 1.28 KB
/
init.cfc
File metadata and controls
42 lines (32 loc) · 1.28 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
/**
* Initialize your project to use commandbox-migrations
* Make sure you are running this command in the root of your app.
*
* This will ensure the correct values are set in your box.json.
*/
component {
property name="packageService" inject="PackageService";
property name="JSONService" inject="JSONService";
function run( boolean open = false ) {
var directory = getCWD();
var configPath = "#directory#/.migrations.json";
// Check and see if a .migrations.json file exists
if ( fileExists( configPath ) ) {
print.yellowLine( ".migrations.json already exists." );
return;
}
// Check and see if a .cfmigrations.json file exists (for backward compatibility)
var oldConfigPath = "#directory#/.cfmigrations.json";
if ( fileExists( oldConfigPath ) ) {
print.yellowLine( ".cfmigrations.json already exists." );
return;
}
var configStub = fileRead( "/commandbox-migrations/templates/config.txt" );
file action="write" file="#configPath#" mode="777" output="#trim( configStub )#";
print.greenLine( "Created .migrations config file." );
// Open file?
if ( arguments.open ) {
openPath( configPath );
}
}
}