Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Apr 27, 2023
2 parents 253b276 + c98e2d4 commit b8227f7
Show file tree
Hide file tree
Showing 27 changed files with 645 additions and 227 deletions.
73 changes: 70 additions & 3 deletions build/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ dependencies.dir=${basedir}/lib
cfml.version=5.3.10.120
cfml.extensions=8D7FB0DF-08BB-1589-FE3975678F07DB17
box.bunndled.modules=commandbox-update-check,commandbox-cfconfig,commandbox-dotenv
cfml.loader.version=2.8.3
cfml.loader.version=2.8.4
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.18+10
jre.version=jdk-11.0.19+7
launch4j.version=3.14
runwar.version=4.8.3
runwar.version=4.8.5
jline.version=3.21.0
jansi.version=2.3.2
jgit.version=5.13.0.202109080827-r
Expand Down Expand Up @@ -75,3 +75,70 @@ tests.run.url=http\://${server.host}\:${runwar.port}${war.contextpath}/tests/
runwar.cfml.dirlist=${src.dir}
## installs a custom error and 404 handler if set to true
cfmlexception.install=false

java.opens=java.base/sun.nio.ch \
java.base/sun.nio.cs \
java.base/java.io \
java.base/java.lang \
java.base/java.lang.annotation \
java.base/java.lang.invoke \
java.base/java.lang.module \
java.base/java.lang.ref \
java.base/java.lang.reflect \
java.base/java.math \
java.base/java.net \
java.base/java.net.spi \
java.base/java.nio \
java.base/java.nio.channels \
java.base/java.nio.channels.spi \
java.base/java.nio.charset \
java.base/java.nio.charset.spi \
java.base/java.nio.file \
java.base/java.nio.file.attribute \
java.base/java.nio.file.spi \
java.base/java.security \
java.base/java.security.acl \
java.base/java.security.cert \
java.base/java.security.interfaces \
java.base/java.security.spec \
java.base/java.text \
java.base/java.text.spi \
java.base/java.time \
java.base/java.time.chrono \
java.base/java.time.format \
java.base/java.time.temporal \
java.base/java.time.zone \
java.base/java.util \
java.base/java.util.concurrent \
java.base/java.util.concurrent.atomic \
java.base/java.util.concurrent.locks \
java.base/java.util.function \
java.base/java.util.jar \
java.base/java.util.regex \
java.base/java.util.spi \
java.base/java.util.stream \
java.base/java.util.zip \
java.base/javax.crypto \
java.base/javax.crypto.interfaces \
java.base/javax.crypto.spec \
java.base/javax.net \
java.base/javax.net.ssl \
java.base/javax.security.auth \
java.base/javax.security.auth.callback \
java.base/javax.security.auth.login \
java.base/javax.security.auth.spi \
java.base/javax.security.auth.x500 \
java.base/javax.security.cert \
java.base/sun.net.www.protocol.https \
java.rmi/sun.rmi.transport \
java.base/sun.security.rsa \
java.base/sun.security.pkcs \
java.base/sun.security.x509 \
java.base/sun.security.util \
java.base/sun.util.cldr \
java.base/sun.util.locale.provider \
java.desktop/com.sun.java.swing.plaf.nimbus \
java.desktop/com.sun.java.swing.plaf.motif \
java.desktop/com.sun.java.swing.plaf.nimbus \
java.desktop/com.sun.java.swing.plaf.windows \
java.management/sun.management
12 changes: 10 additions & 2 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.8.0"/>
<property name="commandbox.stableVersion" value="5.8.0"/>
<property name="commandbox.version" value="5.9.0"/>
<property name="commandbox.stableVersion" value="5.9.0"/>

<!-- Time Label -->
<tstamp prefix="start"/>
Expand Down Expand Up @@ -394,7 +394,9 @@ External Dependencies:
<!-- Create jar -->
<jar destfile="${dist.dir}/box.jar" filesetmanifest="mergewithoutmain" level="9">
<manifest>
<attribute name="Add-Opens" value="${java.opens}" />
<attribute name="Main-Class" value="cliloader.LoaderCLIMain" />
<attribute name="Multi-Release" value="true" />
</manifest>
<fileset file="${temp.dir}/cli/libs.zip" />
<fileset file="${temp.dir}/cli/cfml.zip" />
Expand Down Expand Up @@ -431,7 +433,9 @@ External Dependencies:
<!-- recreate jar -->
<jar destfile="${dist.dir}/box.jar" filesetmanifest="mergewithoutmain" level="9">
<manifest>
<attribute name="Add-Opens" value="${java.opens}" />
<attribute name="Main-Class" value="cliloader.LoaderCLIMain" />
<attribute name="Multi-Release" value="true" />
</manifest>
<fileset file="${temp.dir}/cli/libs.zip" />
<fileset file="${temp.dir}/cli/cfml.zip" />
Expand All @@ -446,7 +450,9 @@ External Dependencies:
<!-- Create Lucee light jar -->
<jar destfile="${dist.dir}/box-light.jar" filesetmanifest="mergewithoutmain" level="9">
<manifest>
<attribute name="Add-Opens" value="${java.opens}" />
<attribute name="Main-Class" value="cliloader.LoaderCLIMain" />
<attribute name="Multi-Release" value="true" />
</manifest>
<fileset file="${temp.dir}/cli-light/libs.zip" />
<fileset file="${temp.dir}/cli/cfml.zip" />
Expand All @@ -459,7 +465,9 @@ External Dependencies:
<!-- Create thin jar -->
<jar destfile="${dist.dir}/box-thin.jar" filesetmanifest="mergewithoutmain" level="9">
<manifest>
<attribute name="Add-Opens" value="${java.opens}" />
<attribute name="Main-Class" value="cliloader.LoaderCLIMain" />
<attribute name="Multi-Release" value="true" />
</manifest>
<fileset dir="${temp.dir}/cli/bin" />
<zipfileset src="${lib.dir}/json-smart-mini-${json-smart-mini.version}.jar" includes="**/*.class" />
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
``` bash
```bash
_____ _ ____
/ ____| | | _ \
| | ___ _ __ ___ _ __ ___ __ _ _ __ __| | |_) | _____ __
Expand Down Expand Up @@ -49,7 +49,7 @@ CommandBox is maintained under the Semantic Versioning guidelines as much as pos
Releases will be numbered with the following format:
``` bash
```bash
<major>.<minor>.<patch>
```
Expand Down
17 changes: 1 addition & 16 deletions src/bin/box.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ done

# Get the location of the running script
this_script=`which "$0"`
# Append to a class path
cp=$this_script

# Append box_classpath if set to cp
if [ -n "$BOX_CLASSPATH" ]
then
cp="$cp:$BOX_CLASSPATH"
fi

# Prepare Java arguments
java_args="$BOX_JAVA_ARGS -client"
Expand All @@ -35,10 +27,6 @@ java_args="$BOX_JAVA_ARGS -client"

# Cleanup paths for Cygwin.
case "`uname`" in
CYGWIN*)
cp=`cygpath --windows --mixed --path "$cp"`
;;
# Add Java Arguments for Mac
Darwin)
if [ -e /System/Library/Frameworks/JavaVM.framework ]
then
Expand All @@ -56,9 +44,6 @@ Darwin)
;;
esac

CLASSPATH="$cp"
export CLASSPATH

##############################################################################
## JAVA DETERMINATION ##
##############################################################################
Expand All @@ -84,5 +69,5 @@ fi
## EXECUTION
##############################################################################

exec "$java" $java_args cliloader.LoaderCLIMain "$@"
exec "$java" $java_args -jar $this_script "$@"
exit
42 changes: 36 additions & 6 deletions src/cfml/system/Shell.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ component accessors="true" singleton {
*/
property name="shellPrompt";
/**
* The default terminal window title
*/
property name="windowTitle";
/**
* This value is either "interactive" meaning the shell stays open waiting for user input
* or "command" which means a single command will be run and then the shell will be exiting.
* This differentiation may be useful for commands who want to be careful not to leave threads running
Expand Down Expand Up @@ -111,6 +115,7 @@ component accessors="true" singleton {
variables.pwd = "";
variables.reader = "";
variables.shellPrompt = "";
variables.windowTitle = "";
variables.userDir = arguments.userDir;
variables.tempDir = arguments.tempDir;

Expand All @@ -135,9 +140,13 @@ component accessors="true" singleton {
* Finish configuring the shell
**/
function onDIComplete() {
// When the shell first starts, the current working dir doesn't always contain the trailing slash
variables.pwd = fileSystem.resolvePath( variables.pwd );

// Create reader console and setup the default shell Prompt
variables.reader = readerFactory.getInstance( argumentCollection = variables.initArgs );
variables.shellPrompt = print.green( "CommandBox> ");
variables.reader = readerFactory.getInstance( argumentCollection = variables.initArgs );
setPrompt();
setWindowTitle();

// Create temp dir & set
setTempDir( variables.tempdir );
Expand All @@ -151,9 +160,6 @@ component accessors="true" singleton {
);
getModuleService().configure();

// When the shell first starts, the current working dir doesn't always contain the trailing slash
variables.pwd = fileSystem.resolvePath( variables.pwd );

getModuleService().activateAllModules();

// load commands
Expand Down Expand Up @@ -251,6 +257,27 @@ component accessors="true" singleton {
return this;
}

/**
* Sets the window title
* @text.hint window title text to set, if empty we use the default title
**/
Shell function setWindowTitle( text="" ) {
if( !len( arguments.text ) ){
var homeDir = fileSystem.normalizeSlashes( fileSystem.resolvePath( '~' ) );
var thisFullpath = fileSystem.normalizeSlashes( getPWD() );
var thisPath = thisFullpath.listLast( '\/' ) & '/';

// Shortcut for home dir
if( thisFullpath contains homeDir ) {
thisPath = thisFullpath.replaceNoCase( homeDir, '~/' );
}
variables.windowTitle = "CommandBox: #thisPath#";
} else {
variables.windowTitle = arguments.text;
}
return this;
}

/**
* ask the user a question and wait for response
* @message.hint message to prompt the user with
Expand Down Expand Up @@ -509,6 +536,7 @@ component accessors="true" singleton {
request.lastCWD = arguments.directory;
// Update prompt to reflect directory change
setPrompt();
setWindowTitle();
return variables.pwd;
}

Expand Down Expand Up @@ -553,7 +581,7 @@ component accessors="true" singleton {

try {

var interceptData = { prompt : variables.shellPrompt };
var interceptData = { prompt : variables.shellPrompt, windowTitle: variables.windowTitle };
getInterceptorService().announceInterception( 'prePrompt', interceptData );

if( arguments.silent ) {
Expand All @@ -576,6 +604,8 @@ component accessors="true" singleton {
if( arguments.silent ) {
line = variables.reader.readLine( interceptData.prompt, javacast( "char", ' ' ) );
} else {
// set the window title before reading a line
variables.reader.getTerminal().writer().print( chr( 27 ) & ']2;' & interceptData.windowTitle & chr( 7 ) );
line = variables.reader.readLine( interceptData.prompt );
}
}
Expand Down
11 changes: 1 addition & 10 deletions src/cfml/system/endpoints/Java.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -310,20 +310,11 @@ component accessors=true implements="IEndpoint" singleton {
'version' : '',
'type' : 'jre',
'arch' : javaService.getCurrentCPUArch(),
'os' : '',
'os' : javaService.getCurrentOS(),
'jvm-implementation' : ( ID.findNoCase( 'openj9' ) ? 'openj9' : 'hotspot' ),
'release' : 'latest'
};


if( fileSystemUtil.isMac() ) {
results.os = 'mac';
} else if( fileSystemUtil.isLinux() ) {
results.os = 'linux';
} else {
results.os = 'windows';
}

var tokens = ID.listToArray( '_' );
var first = true;
for( var token in tokens ) {
Expand Down
2 changes: 1 addition & 1 deletion src/cfml/system/modules/string-similarity/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Read more about how it works here:

http://www.codersrevolution.com/blog/ColdFusion-Levenshtein-Distance-String-comparison-and-highlighting

``` html
```html
<cfset string1 = "The rain in Spain stays mainly on the plains
The rain in Spain stays mainly on the plains
The rain in Spain stays mainly on the plains
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,30 +117,14 @@ component {
var numVersions = versions.len();
if( numVersions ) {
var versions = versions.reverse()
var widestVersion = versions.map( (v)=>len( v ) ).max();
var colWdith = widestVersion + 4;
var termWidth = shell.getTermWidth()-1;
var numCols = termWidth\colWdith;
var numRows = ceiling( numVersions/numCols );

loop from=1 to=numRows index="local.row" {
loop from=1 to=numCols index="local.col" {
var thisIndex = row+((col-1)*numRows);
var format='grey';
if( thisIndex > numVersions ) {
var thisVersion = '';
} else {
var thisVersion = versions[thisIndex];
if( satisfyingVersion == thisVersion ) {
format = 'boldwhiteOnGreen';
} else if ( matches.find( thisVersion ) ) {
format = 'boldWhite';
}
}
print.text( padRight( thisVersion, colWdith ), format );
print.columns( versions, (thisVersion)=>{
if( satisfyingVersion == thisVersion ) {
return 'boldwhiteOnGreen';
} else if ( matches.find( thisVersion ) ) {
return 'boldWhite';
}
print.line()
}
return 'grey';
} );
print.line()
.greyLine( 'Unmatched Version' )
.boldWhiteLine( 'Version matching semver range' )
Expand Down Expand Up @@ -189,27 +173,4 @@ component {
return [];
}


/**
* Adds characters to the right of a string until the string reaches a certain length.
* If the text is already greater than or equal to the maxWidth, the text is returned unchanged.
* @text The text to pad.
* @maxWidth The number of characters to pad up to.
* @padChar The character to use to pad the text.
*/
private string function padRight( required string text, required numeric maxWidth, string padChar = " " ) {
var textLength = len( arguments.text );
if ( textLength == arguments.maxWidth ) {
return arguments.text;
} else if( textLength > arguments.maxWidth ) {
if( arguments.maxWidth < 4 ) {
return left( text, arguments.maxWidth );
} else {
return left( text, arguments.maxWidth-3 )&'...';
}
}
arguments.text &= repeatString( arguments.padChar, arguments.maxWidth-textLength );
return arguments.text;
}

}
Loading

0 comments on commit b8227f7

Please sign in to comment.