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 Jan 9, 2017
2 parents c6472ec + 52f0878 commit 500dbfb
Show file tree
Hide file tree
Showing 48 changed files with 2,224 additions and 581 deletions.
1 change: 1 addition & 0 deletions apidocs/index.cfm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<cfsetting requesttimeout="600">
<cfparam name="url.version" default="1.0.0">
<cfparam name="url.path" default="#expandPath( "./CommandBox-CommandDocs" )#">
<cfscript>
Expand Down
1 change: 1 addition & 0 deletions apidocs/internal.cfm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!---
This will produce the internal API Docs for CommandBox.
--->
<cfsetting requesttimeout="600">
<cfparam name="url.version" default="1.0.0">
<cfparam name="url.path" default="#expandPath( "./CommandBox-APIDocs" )#">
<cfscript>
Expand Down
2 changes: 1 addition & 1 deletion build/build-auto.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#java build
java.pack200=true
java.pack200=false
local.build=false

#build locations
Expand Down
7 changes: 3 additions & 4 deletions build/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ commandbox.description=CommandBox is a ColdFusion (CFML) CLI, Package Manager, S
#java build
java.compiler=1.7
java.debug=true
java.pack200=false

#dependencies
dependencies.dir=${basedir}/lib
cfml.version=4.5.3.020
cfml.loader.version=1.4.1
cfml.version=4.5.4.017
cfml.loader.version=1.4.6
cfml.cli.version=${cfml.loader.version}.${cfml.version}
lucee.version=${cfml.version}
jre.version=1.8.0_102
launch4j.version=3.4
runwar.version=3.4.11
runwar.version=3.5.0

#build locations
build.type=localdev
Expand Down
34 changes: 24 additions & 10 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ External Dependencies:
<!-- Version: UPDATE ON EACH RELEASE AS NEEDED -->
<property name="distro.groupID" value="ortussolutions" />
<property name="distro.name" value="commandbox"/>
<property name="commandbox.version" value="3.4.0"/>
<property name="commandbox.stableVersion" value="3.4.0"/>
<!-- Special things happen when the version and stableVersion are the same value as that signifies a "stable" build. -->
<property name="commandbox.version" value="3.5.0"/>
<property name="commandbox.stableVersion" value="3.5.0"/>

<!-- Time Label -->
<tstamp prefix="start"/>
Expand Down Expand Up @@ -182,14 +183,14 @@ External Dependencies:

<!-- Configure Lucee Web Dir -->
<configure-lucee-web
config-server="${temp.dir}/engine/cfml/cli/cfml-server/context/lucee-server.xml"
config-server="${temp.dir}/engine/cfml/cli/lucee-server/context/lucee-server.xml"
config-web="${temp.dir}/engine/cfml/cli/cfml-web/lucee-web.xml.cfm"
dump-cfc="${temp.dir}/engine/cfml/cli/cfml-server/context/library/tag/Dump.cfc"/>
dump-cfc="${temp.dir}/engine/cfml/cli/lucee-server/context/library/tag/Dump.cfc"/>
<antcontrib:var name="lucee.config.file" value="${temp.dir}/engine/cfml/cli/cfml-web/lucee-web.xml.cfm" />

<!-- update lucee password -->
<lucee-password
server-password="commandbox" config-server-file="${temp.dir}/engine/cfml/cli/cfml-server/context/lucee-server.xml"
server-password="commandbox" config-server-file="${temp.dir}/engine/cfml/cli/lucee-server/context/lucee-server.xml"
web-password="commandbox" config-web-file="${temp.dir}/engine/cfml/cli/cfml-web/lucee-web.xml.cfm"
/>

Expand Down Expand Up @@ -270,8 +271,9 @@ External Dependencies:

<!-- create the libs zip including cli loader, optionally use pack200 -->
<antcontrib:if>
<equals arg1="${java.pack200}" arg2="true" />
<equals arg1="${isStable}" arg2="true" />
<then>
<echo>This is a stable build, let's compress these jars!</echo>
<delete dir="${temp.dir}/packlibs" />
<mkdir dir="${temp.dir}/packlibs"/>
<mkdir dir="${temp.dir}/packlibs/packed"/>
Expand Down Expand Up @@ -485,9 +487,13 @@ External Dependencies:
<exec executable="${dist.dir}/box" dir="${dir.apidocs}">
<arg line="${cmdboxhome.arg} install" />
</exec>
<!-- Ensure server isn't still running -->
<exec executable="${dist.dir}/box" dir="${dir.apidocs}">
<arg line="${cmdboxhome.arg} server stop" />
</exec>
<!-- Startup the apidocs server, wait for a few seconds for server to start -->
<exec executable="${dist.dir}/box" dir="${dir.apidocs}">
<arg line="${cmdboxhome.arg} server start openbrowser=false --force port=${apidocs.port} --!saveSettings" />
<arg line="${cmdboxhome.arg} server start openbrowser=false --force port=${apidocs.port} --noSaveSettings --debug" />
</exec>
<sleep seconds="5"/>

Expand All @@ -512,8 +518,15 @@ External Dependencies:
<get dest="${temp.dir}/docbox.html"
src="${url.apidocs}/internal.cfm?version=${commandbox.version}&amp;path=${temp.dir.absolute}/apidocs"
verbose="true"
retries="5"/>
retries="5"
ignoreerrors="true" />

<delete file="${temp.dir}/docbox.html" />

<!-- stop server -->
<exec executable="${dist.dir}/box" dir="${dir.apidocs}">
<arg line="${cmdboxhome.arg} server log" />
</exec>

<!-- Zip API Docs -->
<zip destfile="${dist.dir}/${distro.name}-core-apidocs-${commandbox.version}.zip" basedir="${temp.dir}/apidocs"></zip>
Expand Down Expand Up @@ -603,7 +616,7 @@ External Dependencies:
</target>

<!-- Build including JREs -->
<target name="build.cli.jre" description="Build with JRE included" depends="build.cli.bin,build.cli.exe" unless="${local.build}">
<target name="build.cli.jre" description="Build with JRE included" depends="build.cli.bin,build.cli.exe" if="${isStable}">
<echo message="Bundling ${jre.version} JRE" />

<!-- Get JRE Dependencies -->
Expand Down Expand Up @@ -792,7 +805,8 @@ External Dependencies:
</dependency>
<dependency groupId="org.fusesource.jansi" artifactId="jansi" unzip="false" version="1.11" type="jar" dest="${lib.dir}" />
-->
<dependency groupId="jline" artifactId="jline" version="2.12.1" dest="${lib.dir}" type="jar" unzip="false"/>
<mvn-repo id="sonatype" url="https://oss.sonatype.org/content/repositories/snapshots/" />
<dependency repoId="sonatype" groupId="jline" artifactId="jline" version="2.15-SNAPSHOT" dest="${lib.dir}" type="jar" unzip="false"/>
<dependency groupId="org.eclipse.jgit" artifactId="org.eclipse.jgit" version="4.3.0.201604071810-r" dest="${lib.dir}" repoId="jgit-repository" unzip="false" type="jar">
<exclusions>
<!-- Lucee already includes these jars -->
Expand Down
2 changes: 1 addition & 1 deletion src/cfml/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ component{
// Move everything over to this mapping which is the "root" of our app
CFMLRoot = getDirectoryFromPath( getMetadata( this ).path );
this.mappings[ '/commandbox' ] = CFMLRoot;
this.mappings[ '/commandbox-home' ] = expandPath( CFMLRoot & '/../' );
this.mappings[ '/commandbox-home' ] = createObject( 'java', 'java.lang.System' ).getProperty( 'cfml.cli.home' );
this.mappings[ '/wirebox' ] = CFMLRoot & '/system/wirebox';

function onApplicationStart(){
Expand Down
10 changes: 6 additions & 4 deletions src/cfml/system/BaseCommand.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,17 @@ component accessors="true" singleton {
function getCWD() {
return shell.pwd();
}

/**
* Ask the user a question and wait for response
* ask the user a question and wait for response
* @message.hint message to prompt the user with
* @mask.hint When not empty, keyboard input is masked as that character
*
* @return the response from the user
**/
function ask( required message, string mask='' ) {
string function ask( message, string mask='', string defaultResponse='' ) {
print.toConsole();
return shell.ask( arguments.message, arguments.mask );
return shell.ask( arguments.message, arguments.mask, arguments.defaultResponse );
}

/**
Expand Down
30 changes: 15 additions & 15 deletions src/cfml/system/Bootstrap.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ This file will stay running the entire time the shell is open
<cfset variables.wireBox = application.wireBox>
<cfsetting requesttimeout="999999" />
<!---Display this banner to users--->
<cfsavecontent variable="banner">
_____ _ ____
/ ____| | | _ \
| | ___ _ __ ___ _ __ ___ __ _ _ __ __| | |_) | _____ __
| | / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` | _ < / _ \ \/ /
| |___| (_) | | | | | | | | | | | (_| | | | | (_| | |_) | (_) > <
\_____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|____/ \___/_/\_\ v@@version@@
<cfoutput><cfsavecontent variable="banner">#chr( 27 )#[32m#chr( 27 )#[40m#chr( 27 )#[1m
_____ _ ____
/ ____| | | _ \
| | ___ _ __ ___ _ __ ___ __ _ _ __ __| | |_) | _____ __
| | / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` | _ < / _ \ \/ /
| |___| (_) | | | | | | | | | | | (_| | | | | (_| | |_) | (_) > <
\_____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|____/ \___/_/\_\ #chr( 27 )#[0m v@@version@@

Welcome to CommandBox!
Type "help" for help, or "help [command]" to be more specific.
</cfsavecontent>
#chr( 27 )#[1mWelcome to CommandBox!
Type "help" for help, or "help [command]" to be more specific.#chr( 27 )#[0m

</cfsavecontent></cfoutput>
<cfscript>
system = createObject( "java", "java.lang.System" );
args = system.getProperty( "cfml.cli.arguments" );
Expand Down Expand Up @@ -105,17 +106,16 @@ Type "help" for help, or "help [command]" to be more specific.
if( !silent ) {
// Output the welcome banner
systemOutput( replace( interceptData.banner, '@@version@@', shell.getVersion() ) );
shell.printString( replace( interceptData.banner, '@@version@@', shell.getVersion() ) );
}
// Running the "reload" command will enter this while loop once
while( shell.run( silent=silent ) ){
clearScreen = shell.getDoClearScreen();
interceptorService.announceInterception( 'onCLIExit' );
interceptorService.announceInterception( 'onCLIExit' );
if( clearScreen ){
shell.getReader().clearScreen();
shell.clearScreen();
}
// Clear all caches: template, ...
Expand All @@ -137,7 +137,7 @@ Type "help" for help, or "help [command]" to be more specific.
if( clearScreen ){
// Output the welcome banner
systemOutput( replace( interceptData.banner, '@@version@@', shell.getVersion() ) );
shell.printString( replace( interceptData.banner, '@@version@@', shell.getVersion() ) );
}
}
Expand Down
49 changes: 27 additions & 22 deletions src/cfml/system/Shell.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ component accessors="true" singleton {
required string tempDir,
boolean asyncLoad=true
){
// Possible byte order marks
variables.BOMS = [
chr( 254 ) & chr( 255 ),
chr( 255 ) & chr( 254 ),
chr( 239 ) & chr( 187 ) & chr( 191 ),
chr( 00 ) & chr( 254 ) & chr( 255 ),
chr( 255 ) & chr( 254 ) & chr( 00 )
];

// Version is stored in cli-build.xml. Build number is generated by Ant.
// Both are replaced when CommandBox is built.
Expand Down Expand Up @@ -197,21 +205,22 @@ component accessors="true" singleton {
* ask the user a question and wait for response
* @message.hint message to prompt the user with
* @mask.hint When not empty, keyboard input is masked as that character
* @defaultResponse Text to populate the buffer with by default that will be submitted if the user presses enter without typing anything
*
* @return the response from the user
**/
string function ask( message, string mask='', string buffer='' ) {
string function ask( message, string mask='', string defaultResponse='' ) {

try {
// read reponse while masking input
var input = variables.reader.readLine(
// Prompt for the user
arguments.message,
// Optionally mask their input
len( arguments.mask ) ? javacast( "char", left( arguments.mask, 1 ) ) : javacast( "null", '' )//,
len( arguments.mask ) ? javacast( "char", left( arguments.mask, 1 ) ) : javacast( "null", '' ),
// This won't work until we can upgrade to Jline 2.14
// Optionally pre-fill a default response for them
// len( arguments.buffer ) ? javacast( "String", arguments.buffer ) : javacast( "null", '' )
len( arguments.defaultResponse ) ? javacast( "String", arguments.defaultResponse ) : javacast( "null", '' )
);
} catch( jline.console.UserInterruptException var e ) {
throw( message='CANCELLED', type="UserInterruptException");
Expand Down Expand Up @@ -262,22 +271,9 @@ component accessors="true" singleton {
* @note Almost works on Windows, but doesn't clear text background
*
**/
Shell function clearScreen( addLines = true ) {
// This outputs a double prompt due to the redrawLine() call
// reader.clearScreen();

// A temporary workaround for windows. Since background colors aren't cleared
// this will force them off the screen with blank lines before clearing.
if( variables.fileSystem.isWindows() && arguments.addLines ) {
var i = 0;
while( ++i <= getTermHeight() + 5 ) {
variables.reader.println();
}
}

variables.reader.print( '' );
variables.reader.print( '' );

Shell function clearScreen() {
reader.clearScreen();
variables.reader.flush();
return this;
}

Expand Down Expand Up @@ -413,12 +409,19 @@ component accessors="true" singleton {
} else {
line = variables.reader.readLine();
}

// If the standard input isn't avilable, bail. This happens
// when commands are piped in and we've reached the end of the piped stream
if( !isDefined( 'line' ) ) {
return false;
}

// Clean BOM from start of text in case something was piped from a file
BOMS.each( function( i ){
if( line.startsWith( i ) ) {
line = replace( line, i, '' );
}
} );

// If there's input, try to run it.
if( len( trim( line ) ) ) {
Expand Down Expand Up @@ -539,11 +542,13 @@ component accessors="true" singleton {

setExitCode( 1 );

getInterceptorService().announceInterception( 'onException', { exception=err } );
// If CommandBox blows up while starting, the interceptor service won't be ready yet.
if( getInterceptorService().getConfigured() ) {
getInterceptorService().announceInterception( 'onException', { exception=err } );
}

variables.logger.error( '#arguments.err.message# #arguments.err.detail ?: ''#', arguments.err.stackTrace ?: '' );


variables.reader.print( variables.print.whiteOnRedLine( 'ERROR (#variables.version#)' ) );
variables.reader.println();
variables.reader.print( variables.print.boldRedText( variables.formatterUtil.HTML2ANSI( arguments.err.message ) ) );
Expand Down
Binary file added src/cfml/system/config/server-icons/trayicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/cfml/system/config/urlrewrite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<note>Generic Front-Controller URLs</note>
<!-- These are paths that don't exist on disk, but shouldn't get rewritten since the CF engine treats them special. -->
<condition type="request-uri" operator="notequal">/(flex2gateway|flashservices/gateway|messagebroker|lucee|rest|cfide|CFIDE|cfformgateway|jrunscripts)/.*</condition>
<!-- Ignore any path to a .cfm or .cfml file in a sub directory that has a path info attached. These won't trigger as "real" directories below
since the rewrite filter doesn't know what part is the actual file name. Note, the ses path info servlet filter hasn't fired yet. -->
<condition type="request-uri" operator="notequal">/.*\.cf(m|ml)/.*</condition>
<!-- Do not rewrite paths that point to real files or directories -->
<condition type="request-filename" operator="notdir"/>
<condition type="request-filename" operator="notfile"/>
Expand Down
Loading

0 comments on commit 500dbfb

Please sign in to comment.