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 14, 2016
2 parents d9041ed + 68cb9c5 commit 68d2879
Show file tree
Hide file tree
Showing 109 changed files with 3,554 additions and 889 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ build/launch4j
tests/testbox
/mxunit
/apidocs/CommandBox-CommandDocs/
/apidocs/CommandBox-APIDocs/
build-local.properties
build/resources
src/cfml/.version
Expand Down
7 changes: 1 addition & 6 deletions apidocs/box.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version":"1.0.0",
"slug":"commandbox-apidocs",
"private":true,
"defaultPort":8989,
"dependencies":{
"docbox":"https://github.com/Ortus-Solutions/DocBox/archive/v2.0.4.zip"
},
Expand All @@ -12,9 +11,5 @@
},
"installPaths":{
"docbox":"docbox"
},
"ignore":[
"**/.*",
"tests"
]
}
}
29 changes: 29 additions & 0 deletions apidocs/internal.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!---
This will produce the internal API Docs for CommandBox.
--->
<cfparam name="url.version" default="1.0.0">
<cfparam name="url.path" default="#expandPath( "./CommandBox-APIDocs" )#">
<cfscript>
try{
docName = "CommandBox-APIDocs";
docbox = new docBox.DocBox(
properties = {
projectTitle = "CommandBox Internal v#url.version#",
outputDir = url.path
}
);
docbox.generate(
source = expandPath( "/commandbox/system" ),
mapping = "commandbox.system",
excludes = "system\/(modules)"
);
} catch ( Any e ){
writeOutput( e.message & e.detail );
writeDump( "<hr>" & e.stacktrace );
abort;
}
</cfscript>
<cfoutput>
<h1>Command Internal API Docs Done!</h1>
<a href="#docName#/index.html">Go to Docs!</a>
</cfoutput>
9 changes: 9 additions & 0 deletions apidocs/server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"force":true,
"openbrowser":"false",
"web":{
"http":{
"port":8989
}
}
}
11 changes: 6 additions & 5 deletions build/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ java.pack200=false
#dependencies
dependencies.dir=${basedir}/lib
cfml.version=4.5.2.018
cfml.loader.version=1.1.0
cfml.loader.version=1.3.3
cfml.cli.version=${cfml.loader.version}.${cfml.version}
lucee.version=4.5.2.018
jre.version=1.8.0_72
jre.version=1.8.0_77
launch4j.version=3.4
runwar.version=3.3.3
runwar.version=3.4.5

#build locations
build.type=localdev
Expand Down Expand Up @@ -46,13 +46,14 @@ ortus.repoPRDURL=http://downloads.ortussolutions.com
#apidocs properties
dir.apidocs=../apidocs
apidocs.port=8989
url.apidocs=http://localhost:${apidocs.port}/index.cfm
url.apidocs=http://localhost:${apidocs.port}

### testwar settings ###
default.cfengine=railo
default.cfengine=lucee
war.contextpath=/
war.name=${distro.name}
war.target.dir=${temp.dir}/${war.name}.war
server.jvm.args=-Xms256M -Xmx1024M -Djava.net.preferIPv4Stack=true -Dcfml.cli.home=${build.location}/temp/CommandBoxHome
cfdistro.build.file=${user.home}/cfdistro/build.xml
railo.javac.compiler=1.7
add.libs.dir=../lib
Expand Down
79 changes: 64 additions & 15 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ 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.0.1"/>
<property name="commandbox.stableVersion" value="3.0.1"/>
<property name="commandbox.version" value="3.1.0"/>
<property name="commandbox.stableVersion" value="3.1.0"/>

<!-- Time Label -->
<tstamp prefix="start"/>
Expand All @@ -26,6 +26,7 @@ External Dependencies:
<include name="**/*.jar" />
</fileset>
</path>
<property name="build.location" location="${basedir}"/>

<!-- Define Tasks -->
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="build.antcontrib.libpath" />
Expand All @@ -48,6 +49,12 @@ External Dependencies:
<echo>Loading base properties</echo>
<loadproperties srcFile="build.properties"/>

<!-- Load secret properties -->
<property file="/root/creds/secret.properties"/>
<property name="ortus.sign.keyring" value=""/>
<property name="ortus.sign.key.id" value=""/>
<property name="ortus.sign.key.passphrase" value=""/>

<!-- import cfdistro -->
<import file="${cfdistro.build.file}"/>
<property name="maven.repo.local" value="${cfdistro.basedir}/artifacts"/>
Expand Down Expand Up @@ -101,6 +108,17 @@ External Dependencies:
<property name="src.isInit" value="true" />
</target>

<!-- create script to run built commandbox using sources (for core cfml development) -->
<target name="build.runsrc" description="script to run built commandbox using sources">
<property name="tmpHome" location="${temp.dir}/tmpcmdboxhome" />
<property name="bootstrap" location="${src.dir}/cfml/system/Bootstrap.cfm" />
<property name="cmd" value='java -jar box.jar -CommandBox_home="${tmpHome}" "${bootstrap}"' />
<delete dir="${tmpHome}" />
<echo file="${dist.dir}/runsrc.sh" message="${cmd}" />
<chmod file="${dist.dir}/runsrc.sh" perm="+x" />
<echo file="${dist.dir}/runsrc.bat" message="${cmd}" />
</target>

<!-- update permissions on reports -->
<target name="update.permissions" description="Update staging server permissions">
<!-- Integration permissions -->
Expand Down Expand Up @@ -383,32 +401,51 @@ External Dependencies:
<!-- Build API Docs -->
<target name="build.apidocs" description="Builds the api docs" depends="build.cli.bin">
<!-- Create APIDocs dir -->
<property name="cmdboxhome.arg" value="-CommandBox_home=${build.location}/temp/CommandBoxHome" />
<mkdir dir="${temp.dir}/apidocs"/>
<!-- Install dependencies for docs -->
<exec executable="${dist.dir}/box" dir="${dir.apidocs}">
<arg line="install" />
<arg line="${cmdboxhome.arg} install" />
</exec>
<!-- Startup the apidocs server, wait for a few seconds for server to start -->
<exec executable="${dist.dir}/box" dir="${dir.apidocs}">
<arg line="server start openbrowser=false --force port=${apidocs.port}" />
<arg line="${cmdboxhome.arg} server start openbrowser=false --force port=${apidocs.port} --!saveSettings" />
</exec>
<sleep seconds="5"/>

<!-- Get the apidocs now -->
<property name="temp.dir.absolute" location="${temp.dir}"/>
<get dest="${temp.dir}/docbox.html"
src="${url.apidocs}?version=${commandbox.version}&amp;path=${temp.dir.absolute}/apidocs"
src="${url.apidocs}/index.cfm?version=${commandbox.version}&amp;path=${temp.dir.absolute}/apidocs"
verbose="true"
retries="5"/>
<delete file="${temp.dir}/docbox.html" />
<!-- stop server -->
<exec executable="${dist.dir}/box" dir="${dir.apidocs}">
<arg line="server stop" />
</exec>

<!-- Zip API Docs -->
<zip destfile="${dist.dir}/${distro.name}-apidocs-${commandbox.version}.zip" basedir="${temp.dir}/apidocs"></zip>
<!-- Build Checksum -->
<checksum forceoverwrite="true" fileext=".md5" file="${dist.dir}/${distro.name}-apidocs-${commandbox.version}.zip" />
<checksum forceoverwrite="true" algorithm="sha" file="${dist.dir}/${distro.name}-apidocs-${commandbox.version}.zip" />

<!-- Wipe & recreate for core API docs -->
<delete dir="${temp.dir}/apidocs" />
<mkdir dir="${temp.dir}/apidocs"/>
<get dest="${temp.dir}/docbox.html"
src="${url.apidocs}/internal.cfm?version=${commandbox.version}&amp;path=${temp.dir.absolute}/apidocs"
verbose="true"
retries="5"/>
<delete file="${temp.dir}/docbox.html" />

<!-- Zip API Docs -->
<zip destfile="${dist.dir}/${distro.name}-core-apidocs-${commandbox.version}.zip" basedir="${temp.dir}/apidocs"></zip>
<!-- Build Checksum -->
<checksum forceoverwrite="true" fileext=".md5" file="${dist.dir}/${distro.name}-core-apidocs-${commandbox.version}.zip" />
<checksum forceoverwrite="true" algorithm="sha" file="${dist.dir}/${distro.name}-core-apidocs-${commandbox.version}.zip" />

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

<!-- Build linux/mac bin -->
Expand All @@ -419,14 +456,26 @@ External Dependencies:
<fileset file="${dist.dir}/box.jar" />
</concat>
<!-- Change execute perm -->
<chmod file="${dist.dir}/box" perm="a+x"/>
<chmod file="${dist.dir}/box" perm="755"/>
<!-- Create distro zip -->
<zip destfile="${dist.dir}/${distro.name}-bin-${commandbox.version}.zip" level="9" update="false">
<zipfileset file="${dist.dir}/box" filemode="711" prefix="" />
</zip>

<!-- Build SDK format. Same file/zip but with folders.] -->
<mkdir dir="${temp.dir}/sdk-bin/${distro.name}-${commandbox.version}/bin/"/>
<copy file="${dist.dir}/box" toDir="${temp.dir}/sdk-bin/${distro.name}-${commandbox.version}/bin/"/>

<!-- Create SDK zip -->
<zip destfile="${dist.dir}/${distro.name}-sdk-bin-${commandbox.version}.zip" level="9" update="false">
<zipfileset dir="${temp.dir}/sdk-bin/" filemode="711" />
</zip>

<!-- Build Checksum -->
<checksum file="${dist.dir}/${distro.name}-bin-${commandbox.version}.zip" forceoverwrite="true" fileext=".md5" />
<checksum file="${dist.dir}/${distro.name}-bin-${commandbox.version}.zip" forceoverwrite="true" algorithm="sha" />
<checksum file="${dist.dir}/${distro.name}-sdk-bin-${commandbox.version}.zip" forceoverwrite="true" fileext=".md5" />
<checksum file="${dist.dir}/${distro.name}-sdk-bin-${commandbox.version}.zip" forceoverwrite="true" algorithm="sha" />
</target>

<!-- Build windows executable -->
Expand Down Expand Up @@ -538,7 +587,6 @@ External Dependencies:

<target name="build.cli.deb" depends="build.cli.bin" description="builds a .deb file for debian-based systems ONLY!">
<!-- Load deb task -->
<loadproperties srcFile="/root/creds/secret.properties"/>
<taskdef-dependency name="debtask" classname="debrepo.ant.DebTask" artifactId="debrepo" groupId="org.cfmlprojects" version="1.0.0" />
<mkdir dir="${deb.repo}"/>
<debtask
Expand Down Expand Up @@ -654,8 +702,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" dest="${lib.dir}" type="jar" unzip="false"/>
<dependency groupId="org.eclipse.jgit" artifactId="org.eclipse.jgit" version="4.0.1.201506240215-r" dest="${lib.dir}" repoId="jgit-repository" unzip="false" type="jar">
<dependency groupId="jline" artifactId="jline" version="2.12.1" 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 -->
<exclusion groupId="org.slf4j" artifactId="slf4j-api" />
Expand Down Expand Up @@ -825,10 +873,11 @@ External Dependencies:

<target name="build.testwar" depends="cfdistro.build" description="creates test war">
<!-- creates a war for testing in dist/, use 'box-cli runwar.start.fg' to run -->
<dependency artifactId="testbox" groupId="org.coldbox" version="1.1.0" mapping="/testbox" />
<dependency artifactId="testbox" groupId="com.ortussolutions" version="2.4.0-SNAPSHOT" mapping="/testbox" />
<!-- set mapping for MXUnit compat -->
<mapping physical="@ext.mappings.dir@/org.coldbox/testbox/1.1.0/system/testing/compat" virtual="/mxunit"/>
<mapping physical="@ext.mappings.dir@/com/ortussolutions/testbox/2.4.0-SNAPSHOT/system/compat" virtual="/mxunit"/>
<!-- set mappings for sources, tests -->
<mapping virtual="/commandbox-home" physical="@temp.dir@/cfml" />
<mapping virtual="/commandbox" physical="@src.dir@/cfml" />
<mapping virtual="/wirebox" physical="@src.dir@/cfml/system/wirebox" />
<mapping virtual="/cfml" physical="@src.dir@/cfml" />
Expand Down
1 change: 1 addition & 0 deletions src/CommandBox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
9 changes: 5 additions & 4 deletions src/bin/box.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ then
fi

# Prepare Java arguments
java_args='-client'
java_args="$BOX_JAVA_ARGS -client"

##############################################################################
## OS SPECIFIC CLEANUP + ARGS
Expand All @@ -42,15 +42,16 @@ CYGWIN*)
Darwin)
if [ -e /System/Library/Frameworks/JavaVM.framework ]
then
java_args='
java_args="
$BOX_JAVA_ARGS
-client
-Dcom.apple.mrj.application.apple.menu.about.name=CommandBox
-Dcom.apple.mrj.application.growbox.intrudes=false
-Dapple.laf.useScreenMenuBar=true
-Xdock:name=CommandBox
-Dfile.encoding=UTF-8
-Djava.awt.headless=true
'
"
fi
;;
esac
Expand Down Expand Up @@ -84,4 +85,4 @@ fi
##############################################################################

exec "$java" $java_args cliloader.LoaderCLIMain "$@"
exit
exit
2 changes: 2 additions & 0 deletions src/cfml/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ component{

function onError( any exception, string eventName ) {

createObject( 'java', 'java.lang.System' ).setProperty( 'cfml.cli.exitCode', '1' );

// Try to log this to LogBox
try {
application.wireBox.getLogBox().getRootLogger().error( '#exception.message# #exception.detail ?: ''#', exception.stackTrace );
Expand Down
32 changes: 24 additions & 8 deletions src/cfml/system/BaseCommand.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ 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
**/
function ask( required message ) {
function ask( required message, string mask='' ) {
print.toConsole();
return shell.ask( arguments.message );
return shell.ask( arguments.message, arguments.mask );
}

/**
Expand Down Expand Up @@ -113,8 +114,7 @@ component accessors="true" singleton {

/**
* Use if if your command wants to give controlled feedback to the user without raising
* an actual exception which comes with a messy stack trace. "return" this command to stop execution of your command
* Alternativley, multuple errors can be printed by calling this method more than once prior to returning.
* an actual exception which comes with a messy stack trace.
* Use clearPrintBuffer to wipe out any output accrued in the print buffer.
*
* return error( "We're sorry, but happy hour ended 20 minutes ago." );
Expand All @@ -123,6 +123,7 @@ component accessors="true" singleton {
* @clearPrintBuffer.hint Wipe out the print buffer or not, it does not by default
**/
function error( required message, detail='', clearPrintBuffer=false ) {
setExitCode( 1 );
hasErrored = true;
if( arguments.clearPrintBuffer ) {
// Wipe
Expand All @@ -136,26 +137,41 @@ component accessors="true" singleton {
}

/**
* Tells you if the error() method has been called on this command. Useful if you have several validation checks, and then want
* to return at the end if one of them failed.
* Tells you if the error() method has been called on this command.
**/
function hasError() {
return hasErrored;
}

/**
* Sets the OS exit code
**/
function setExitCode( required string exitCode ) {
if( arguments.exitCode != 0 ) {
hasErrored = true;
}
return shell.setExitCode( arguments.exitCode );
}

/**
* This will open a file or folder externally in the default editor for the user.
* Useful for opening a new file for editing that was just created.
**/
function openPath( path ) {
runCommand( "edit '#parser.escapeArg( arguments.path )#'" );
// Defer to "open" command.
command( "open" )
.params( arguments.path )
.run();
}

/**
* This will open a URL in the user's browser
**/
function openURL( theURL ) {
runCommand( "browse '#parser.escapeArg( arguments.theURL)#'" );
// Defer to "browse" command.
command( "browse" )
.params( arguments.theURL )
.run();
}

}
Loading

0 comments on commit 68d2879

Please sign in to comment.