Skip to content

Commit

Permalink
CONTENTBOX-1493 #resolve
Browse files Browse the repository at this point in the history
ContentBox Express removed since we now have CommandBox
  • Loading branch information
lmajano committed Nov 9, 2023
1 parent de181ba commit 668b719
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 129 deletions.
7 changes: 1 addition & 6 deletions build/build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Versions
coldbox.version=6

# locations
dir.exports=${basedir}/artifacts
dir.contentbox.exports=${dir.exports}/${contentbox.slug}/${contentbox.version}
Expand All @@ -18,7 +15,5 @@ lucee.version=5.3.8.201
# Lucee patching levels if needed
lucee.patch=
tuckey.version=4.0.3
# Embedded Tomcat Version for express edition
express.server.version=9.0.43
# bleeding edge info
be.exports=${dir.exports}/${contentbox.slug}
be.exports=${dir.exports}/${contentbox.slug}
88 changes: 5 additions & 83 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
<replaceregexp match='@version.number@' replace="${contentbox.version}" flags="ig" byline="true" encoding="UTF-8">
<fileset dir="${dir.build}/module" />
</replaceregexp>

<!-- Determine snapshot vs master artifact -->
<if>
<equals arg1="${build.branch}" arg2="development" />
Expand Down Expand Up @@ -213,6 +214,7 @@
<fileset dir="${dir.build}/installer" />
<fileset dir="${dir.build}/installer-module" />
</replaceregexp>

<!-- Determine snapshot vs master artifact -->
<if>
<equals arg1="${build.branch}" arg2="development" />
Expand Down Expand Up @@ -339,7 +341,7 @@
</exec>
<!-- Install ContentBox dependencies -->
<exec executable="box" dir="${dir.build}/war">
<arg line="install id=coldbox@${coldbox.version} production=true" />
<arg line="install production=true" />
</exec>

<!-- Create War -->
Expand Down Expand Up @@ -367,69 +369,11 @@
<checksum forceoverwrite="true" fileext=".sha512" algorithm="SHA-512" file="${dir.contentbox.exports}/contentbox-installer-with-dependencies-${contentbox.version}.zip" />
</target>

<!-- Build Express Edition -->
<target name="build.express" description="Build an express server" depends="build.war">
<!-- Unzip tomcat -->
<unzip dest="${dir.build}" src="${dir.dependencies}/apache-tomcat-${express.server.version}.zip"/>
<move todir="${dir.build}/express">
<fileset dir="${dir.build}/apache-tomcat-${express.server.version}"/>
</move>

<!-- Remove current webapps -->
<delete includeemptydirs="true" >
<fileset dir="${dir.build}/express/webapps" />
</delete>

<!-- create root app -->
<mkdir dir="${dir.build}/express/webapps/ROOT" />

<!-- Copy ContentBox war into it -->
<copy toDir="${dir.build}/express/webapps/ROOT" overwrite="true" encoding="UTF-8">
<fileset dir="${dir.build}/war" />
</copy>

<!-- Copy admin password -->
<copy file="${dir.resources}/password.txt" toDir="${dir.build}/express/webapps/ROOT/WEB-INF/lucee-server/context" overwrite="true" encoding="UTF-8"/>
<!-- Copy inline datasource -->
<copy file="${dir.resources}/datasource.cfm" toDir="${dir.build}/express/webapps/ROOT/config" overwrite="true" encoding="UTF-8"/>
<!-- Add datasource include -->
<replace file="${dir.build}/express/webapps/ROOT/Application.cfc"
value='include "config/datasource.cfm";'
summary="true"
token='this.datasource = "contentbox";'
encoding="UTF-8"/>

<!-- Custom Server Config -->
<copy todir="${dir.build}/express" overwrite="true" encoding="UTF-8">
<fileset dir="${dir.resources}/express" />
</copy>

<!-- add execution perms -->
<chmod perm="ugo+rx">
<fileset dir="${dir.build}/express/bin" />
</chmod>

<!-- NO JRE EXPRESS -->
<zip destfile="${dir.contentbox.exports}/contentbox-express-${contentbox.version}.zip" basedir="${dir.build}/express" />

<!-- Build Checksums -->
<checksum forceoverwrite="true" fileext=".md5">
<fileset dir="${dir.contentbox.exports}">
<include name="contentbox-express-*.zip" />
</fileset>
</checksum>
<checksum forceoverwrite="true" fileext=".sha512" algorithm="SHA-512">
<fileset dir="${dir.contentbox.exports}">
<include name="contentbox-express-*.zip" />
</fileset>
</checksum>
</target>

<!-- Build all releases-->
<target
name="build.all"
description="Builds All ContentBox Release Flavors and patches"
depends="build.express"
depends="build.war"
>
<!-- Copy as BE to root -->
<copy toDir="${be.exports}" overwrite="true" encoding="UTF-8" verbose="true">
Expand All @@ -452,11 +396,6 @@
version="${tuckey.version}"
extension="jar"
destination="${dir.dependencies}"/>
<!-- Download Dependency via box task-->
<box-dependency groupID="apache"
artifactID="apache-tomcat"
version="${express.server.version}"
destination="${dir.dependencies}"/>
<!-- Download Dependency via box task-->
<if>
<not><equals arg1="${lucee.patch}" arg2=""></equals></not>
Expand All @@ -468,23 +407,6 @@
destination="${dir.dependencies}"/>
</then>
</if>
<!-- Download Dependency via box task
<box-dependency groupID="oracle"
artifactID="jre"
version="${jre.version}"
destination="${dir.dependencies}"
classifiers="win64"/>
<box-dependency groupID="oracle"
artifactID="jre"
version="${jre.version}"
destination="${dir.dependencies}"
classifiers="darwin64"/>
<box-dependency groupID="oracle"
artifactID="jre"
version="${jre.version}"
destination="${dir.dependencies}"
classifiers="linux64"/>
-->
</target>

</project>
</project>
159 changes: 159 additions & 0 deletions build/patches/5.0.0 copy/Updater.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/**
* Update a v4 Installation to v5
*/
component {

function init(){
variables.util = shell.getUtil();
variables.cwd = getCWD();
variables.tempFolder = variables.cwd & "__temp";

variables.targetVersion = "5";

if( directoryExists( variables.tempFolder ) ){
directoryDelete( variables.tempFolder, true );
}
directoryCreate( variables.tempFolder );

// Directory copy excludes
variables.excludes = [
".tmp",
".DS_Store",
".git"
];

return this;
}

/**
* Run the updater
*/
function run( version ){
// Override the incoming version if needed
if( !isNull( arguments.version ) ){
variables.targetVersion = arguments.version;
}

print.blueLine( "This task will update your ContentBox 4 installation to a ContentBox 5 installation." )
.blueLine( "Please make a backup of your source and your database now. " )
.line()
.redLine( "Here are some files that will be overwritten by the updater. We will create .bak files for you.")
.redLine( "Make sure you copy back your customizations to your new files:")
.redLine( "- Application.cfc" )
.redLine( "- config/CacheBox.cfc")
.redLine( "- config/Coldbox.cfc")
.line()
.toConsole();

var ready = ask(
"Are you ready to continue (yes/no)?"
);

if ( listFindNoCase( "n,no", ready ) ) {
print.blueLine( "Bye Bye!" );
return;
}

// Install ContentBox
print.blueLine( "Downloading ContentBox v#variables.targetVersion# assets to __temp folder..." ).toConsole();
command( "install contentbox-site@#variables.targetVersion#" )
.inWorkingDirectory( variables.tempFolder )
.run();
print.greenLine( "√ ContentBox assets downloaded!" ).toConsole();

// Update ColdBox
print.blueLine( "Uninstalling current version of ColdBox..." ).toConsole();
command( "uninstall coldbox" ).run();
print.blueLine( "Installing latest version of ColdBox 6..." ).toConsole();
command( "install coldbox@^6.0.0 --save" ).run();
print.greenLine( "√ ColdBox Updated!" ).toConsole();

// Update ContentBox
print.blueLine( "Uninstalling current version of the ContentBox module..." ).toConsole();
command( "uninstall contentbox" ).run();
print.blueLine( "Installing ContentBox v#variables.targetVersion#" ).toConsole();
command( "install contentbox@#variables.targetVersion# --save" ).run();
print.greenLine( "√ ContentBox v5 Installed!" ).toConsole();

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

// Copy over new files
replaceNewSiteFiles();

// Remove temp folder
directoryDelete( variables.tempFolder, true );

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

// Final Comment
print.boldRedLine(
"√ Eureka! You are now ready to startup your engines and run ContentBox v#variables.targetVersion#!"
)
.toConsole();
}

function replaceNewSiteFiles(){
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 ) => {
if( fileExists( variables.cwd & 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
*/
private function copy( src, target, recurse=true ){
// process paths with excludes
directoryList( src, false, "path", function( path ){
var isExcluded = false;
variables.excludes.each( function( item ){
if( path.replaceNoCase( variables.cwd, "", "all" ).findNoCase( item ) ){
isExcluded = true;
}
} );
return !isExcluded;
}).each( function( item ){
// Copy to target
if( fileExists( item ) ){
print.blueLine( "Copying #item#" ).toConsole();
fileCopy( item, target );
} else {
print.greenLine( "Copying directory #item#" ).toConsole();
directoryCopy( item, target & "/" & item.replace( src, "" ), true );
}
} );
}
}
37 changes: 0 additions & 37 deletions build/patches/express.refactor.xml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion modules/contentbox-installer/models/InstallerService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ component accessors="true" {
// do nothing, .htaccess already on root
break;
}
case "contentbox_express":
case "commandbox": {
// do nothing, tuckey already setup at the servlet level on both commandbox and express.
break;
Expand Down
4 changes: 2 additions & 2 deletions modules/contentbox-installer/views/home/steps/step4.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
)#
</label>
#html.select(
options = "commandbox,contentbox_express,mod_rewrite,iis7",
options = "commandbox,mod_rewrite,iis7",
name = "rewrite_engine",
class = "input-sm"
)#
Expand All @@ -56,4 +56,4 @@
title = cb.r( 'tab.start.title@installer' )
)#
</div>
</cfoutput>
</cfoutput>

0 comments on commit 668b719

Please sign in to comment.