Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Oct 4, 2021
2 parents 95e8fd9 + 2512456 commit 12ea688
Show file tree
Hide file tree
Showing 72 changed files with 4,946 additions and 2,068 deletions.
1 change: 0 additions & 1 deletion build/brew-template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class Commandbox < Formula
url "@repoPRDURL@/ortussolutions/commandbox/@stable-version@/commandbox-bin-@stable-version@.zip"
sha256 "@stable-sha256@"
license "LGPL-3.0-or-later"
revision 1

head do
url "@repoURL@/ortussolutions/commandbox/@version@/commandbox-bin-@version@.zip?build=@buildnumber@"
Expand Down
4 changes: 2 additions & 2 deletions build/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ java.debug=true

#dependencies
dependencies.dir=${basedir}/lib
cfml.version=5.3.8.201
cfml.version=5.3.8.206
cfml.extensions=8D7FB0DF-08BB-1589-FE3975678F07DB17
cfml.loader.version=2.6.5
cfml.cli.version=${cfml.loader.version}.${cfml.version}
Expand All @@ -19,7 +19,7 @@ lucee.version=${cfml.version}
lucee.config.version=5.2.4.37
jre.version=jdk-11.0.12+7
launch4j.version=3.14
runwar.version=4.5.1
runwar.version=4.5.2
jline.version=3.19.0
jansi.version=2.3.2
jgit.version=5.11.0.202103091610-r
Expand Down
4 changes: 2 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.4.1"/>
<property name="commandbox.stableVersion" value="5.4.1"/>
<property name="commandbox.version" value="5.4.2"/>
<property name="commandbox.stableVersion" value="5.4.2"/>

<!-- Time Label -->
<tstamp prefix="start"/>
Expand Down
4 changes: 2 additions & 2 deletions src/cfml/system/BaseCommand.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ component accessors="true" singleton {
* Let a user choose between several options. Can be set to multiselect, which returns array of selections
* multiSelect().setQuestion( 'Please Choose: ' ).setOptions( 'one,two,three' ).ask()
**/
function multiSelect() {
return getinstance( 'MultiSelect' );
function multiSelect( string question='' ) {
return getinstance( name='MultiSelect', initArguments={ question : arguments.question } );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/cfml/system/Shell.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ component accessors="true" singleton {


/**
* Sets reload flag, reloaded from shell.cfm
* Sets reload flag, reloaded from Bootstrap.cfm
* @clear.hint clears the screen after reload
**/
Shell function reload( Boolean clear=true ){
Expand Down
10 changes: 5 additions & 5 deletions src/cfml/system/endpoints/Java.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ component accessors=true implements="IEndpoint" singleton {
ID = ID.lCase();

var results = {
version : '',
type : 'jre',
arch : server.java.archModel contains 32 ? 'x32' : 'x64',
os : '',
'version' : '',
'type' : 'jre',
'arch' : server.java.archModel contains 32 ? 'x32' : 'x64',
'os' : '',
'jvm-implementation' : ( ID.findNoCase( 'openj9' ) ? 'openj9' : 'hotspot' ),
release : 'latest'
'release' : 'latest'
};

if( fileSystemUtil.isMac() ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ component aliases='status,server info' {


print.line().indentedLine( 'Last Command: ' );
print.indentedLine( trim( thisServerInfo.statusInfo.command ) );
// Put each --arg or -arg on a new line
var args = trim( reReplaceNoCase( thisServerInfo.statusInfo.arguments, ' (-|"-)', cr & '\1', 'all' ) );
print.indentedIndentedLine( args )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ component aliases="ls,ll,directory" {
* @simple Output only path names and nothing else.
* @full Output absolute file path, not just relative to current working directory
**/
function run( Globber paths=globber( getCWD() ), sort='type, name', string excludePaths='', boolean recurse=false, boolean simple=false, boolean full=false ) {
function run( Globber paths=globber( getCWD() ), sort='directory, type, name', string excludePaths='', boolean recurse=false, boolean simple=false, boolean full=false ) {

// Backwards compat for old parameter name
if( arguments.keyExists( 'directory' ) && arguments.directory.len() ) {
Expand Down
24 changes: 23 additions & 1 deletion src/cfml/system/modules_app/system-commands/commands/info.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
* {code:bash}
* info
* {code}
* .
* The information is available in JSON as well (sorry, no ASCII art)
* {code:bash}
* info --JSON
* {code}
*
**/
component aliases="about" {

function run() {
function run( boolean JSON=false ) {

var width = 100;

Expand Down Expand Up @@ -36,6 +41,23 @@ component aliases="about" {
runwarVersion &= ' (#runwarJarPath#)'
}catch( any e ) {}

if( JSON ) {
print.line( {
'CLIVersion' : shellVersion,
'CLIAuthors' : 'Brad Wood, Luis Majano, Denny Valiant',
'CLIBinary' : binaryPath,
'CLIHome' : commandboxHome,
'CFMLEngine' : CFMLEngine,
'CFMLVersion' :CFMLVersion,
'JavaVersion' : javaVersion,
'JavaPath' : javaBinary,
'OSUsername' : userName,
'JLineTerminal' : JLineTerminal,
'RunwarVersion' : runwarVersion
} );
return;
}

print.line();
print.greenLine( '****************************************************************************************************' );
print.greenText( '* ' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
component {

/**
* @paths Command delimited list of file globbing paths to watch relative to the working directory, defaults to **
* @excludePaths Command delimted list of file globbing paths to exclude relative to the working directory.
* @paths Comma-delimited list of file globbing paths to watch relative to the working directory, defaults to **
* @excludePaths Comma-delimited list of file globbing paths to exclude relative to the working directory.
* @command The command to run when the watcher fires
* @delay How may milliseconds to wait before polling for changes, defaults to 500 ms
* @directory Working directory to start watcher in
Expand Down
4 changes: 2 additions & 2 deletions src/cfml/system/services/CommandService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ component accessors="true" singleton {
directoryCreate( expandPath( commandLocation ) );
}
// Load up any commands
initCommands( commandLocation, commandLocation );
initCommands( commandLocation );
}

setConfigured( true );
Expand All @@ -82,7 +82,7 @@ component accessors="true" singleton {
**/
CommandService function initCommands(
required string baseCommandDirectory,
required string commandDirectory,
string commandDirectory=baseCommandDirectory,
string commandPath=''
){
var varDirs = DirectoryList(
Expand Down
6 changes: 4 additions & 2 deletions src/cfml/system/services/JavaService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,18 @@ component accessors="true" singleton {
* Install java version if needed, and return installation folder
*
* @ID Full ID of java installation
* @verbose Enable verbose output from the install command
*/
function getJavaInstallPath( required string ID ){
installJava( ID );
function getJavaInstallPath( required string ID, boolean verbose=false ){
installJava( ID, verbose );
return lastInstallDir;
}

/**
* Install a java version
*
* @ID installation ID as defined by Java endpoint. If no endpoint name space, defaults to "java:"
* @verbose Enable verbose output from the install command
*/
function installJava( required string ID, boolean verbose=false ) {
// Default to "java:" endpoint
Expand Down
11 changes: 7 additions & 4 deletions src/cfml/system/services/ModuleService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@
<cfargument name="moduleName" type="string" required="true" hint="The name of the module to load."/>
<cfargument name="invocationPath" type="string" required="false" default="" hint="The module's invocation path to its root from the webroot (the instantiation path,ex:myapp.myCustomModules), if empty we use registry location, if not we are doing a explicit name+path registration. Do not include the module name, you passed that in the first argument right"/>
<cfscript>
registerModule( arguments.moduleName, arguments.invocationPath );
activateModule( arguments.moduleName );
if( registerModule( arguments.moduleName, arguments.invocationPath ) ) {
activateModule( arguments.moduleName );
}
</cfscript>
</cffunction>

Expand Down Expand Up @@ -192,7 +193,9 @@

// Check if module config exists, or we have a module.
if( NOT fileExists( modLocation & "/ModuleConfig.cfc" ) && NOT isBundle ){
instance.logger.WARN( "The module (#modName#) cannot be loaded as it does not have a ModuleConfig.cfc in its root. Path Checked: #modLocation#" );
var message = "The module (#modName#) cannot be loaded as it does not have a ModuleConfig.cfc in its root. Path Checked: #modLocation#";
instance.logger.WARN( message );
consoleLogger.warn( message );
return false;
}

Expand Down Expand Up @@ -464,7 +467,7 @@
// Register commands if they exist
if( directoryExists( mconfig.commandsPhysicalPath ) ){
var commandPath = '/' & replace( mconfig.commandsInvocationPath, '.', '/', 'all' );
CommandService.initCommands( commandPath, commandPath );
CommandService.initCommands( commandPath );
}

// Register endpoints if they exist
Expand Down
23 changes: 13 additions & 10 deletions src/cfml/system/services/PackageService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ component accessors="true" singleton {
property name='wirebox' inject='wirebox';
property name='tempDir' inject='tempDir@constants';
property name='serverService' inject='serverService';
property name='moduleService' inject='moduleService';


/**
* Constructor
Expand All @@ -41,7 +43,7 @@ component accessors="true" singleton {
* Checks to see if a box.json exists in a given directory
* @directory The directory to examine
*/
public function isPackage( required string directory ) {
boolean public function isPackage( required string directory ) {
// If the package has a box.json in the root...
return fileExists( getDescriptorPath( arguments.directory ) );
}
Expand Down Expand Up @@ -307,8 +309,6 @@ component accessors="true" singleton {
arguments.saveDev = false;
ignorePatterns.append( '/box.json' );
// Flag the shell to reload after this command is finished.
job.addWarnLog( "Shell will be reloaded after installation." );
shell.reload( false );
shellWillReload = true;
// If this is a module
} else if( packageType == 'modules' ) {
Expand Down Expand Up @@ -395,8 +395,6 @@ component accessors="true" singleton {
// If this package is being installed anywhere south of the CommandBox system folder,
// flag the shell to reload after this command is finished.
if( fileSystemUtil.normalizeSlashes( installDirectory ).startsWith( fileSystemUtil.normalizeSlashes( expandPath( '/commandbox' ) ) ) ) {
job.addWarnLog( "Shell will be reloaded after installation." );
shell.reload( false );
shellWillReload = true;
}

Expand Down Expand Up @@ -622,17 +620,22 @@ component accessors="true" singleton {
job.addLog( "No dependencies found to install, but it's the thought that counts, right?" );
}

if( shellWillReload && artifactDescriptor.createPackageDirectory && fileExists( installDirectory & '/ModuleConfig.cfc' ) ) {
consoleLogger.warn( 'Activating your new module for instant use...' );
moduleService.registerAndActivateModule( installDirectory.listLast( '/\' ), fileSystemUtil.makePathRelative( installDirectory ) );
//shell.reload( clear=false );
//consoleLogger.warn( '.' );
//consoleLogger.warn( 'Please sit tight while your shell reloads...' );
}

interceptorService.announceInterception( 'postInstall', { installArgs=arguments, installDirectory=installDirectory } );
job.complete( verbose );
if( shellWillReload ) {
consoleLogger.warn( '.' );
consoleLogger.warn( 'Please sit tight while your shell reloads...' );
}

return true;
}

// DRY
function isPackageModule( required string packageType ) {
boolean function isPackageModule( required string packageType ) {
// Is the package type that of a module?
return ( listFindNoCase( 'modules,contentbox-modules,commandbox-modules', arguments.packageType ) > 0) ;
}
Expand Down
6 changes: 2 additions & 4 deletions src/cfml/system/services/ServerEngineService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,8 @@ component accessors="true" singleton="true" {

}

// Set default web.xml path now that we have an install dir
if( !len( serverInfo.webXML ) ) {
serverInfo.webXML = "#installDetails.installDir#/WEB-INF/web.xml";
}
// Set web.xml path now that we have an install dir
serverInfo.webXML = "#installDetails.installDir#/WEB-INF/web.xml";

var engineTagFile = installDetails.installDir & '/.engineInstall';

Expand Down
32 changes: 5 additions & 27 deletions src/cfml/system/services/ServerService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,10 @@ component accessors="true" singleton {
systemSettings.expandDeepSystemSettings( serverDetails.serverJSON.env ?: {} );
// Load up our fully-realized server.json-specific env vars into CommandBox's environment
systemSettings.setDeepSystemSettings( serverDetails.serverJSON.env ?: {}, '' );

interceptorService.announceInterception( 'preServerStart', { serverDetails=serverDetails, serverProps=serverProps } );
// Get defaults
var defaults = getDefaultServerJSON();

interceptorService.announceInterception( 'preServerStart', { serverDetails=serverDetails, serverProps=serverProps, serverInfo=serverDetails.serverInfo, serverJSON=serverDetails.serverJSON, defaults=defaults } );

var defaultName = serverDetails.defaultName;
var defaultwebroot = serverDetails.defaultwebroot;
Expand Down Expand Up @@ -343,30 +345,6 @@ component accessors="true" singleton {

}

// *************************************************************************************
// Backwards compat for default port in box.json. Remove this eventually... // *
// *
// Get package descriptor // *
var boxJSON = packageService.readPackageDescriptorRaw( defaultwebroot ); // *
// Get defaults // *
var defaults = getDefaultServerJSON(); // *
// *
// Backwards compat with boxJSON default port. Remove in a future version // *
// The property in box.json is deprecated. // *
if( (boxJSON.defaultPort ?: 0) > 0 ) { // *
// *
// Remove defaultPort from box.json and pretend it was // *
// manually typed which will cause server.json to save it. // *
serverProps.port = boxJSON.defaultPort; // *
// *
// Update box.json to remove defaultPort from disk // *
boxJSON.delete( 'defaultPort' ); // *
packageService.writePackageDescriptor( boxJSON, defaultwebroot ); // *
} // *
// *
// End backwards compat for default port in box.json. // *
// *************************************************************************************

// Save hand-entered properties in our server.json for next time
for( var prop in serverProps ) {
// Ignore null props or ones that shouldn't be saved
Expand Down Expand Up @@ -1071,7 +1049,7 @@ component accessors="true" singleton {
// Make current settings available to package scripts
setServerInfo( serverInfo );
// This interception point can be used for additional configuration of the engine before it actually starts.
interceptorService.announceInterception( 'onServerInstall', { serverInfo=serverInfo, installDetails=installDetails, serverJSON=serverJSON } );
interceptorService.announceInterception( 'onServerInstall', { serverInfo=serverInfo, installDetails=installDetails, serverJSON=serverJSON, defaults=defaults, serverProps=serverProps, serverDetails=serverDetails } );

// If Lucee server, set the java agent
if( serverInfo.cfengine contains "lucee" ) {
Expand Down
Loading

0 comments on commit 12ea688

Please sign in to comment.