Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/development'
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Jun 17, 2019
2 parents c9dd2f1 + 641ab35 commit 4c7e623
Show file tree
Hide file tree
Showing 40 changed files with 1,328 additions and 833 deletions.
6 changes: 3 additions & 3 deletions build/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ java.debug=true
#dependencies
dependencies.dir=${basedir}/lib
cfml.version=5.2.9.31
cfml.loader.version=2.2.11
cfml.loader.version=2.3.0
cfml.cli.version=${cfml.loader.version}.${cfml.version}
lucee.version=${cfml.version}
lucee.config.version=5.2.4.37
jre.adoptVesionr=openjdk8
jre.version=jdk8u202-b08
launch4j.version=3.12
runwar.version=3.8.1-SNAPSHOT
jline.version=3.8.2
jgit.version=5.0.1.201806211838-r
jline.version=3.10.0
jgit.version=5.3.0.201903130848-r

#build locations
build.type=localdev
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="4.6.0"/>
<property name="commandbox.stableVersion" value="4.6.0"/>
<property name="commandbox.version" value="4.7.0"/>
<property name="commandbox.stableVersion" value="4.7.0"/>

<!-- Time Label -->
<tstamp prefix="start"/>
Expand Down
36 changes: 11 additions & 25 deletions src/cfml/system/Bootstrap.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ This file will stay running the entire time the shell is open
args = system.getProperty( "cfml.cli.arguments" );
argsArray = deserializeJSON( system.getProperty( "cfml.cli.argument.array" ) );
// System.in is usually the keyboard input, but if the output of another command or a file
// was piped into CommandBox, System.in will represent that input. Wrap System.in
// in a buffered reader so we can check it.
inputStreamReader = createObject( 'java', 'java.io.InputStreamReader' ).init( system.in );
bufferedReader = createObject( 'java', 'java.io.BufferedReader' ).init( inputStreamReader );
// Verify if we can run CommandBox Java v. 1.7+
if( !findNoCase( "1.8", server.java.version ) && 0 ){
// JLine isn't loaded yet, so I have to use systemOutput() here.
Expand All @@ -115,30 +109,22 @@ This file will stay running the entire time the shell is open
interceptData = { shellType=shell.getShellType(), args=argsArray, banner=getBanner() };
interceptorService.announceInterception( 'onCLIStart', interceptData );
piped = [];
hasPiped = false;
// If data is piped to CommandBox, it will be in this buffered reader
while ( bufferedReader.ready() ) {
// Read all the lines and append them together.
piped.append( bufferedReader.readLine() );
hasPiped = true;
}
// If data was piped via standard input
if( hasPiped ) {
// Concat lines back together
piped = arrayToList( piped, chr( 10 ) );
shell.callCommand( command=argsArray, piped=piped, initialCommand=true );
} else {
shell.callCommand( command=argsArray, initialCommand=true );
}
shell.callCommand( command=argsArray, initialCommand=true );
// flush console
shell.getReader().flush();
// "box" was called all by itself with no commands
} else {
// System.in is usually the keyboard input, but if the output of another command or a file
// was piped into CommandBox, System.in will represent that input. Wrap System.in
// in a buffered reader so we can check it.
//inputStreamReader = createObject( 'java', 'java.io.InputStreamReader' ).init( system.in );
//bufferedReader = createObject( 'java', 'java.io.BufferedReader' ).init( inputStreamReader );
// If the standard input has content waiting, cut the chit chat and just run the commands so we can exit.
silent = bufferedReader.ready();
silent = false;
inStream = system.in;
// Create the shell
Expand All @@ -149,7 +135,7 @@ This file will stay running the entire time the shell is open
interceptData = { shellType=shell.getShellType(), args=argsArray, banner=getBanner() };
interceptorService.announceInterception( 'onCLIStart', interceptData );
if( !silent ) {
// Output the welcome banner
shell.printString( interceptData.banner );
Expand Down
7 changes: 4 additions & 3 deletions src/cfml/system/Shell.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,9 @@ component accessors="true" singleton {
throw( message='CANCELLED', type="UserInterruptException");
// user wants to exit the entire shell, they've pressed Ctrl-D
} catch( org.jline.reader.EndOfFileException var e ) {
setKeepRunning( false );
throw( message='CANCELLED', type="UserInterruptException");
// This should probably just read what is currently on the buffer,
// but JLine doesn't give me a way to get that currently
throw( message='EOF', type="EndOfFileException");
} finally{
// Reset back to default prompt
setPrompt();
Expand Down Expand Up @@ -793,7 +794,7 @@ component accessors="true" singleton {
if( !initialCommand ) {
rethrow;
// This type of error means the user hit Ctrl-C, when not in a readLine() call (and hit my custom signal handler). Duck out and move along.
} else if( e.getPageException().getRootCause().getClass().getName() == 'java.lang.InterruptedException' || e.type == 'UserInterruptException' || e.message == 'UserInterruptException' ) {
} else if( e.getPageException().getRootCause().getClass().getName() == 'java.lang.InterruptedException' || e.type == 'UserInterruptException' || e.message == 'UserInterruptException' || e.type == 'EndOfFileException' ) {

progressBarGeneric.clear();
if( job.isActive() ) {
Expand Down
8 changes: 3 additions & 5 deletions src/cfml/system/box.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
"shortDescription":"This tracks the CommandBox core dependencies",
"dependencies":{
"string-similarity":"^1.0.0",
"semver":"^1.0.0",
"semver":"^1.2.3",
"globber":"^2.0.0",
"JSONPrettyPrint":"^1.0.0",
"propertyFile":"^1.0.9"
},
"devDependencies":{

},
"devDependencies":{},
"installPaths":{
"string-similarity":"modules\\string-similarity",
"semver":"modules\\semver",
"semver":"modules/semver/",
"globber":"modules\\globber",
"JSONPrettyPrint":"modules\\JSONPrettyPrint",
"propertyFile":"modules\\propertyFile"
Expand Down
75 changes: 49 additions & 26 deletions src/cfml/system/config/CommandBoxDSL.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ component implements="wirebox.system.ioc.dsl.IDSLBuilder" accessors=true{
switch( thisLocationKey ){
case "moduleConfig" : { return getInjector().getInstance( 'ModuleService' ).getModuleData(); }
case "ConfigSettings" : { return getInjector().getInstance( 'ConfigService' ).getConfigSettings(); }
case "interceptorService" : { return getInjector().getInstance( 'interceptorService' ); }
case "moduleService" : { return getInjector().getInstance( 'moduleService' ); }
}

break;
Expand All @@ -63,29 +65,45 @@ component implements="wirebox.system.ioc.dsl.IDSLBuilder" accessors=true{
// Check for module existance
if( structKeyExists(moduleConfig, thisLocationKey ) ){
return moduleConfig[ thisLocationKey ];
} else if( getLog().canDebug() ){
getLog().debug("The module requested: #thisLocationKey# does not exist in the loaded modules. Loaded modules are #structKeyList(moduleConfig)#");
} else {
throw( message="CommandBox DSL cannot find dependency using definition: #arguments.definition.toString()#", detail="The module requested: #thisLocationKey# does not exist in the loaded modules. Loaded modules are #structKeyList(moduleConfig)#" );
}
}
case "interceptor" : {
return getInjector().getInstance( 'interceptorService' ).getInterceptor( thisLocationKey );
}
case "modulesettings" : {
var moduleConfig = getInjector().getInstance( 'ModuleService' ).getModuleData();
// Check for module existance
if( structKeyExists(moduleConfig, thisLocationKey ) ){
return moduleConfig[ thisLocationKey ].settings;
} else if( getLog().canDebug() ){
getLog().debug("The module requested: #thisLocationKey# does not exist in the loaded modules. Loaded modules are #structKeyList(moduleConfig)#");
} else {
throw( message="CommandBox DSL cannot find dependency using definition: #arguments.definition.toString()#", detail="The module requested: #thisLocationKey# does not exist in the loaded modules. Loaded modules are #structKeyList(moduleConfig)#" );
}
}
case "ConfigSettings" : {
var configService = getInjector().getInstance( 'ConfigService' );
var configSettings = configService.getConfigSettings();

// Check for setting existance
if( configService.settingExists( thisLocationKey ) ){
return configService.getSetting( thisLocationKey );
} else if( getLog().canDebug() ){
getLog().debug("The config setting requested: #thisLocationKey# does not exist in the loaded settings. Loaded settings are #structKeyList(configSettings)#");
case "setting" : case "ConfigSettings" : {

// Getting setting from module
if( thisLocationKey contains '@' ) {

thisLocationToken = listFirst( thisLocationKey, '@' );
thisLocationKey = listRest( thisLocationKey, '@' );

return getModuleSetting( definition, thisLocationKey, thisLocationToken );

} else {

var configService = getInjector().getInstance( 'ConfigService' );
var configSettings = configService.getConfigSettings();

// Check for setting existance
if( configService.settingExists( thisLocationKey ) ){
return configService.getSetting( thisLocationKey );
} else {
throw( message="CommandBox DSL cannot find dependency using definition: #arguments.definition.toString()#", detail="The config setting requested: #thisLocationKey# does not exist in the loaded settings. Loaded settings are #structKeyList(configSettings)#" );
}
}

}
}
break;
Expand All @@ -97,28 +115,33 @@ component implements="wirebox.system.ioc.dsl.IDSLBuilder" accessors=true{
thisLocationToken = getToken(thisType,4,":");
switch(thisLocationType){
case "modulesettings" : {
var moduleConfig = getInjector().getInstance( 'ModuleService' ).getModuleData();
// Check for module existance
if( structKeyExists(moduleConfig, thisLocationKey ) ){
// Check for setting existance
if( structKeyExists( moduleConfig[ thisLocationKey ].settings, thisLocationToken ) ) {
return moduleConfig[ thisLocationKey ].settings[ thisLocationToken ];
} else if( getLog().canDebug() ){
getLog().debug("The module requested: #thisLocationKey# does not exist in the loaded modules. Loaded modules are #structKeyList(moduleConfig)#");
}
} else if( getLog().canDebug() ){
getLog().debug("The module requested: #thisLocationKey# does not exist in the loaded modules. Loaded modules are #structKeyList(moduleConfig)#");
}
return getModuleSetting( definition, thisLocationKey, thisLocationToken );
}
}
break;
}
}

throw( "CommandBox DSL cannot find dependency using definition: #arguments.definition.toString()#" );
throw( message="CommandBox DSL cannot find dependency using definition: #arguments.definition.toString()#", detail="Unkonwn DSL" );

}

function getModuleSetting( definition, thisLocationKey, thisLocationToken ) {

var moduleConfig = getInjector().getInstance( 'ModuleService' ).getModuleData();
// Check for module existance
if( structKeyExists(moduleConfig, thisLocationKey ) ){
// Check for setting existance
if( structKeyExists( moduleConfig[ thisLocationKey ].settings, thisLocationToken ) ) {
return moduleConfig[ thisLocationKey ].settings[ thisLocationToken ];
} else {
throw( message="CommandBox DSL cannot find dependency using definition: #arguments.definition.toString()#", detail="The setting requested: #thisLocationToken# does not exist in this module. Loaded settings are #structKeyList(moduleConfig[ thisLocationKey ].settings)#" );
}
} else {
throw( message="CommandBox DSL cannot find dependency using definition: #arguments.definition.toString()#", detail="The module requested: #thisLocationKey# does not exist in the loaded modules. Loaded modules are #structKeyList(moduleConfig)#" );
}

}


}
3 changes: 3 additions & 0 deletions src/cfml/system/config/WireBox.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ component extends='wirebox.system.ioc.config.Binder' {

// Register CommandBox DSL for special injection namespaces
mapDSL( 'commandbox', 'commandbox.system.config.CommandBoxDSL' );
mapDSL( 'box', 'commandbox.system.config.CommandBoxDSL' );
}

function onLoad() {
Expand All @@ -53,6 +54,7 @@ component extends='wirebox.system.ioc.config.Binder' {
var REPLScriptHistoryFile = homedir & '/.history-repl-script';
var REPLTagHistoryFile = homedir & '/.history-repl-tag';
var cr = chr( 10 );
var fileSeparator = system.getProperty( 'file.separator' );
var commandLocations = [
// This is where user-installed commands are stored
// This is deprecated in favor of modules, but leaving it so 'old' style commands will still load.
Expand All @@ -74,6 +76,7 @@ component extends='wirebox.system.ioc.config.Binder' {
map( 'REPLScriptHistoryFile@constants' ).toValue( REPLScriptHistoryFile );
map( 'REPLTagHistoryFile@constants' ).toValue( REPLTagHistoryFile );
map( 'cr@constants' ).toValue( cr );
map( 'fileSeparator@constants' ).toValue( fileSeparator );
map( 'commandLocations@constants' ).toValue( commandLocations );
map( 'ortusArtifactsURL@constants' ).toValue( ortusArtifactsURL );
map( 'ortusPRDArtifactsURL@constants' ).toValue( ortusPRDArtifactsURL );
Expand Down
Loading

0 comments on commit 4c7e623

Please sign in to comment.