Skip to content

Commit

Permalink
finalized updater
Browse files Browse the repository at this point in the history
  • Loading branch information
lmajano committed Mar 19, 2021
1 parent 57b944e commit 543b8af
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 46 deletions.
74 changes: 33 additions & 41 deletions build/patches/5.0.0/Updater.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ component {

// Run Migrations
print.blueLine( "Migrating your database to version: #variables.targetVersion#..." ).toConsole();
//command( "migrate up" ).run();
command( "migrate up" ).run();
print.greenLine( "√ Database migrated! Let's do some code now." ).toConsole();

// Update ColdBox
Expand All @@ -84,51 +84,14 @@ component {
command( "install contentbox@#variables.targetVersion# --save" ).run();
print.greenLine( "√ ContentBox v5 Installed!" ).toConsole();

// Backup the Application.cfc
print.blueLine( "Backing up Application.cfc as Application.bak..." ).toConsole();
fileCopy(
variables.cwd & "Application.cfc",
variables.cwd & "Application.bak"
);
print.blueLine( "Installing new Application.cfc..." ).toConsole();
fileCopy(
variables.tempFolder & "/Application.cfc",
variables.cwd & "Application.cfc"
);
print.greenLine( "√ New Application.cfc Installed!" ).toConsole();

// ContentBox Bin installation
// ContentBox Bin directory installation
print.blueLine( "Moving new ContentBox bin folder to root..." ).toConsole();
directoryCreate( variables.cwd & "bin" );
copy( variables.tempFolder & "/bin", variables.cwd & "bin" );
print.greenLine( "√ New ContentBox bin folder installed!" ).toConsole();

// New CacheBox.cfc
print.blueLine( "Backing up config/CacheBox.cfc as CacheBox.bak..." ).toConsole();
fileCopy(
variables.cwd & "config/CacheBox.cfc",
variables.cwd & "config/CacheBox.bak"
);
print.blueLine( "Installing new CacheBox.cfc..." ).toConsole();
fileCopy(
variables.tempFolder & "/config/CacheBox.cfc",
variables.cwd & "config/CacheBox.cfc"
);
print.greenLine( "√ New config/CacheBox.cfc Installed!" ).toConsole();

// New ColdBox.cfc
print.blueLine( "Backing up config/Coldbox.cfc as Coldbox.bak..." ).toConsole();
fileCopy(
variables.cwd & "config/Coldbox.cfc",
variables.cwd & "config/Coldbox.bak"
);
print.blueLine( "Installing new Coldbox.cfc..." ).toConsole();
fileCopy(
variables.tempFolder & "/config/Coldbox.cfc",
variables.cwd & "config/Coldbox.cfc"
);
print.greenLine( "√ New config/Coldbox.cfc Installed!" ).toConsole();
print.redLine( "√ Make sure you review the new ColdBox.cfc for your previous updates" ).toConsole();
// Copy over new files
replaceNewFiles();

// Remove temp folder
directoryDelete( variables.tempFolder, true );
Expand All @@ -140,6 +103,35 @@ component {
.toConsole();
}

function replaceNewFiles(){
print.blueLine( "Starting to deploy new files..." ).line().toConsole();

var files = [
".cfconfig.json",
"server.json",
"Application.cfc",
"robots.txt",
"readme.md",
"config/CacheBox.cfc",
"config/Coldbox.cfc"
].each( ( thisFile ) => {
print.blueLine( "Backing up #thisFile#..." ).toConsole();
fileCopy(
variables.cwd & thisFile,
variables.cwd & thisFile & ".bak"
);
print.blueLine( "Installing new #thisFile#..." ).toConsole();

fileCopy(
variables.tempFolder & "/" & thisFile,
variables.cwd & thisFile
);
print.greenLine( "√ New #thisFile# Installed!" ).toConsole();
} );

print.line().greenLine( "√ New files deployed!" ).line().toConsole();
}

/**
* DirectoryCopy is broken in lucee
*/
Expand Down
12 changes: 7 additions & 5 deletions robots.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
User-agent: *
Disallow:
Disallow:
Allow: /modules/contentbox/themes/
Allow: /modules_app/contentbox-custom/_themes/
Disallow: /bin/
Disallow: /coldbox/
Disallow: /config/
Disallow: /handlers/
Disallow: /layouts/
Disallow: /interceptors/
Disallow: /logs/
Disallow: /model/
Disallow: /layouts/
Disallow: /models/
Disallow: /modules/
Disallow: /plugins/
Disallow: /modules_app/
Disallow: /resources/
Disallow: /views/

0 comments on commit 543b8af

Please sign in to comment.