Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Sep 3, 2022
2 parents 589e058 + 593a7bd commit 5415d37
Show file tree
Hide file tree
Showing 27 changed files with 989 additions and 233 deletions.
6 changes: 3 additions & 3 deletions build/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ java.debug=true

#dependencies
dependencies.dir=${basedir}/lib
cfml.version=5.3.9.141
cfml.version=5.3.9.160
cfml.extensions=8D7FB0DF-08BB-1589-FE3975678F07DB17
cfml.loader.version=2.6.20
cfml.loader.version=2.7.2
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.15+10
launch4j.version=3.14
runwar.version=4.7.7
runwar.version=4.7.13
jline.version=3.21.0
jansi.version=2.3.2
jgit.version=5.13.0.202109080827-r
Expand Down
8 changes: 4 additions & 4 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.5.2"/>
<property name="commandbox.stableVersion" value="5.5.2"/>
<property name="commandbox.version" value="5.6.0"/>
<property name="commandbox.stableVersion" value="5.6.0"/>

<!-- Time Label -->
<tstamp prefix="start"/>
Expand Down Expand Up @@ -382,7 +382,7 @@ External Dependencies:
</fileset>
<fileset file="${temp.dir}/cli/luceecli.jar" />
<fileset file="${temp.dir}/cli/ortus-jgit.jar" />
<fileset file="${src.dir}/resources/log4j2.xml" />
<fileset file="${src.dir}/resources/log4j2.xml" />
</zip>

<zip destfile="${temp.dir}/cli-light/libs.zip">
Expand Down Expand Up @@ -1071,7 +1071,7 @@ External Dependencies:
<exclusion groupId="org.slf4j" artifactId="slf4j-api" />
<exclusion groupId="org.apache.httpcomponents" artifactId="httpclient" />
</exclusions>
</dependency>
</dependency>

<dependency groupId="com.beust" artifactId="jcommander" version="1.47" dest="${lib.dir}" type="jar" unzip="false"/>
<dependency groupId="net.minidev" artifactId="json-smart-mini" version="1.0.8" unzip="false" type="jar" dest="${lib.dir}"/>
Expand Down
40 changes: 40 additions & 0 deletions src/cfml/system/BaseTask.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,46 @@ component accessors="true" extends='commandbox.system.BaseCommand' {
wirebox.getInstance( 'moduleService' ).registerAndActivateModule( moduleName, invocationPath );
}

/**
* Loads an array of module directories. All modules will be registered first. Then all will be activated.
*/
function loadModules( required array moduleDirectories ) {
if( !moduleDirectories.len() ) {
return;
}
var moduleService = wirebox.getInstance( 'moduleService' );

// Do a pass to convert the array of paths into a struct where the key is the module name and the value is the invocation path
var modulesToLoad = moduleDirectories.reduce( (modulesToLoad,moduleDirectory)=>{
// Expand path relative to the task CFC.
moduleDirectory = resolvePath( moduleDirectory );

// A little validation...
if( !directoryExists( moduleDirectory ) ) {
error( 'Cannot load module. Path [#moduleDirectory#] doesn''t exist.' );
}

// Generate a CF mapping that points to the module's folder
var relativeModulePath = fileSystemUtil.makePathRelative( moduleDirectory );

// A dot delimited path that points to the folder containing the module
var invocationPath = relativeModulePath
.listChangeDelims( '.', '/\' )
.listDeleteAt( relativeModulePath.listLen( '/\' ), '.' );

// The name of the module
var moduleName = relativeModulePath.listLast( '/\' );

modulesToLoad[ moduleName ] = invocationPath;
return modulesToLoad;
} );

// Register all of them
modulesToLoad.each( (moduleName,invocationPath)=>moduleService.registerModule( moduleName, invocationPath ) );
// Activate all of them
modulesToLoad.each( (moduleName)=>moduleService.activateModule( moduleName ) );
}

/**
* This resolves an absolute or relative path using the rules of the operating system and CLI.
* It doesn't follow CF mappings and will also always return a trailing slash if pointing to
Expand Down
6 changes: 2 additions & 4 deletions src/cfml/system/Shell.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ component accessors="true" singleton {
property name="configService" inject="configService";
property name='systemSettings' inject='SystemSettings';
property name='endpointService' inject='endpointService';
property name='JSONService' inject='JSONService';

/**
* The java jline reader class.
Expand Down Expand Up @@ -872,10 +873,7 @@ component accessors="true" singleton {

// We get to output the results ourselves
if( !isNull( result ) && !isSimpleValue( result ) ){
if( isArray( result ) ){
return variables.reader.getTerminal().writer().printColumns( result );
}
result = variables.formatterUtil.formatJson( result );
result = variables.formatterUtil.formatJson( JSON=result, ANSIColors=JSONService.getANSIColors() );
printString( result );
} else if( !isNull( result ) && len( result ) ) {
// If there is an active job, print our output through it
Expand Down
1 change: 1 addition & 0 deletions src/cfml/system/config/CommandBoxDSL.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ component implements="wirebox.system.ioc.dsl.IDSLBuilder" accessors=true{
case "ConfigSettings" : { return getInjector().getInstance( 'ConfigService' ).getConfigSettings(); }
case "interceptorService" : { return getInjector().getInstance( 'interceptorService' ); }
case "moduleService" : { return getInjector().getInstance( 'moduleService' ); }
case "asyncManager" : { return getInjector().getAsyncManager(); }
}

break;
Expand Down
Loading

0 comments on commit 5415d37

Please sign in to comment.