Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Mar 4, 2023
2 parents b1b89a4 + c964985 commit 253b276
Show file tree
Hide file tree
Showing 36 changed files with 1,410 additions and 125 deletions.
9 changes: 5 additions & 4 deletions build/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ java.debug=true

#dependencies
dependencies.dir=${basedir}/lib
cfml.version=5.3.10.97
cfml.version=5.3.10.120
cfml.extensions=8D7FB0DF-08BB-1589-FE3975678F07DB17
cfml.loader.version=2.8.1
box.bunndled.modules=commandbox-update-check,commandbox-cfconfig,commandbox-dotenv
cfml.loader.version=2.8.3
cfml.cli.version=${cfml.loader.version}.${cfml.version}
lucee.version=${cfml.version}
# Don't bump this version. Need to remove this dependency from cfmlprojects.org
lucee.config.version=5.2.4.37
jre.version=jdk-11.0.17+8
jre.version=jdk-11.0.18+10
launch4j.version=3.14
runwar.version=4.7.16
runwar.version=4.8.3
jline.version=3.21.0
jansi.version=2.3.2
jgit.version=5.13.0.202109080827-r
Expand Down
55 changes: 50 additions & 5 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ External Dependencies:
<property name="distro.groupID" value="ortussolutions" />
<property name="distro.name" value="commandbox"/>
<!-- Special things happen when the version and stableVersion are the same value as that signifies a "stable" build. -->
<property name="commandbox.version" value="5.7.0"/>
<property name="commandbox.stableVersion" value="5.7.0"/>
<property name="commandbox.version" value="5.8.0"/>
<property name="commandbox.stableVersion" value="5.8.0"/>

<!-- Time Label -->
<tstamp prefix="start"/>
Expand Down Expand Up @@ -297,8 +297,7 @@ External Dependencies:
<!-- Copy CommandBox code -->
<copy todir="${build.dir}" encoding="UTF-8">
<fileset dir="${src.dir}/cfml">
<exclude name="modules/**"/>
<exclude name="system/mdCache/**"/>
<include name="system/**"/>
</fileset>
<fileset file="../license.txt"/>
<fileset file="../readme.txt"/>
Expand Down Expand Up @@ -337,7 +336,6 @@ External Dependencies:
<exclude name="box.json"/>
<exclude name="modules/**"/>
</fileset>
<zipfileset file="${temp.dir}/version" fullpath="cli/version"/>
<zipfileset file="${temp.dir}/cli/bin/cliloader/cfml.version" fullpath=".version"/>
</zip>
<copy file="${dist.dir}/${distro.name}-cfml-${commandbox.version}.zip" toFile="${temp.dir}/cli/cfml.zip" overwrite="true" />
Expand Down Expand Up @@ -406,6 +404,45 @@ External Dependencies:
<fileset file="${temp.dir}/cli/version"/>
</jar>



<!-- Now that we have an executable jar, use it to download a few default modules and then update our CFML zip and jar -->
<property name="cmdboxhome.arg" value="-CommandBox_home=${build.location}/temp/CommandBoxHome" />
<delete dir="${cmdboxhome.arg}"/>

<exec executable="java" dir="${dir.apidocs}" failonerror="true">
<arg line="-jar ${dist.dir}/box.jar ${cmdboxhome.arg} install ${box.bunndled.modules}" />
</exec>

<!-- recreate the cfml distro zip -->
<zip destfile="${dist.dir}/${distro.name}-cfml-${commandbox.version}.zip" update="false" level="9">
<fileset dir="${build.dir}">
<exclude name="box.json"/>
<exclude name="modules/**"/>
</fileset>
<fileset dir="${build.location}/temp/CommandBoxHome/cfml/">
<include name="modules/**"/>
</fileset>
<zipfileset file="${build.location}/temp/CommandBoxHome/cfml/box.json" fullpath="box-auto-install.json"/>
<zipfileset file="${temp.dir}/cli/bin/cliloader/cfml.version" fullpath=".version"/>
</zip>
<copy file="${dist.dir}/${distro.name}-cfml-${commandbox.version}.zip" toFile="${temp.dir}/cli/cfml.zip" overwrite="true" />

<!-- recreate jar -->
<jar destfile="${dist.dir}/box.jar" filesetmanifest="mergewithoutmain" level="9">
<manifest>
<attribute name="Main-Class" value="cliloader.LoaderCLIMain" />
</manifest>
<fileset file="${temp.dir}/cli/libs.zip" />
<fileset file="${temp.dir}/cli/cfml.zip" />
<fileset file="${temp.dir}/cli/engine.zip" />
<fileset dir="${temp.dir}/cli/bin" />
<zipfileset src="${lib.dir}/json-smart-mini-${json-smart-mini.version}.jar" includes="**/*.class" />
<fileset file="${temp.dir}/cli/version"/>
</jar>



<!-- Create Lucee light jar -->
<jar destfile="${dist.dir}/box-light.jar" filesetmanifest="mergewithoutmain" level="9">
<manifest>
Expand Down Expand Up @@ -703,6 +740,14 @@ External Dependencies:
<chmod file="${dist.dir}/box-light" perm="755"/>
<chmod file="${dist.dir}/box-thin" perm="755"/>

<checksum file="${dist.dir}/box-light" forceoverwrite="true" fileext=".md5" />
<checksum file="${dist.dir}/box-light" forceoverwrite="true" algorithm="sha" />
<checksum file="${dist.dir}/box-light" forceoverwrite="true" algorithm="SHA-256" fileext=".sha256"/>

<checksum file="${dist.dir}/box-thin" forceoverwrite="true" fileext=".md5" />
<checksum file="${dist.dir}/box-thin" forceoverwrite="true" algorithm="sha" />
<checksum file="${dist.dir}/box-thin" forceoverwrite="true" algorithm="SHA-256" fileext=".sha256"/>

<!-- Create distro zip -->
<zip destfile="${dist.dir}/${distro.name}-bin-${commandbox.version}.zip" level="9" update="false">
<zipfileset file="${dist.dir}/box" filemode="711" prefix="" />
Expand Down
40 changes: 38 additions & 2 deletions src/cfml/system/BaseCommand.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ component accessors="true" singleton {
function error( required message, detail='', clearPrintBuffer=false, exitCode=1 ) {

wirebox.getInstance( "ConsolePainter" ).stop( message );

if( !getSystemSetting( 'box_currentCommandPiped', false ) ) {
print.line().toConsole();
print.line().toConsole();
}

setExitCode( arguments.exitCode );
Expand All @@ -234,6 +234,25 @@ component accessors="true" singleton {
throw( message=arguments.message, detail=arguments.detail, type="commandException", errorcode=arguments.exitCode );
}

/**
* This method mimics a Java/Groovy assert() function, where it evaluates the target to a boolean value or an executable closure and it must be true
* to pass and return a true to you, or throw an `AssertException`
*
* @target The tareget to evaluate for being true, it can also be a closure that will be evaluated at runtime
* @message The message to send in the exception
*
* @throws AssertException if the target is a false or null value
* @return True, if the target is a non-null value. If false, then it will throw the `AssertError` exception
*/
boolean function assert( target, message="" ){
// param against nulls
arguments.target = arguments.target ?: false;
// evaluate it
var results = isClosure( arguments.target ) || isCustomFunction( arguments.target ) ? arguments.target( this ) : arguments.target;
// deal it : callstack two is from where the `assert` was called.
return results ? true : error( "Assertion failed from #callStackGet()[ 2 ].toString()#", arguments.message );
}

/**
* Tells you if the error() method has been called on this command.
**/
Expand Down Expand Up @@ -348,5 +367,22 @@ component accessors="true" singleton {
return getCurrentThread().getName();
}

/**
* Install an extension into the Lucee server instance inside the CLI.
* If the extension is already installed, nothing will happen
*
* @extensionID The ID of the extenstion to install into the CLI
* @extensionVersion The version of the extension to install into the CLI
* @LuceeContextType Either "server" or "web"
* @LuceeContextPassword Use this if you've changed the default Lucee context password in the CLI
*/
function installExtension(
required string extensionID,
string extensionVersion='latest',
string luceeContextType='server',
string luceeContextPassword='commandbox'
){
new Administrator( luceeContextType, luceeContextPassword ).updateExtension( extensionID, extensionVersion );
}

}
2 changes: 1 addition & 1 deletion src/cfml/system/Quotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Forget a server as you stop it with "stop --forget"
Stop all your servers at once with "stop --all"
View the servers for a given folder with "server list --local"
This CLI viewed best on Netscape navigator 2.0
On WIndows? Use ConEMU, it supports 256 glorious colors!
On Windows? Use ConEMU, it supports 256 glorious colors!
The code name for CommandBox before it launched was "Project Gideon"
CommandBox is a registered trademark of Ortus Solutions
CommandBox is professional supported open source software
Expand Down
15 changes: 15 additions & 0 deletions src/cfml/system/Shell.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,21 @@ component accessors="true" singleton {
fileWrite( systemBoxJSON, '{ "name":"CommandBox System" }' );
}

// Merge in any auto-installed modules
var systemBoxJSONAutoInstall = expandPath( '/commandbox/box-auto-install.json' );
if( fileExists( systemBoxJSONAutoInstall ) ) {
var boxJSON = deserializeJSON( fileRead( systemBoxJSON ) );
var boxJSONAuto = deserializeJSON( fileRead( systemBoxJSONAutoInstall ) );
boxJSON.dependencies = boxJSON.dependencies ?: {};
boxJSON.installPaths = boxJSON.installPaths ?: {};
boxJSONAuto.dependencies = boxJSONAuto.dependencies ?: {};
boxJSONAuto.installPaths = boxJSONAuto.installPaths ?: {};
boxJSONAuto.dependencies.each( (k,v)=> boxJSON.dependencies[k]=v );
boxJSONAuto.installPaths.each( (k,v)=> boxJSON.installPaths[k]=v );
fileWrite( systemBoxJSON, serializeJSON( boxJSON ) );
fileDelete( systemBoxJSONAutoInstall );
}

}


Expand Down
42 changes: 22 additions & 20 deletions src/cfml/system/box.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{
"name": "CommandBox System Core",
"version": "@build.version@[email protected]@",
"author": "Brad Wood",
"shortDescription": "This tracks the CommandBox core dependencies",
"dependencies": {
"string-similarity": "^1.0.0",
"semver": "^1.2.3",
"globber": "^3.0.4",
"JSONPrettyPrint": "^1.0.0",
"propertyFile": "^1.0.9",
"JMESPath": "^2.4.0"
},
"devDependencies": {},
"installPaths": {
"string-similarity": "modules\\string-similarity",
"semver": "modules/semver/",
"globber": "modules/globber/",
"JSONPrettyPrint": "modules\\JSONPrettyPrint",
"propertyFile": "modules\\propertyFile"
}
"name":"CommandBox System Core",
"version":"@build.version@[email protected]@",
"author":"Brad Wood",
"shortDescription":"This tracks the CommandBox core dependencies",
"dependencies":{
"string-similarity":"^1.0.0",
"semver":"^1.2.3",
"globber":"^3.0.4",
"JSONPrettyPrint":"^1.0.0",
"propertyFile":"^1.0.9",
"JMESPath":"^2.4.0",
"jsondiff":"^1.1.3"
},
"devDependencies":{},
"installPaths":{
"string-similarity":"modules\\string-similarity",
"semver":"modules/semver/",
"globber":"modules/globber/",
"JSONPrettyPrint":"modules\\JSONPrettyPrint",
"propertyFile":"modules\\propertyFile",
"jsondiff":"modules/jsondiff/"
}
}
5 changes: 4 additions & 1 deletion src/cfml/system/config/box.json.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,8 @@
"watchDelay":500,
"watchPaths":"**.cfc",
"options":{}
}
},
"reinitWatchDirectory" : "",
"reinitWatchDelay" : 500,
"reinitWatchPaths" : "",
}
11 changes: 11 additions & 0 deletions src/cfml/system/config/server.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@
"type": "string",
"default": ""
},
"preferredBrowser": {
"title": "Preferred Browser",
"description": "Preferred Browser to use for open commands, including 'server open' and the tray menus",
"type": "string",
"default": ""
},
"openBrowser": {
"title": "Open Browser",
"description": "Controls whether browser opens by default when starting server",
Expand Down Expand Up @@ -886,6 +892,11 @@
"description": "Runs when engine is being installed during server startup",
"type": "string"
},
"onServerInitialInstall": {
"title": "On Server Initial Install Script",
"description": "Runs when engine is being installed the first time during server startup",
"type": "string"
},
"onServerStop": {
"title": "On Server Stop Script",
"description": "Runs before a server stop",
Expand Down
5 changes: 4 additions & 1 deletion src/cfml/system/endpoints/Git.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ component accessors="true" implements="IEndpoint" singleton {
public string function resolvePackage( required string package, boolean verbose=false ) {

if( configService.getSetting( 'offlineMode', false ) ) {
throw( 'Can''t clone [#getNamePrefixes()#:#package#], CommandBox is in offline mode. Go online with [config set offlineMode=false].', 'endpointException' );
throw( 'Can''t clone [#getNamePrefixes()#:#package#], CommandBox is in offline mode. Go online with [config set offlineMode=false].', 'endpointException' );
}

var job = wirebox.getInstance( 'interactiveJob' );
Expand Down Expand Up @@ -103,6 +103,9 @@ component accessors="true" implements="IEndpoint" singleton {
if( branchList.filter( function( i ) { return i contains branch; } ).len() ) {
if( arguments.verbose ){ job.addLog( 'Commit-ish [#branch#] appears to be a branch.' ); }
branch = 'origin/' & branch;
} else if( branch == 'master' && branchList.filter( (b)=>b contains 'main' ).len() ) {
if( arguments.verbose ){ job.addLog( 'Switching to branch [main].' ); }
branch = 'origin/main';
}

// Checkout branch, tag, or commit hash.
Expand Down
2 changes: 1 addition & 1 deletion src/cfml/system/modules/globber/box.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name":"Globber",
"version":"3.1.4",
"version":"3.1.5",
"author":"Brad Wood",
"homepage":"https://github.com/Ortus-Solutions/globber/",
"documentation":"https://github.com/Ortus-Solutions/globber/",
Expand Down
21 changes: 21 additions & 0 deletions src/cfml/system/modules/jsondiff/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Scott Steinbeck

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 16 additions & 0 deletions src/cfml/system/modules/jsondiff/ModuleConfig.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
component {

this.name = 'JSON-Diff';
this.title = 'JSON-Diff';
this.author = 'Scott Steinbeck';
this.webURL = 'https://github.com/scottsteinbeck/json-diff';
this.description = 'An ColdFusion utility for checking if 2 JSON objects have differences';
this.version = '1.0.4';
this.autoMapModels = false;
this.dependencies = [];

function configure() {
binder.map('jsondiff').to('#moduleMapping#.models.jsondiff');
}

}
46 changes: 46 additions & 0 deletions src/cfml/system/modules/jsondiff/box.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name":"JSON-Diff",
"slug":"jsondiff",
"version":"1.1.3",
"License":[
{
"type":"MIT",
"URL":"https://github.com/scottsteinbeck/json-diff/blob/master/LICENSE"
}
],
"author":"Scott Steinbeck <[email protected]>",
"Documentation":"https://github.com/scottsteinbeck/json-diff",
"Repository":{
"type":"git",
"URL":"https://github.com/scottsteinbeck/json-diff"
},
"scripts":{
"postVersion":"publish",
"onRelease":"!git push --follow-tags"
},
"Bugs":"https://github.com/scottsteinbeck/json-diff/issues",
"shortDescription":"An ColdFusion utility for checking if 2 JSON objects have differences",
"keywords":[
"json diff",
"json-diff",
"json differences"
],
"private":"false",
"engines":[
{
"type":"lucee",
"version":">=4.5.x"
}
],
"Contributors":[
"Scott Steinbeck <[email protected]>"
],
"DevDependencies":{
"testbox":"^4.2.1+400"
},
"installPaths":{
"testbox":"testbox/"
},
"type":"modules",
"dependencies":{}
}
Loading

0 comments on commit 253b276

Please sign in to comment.