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 Aug 12, 2018
2 parents cb204aa + 57f1801 commit 5918e2d
Show file tree
Hide file tree
Showing 58 changed files with 1,925 additions and 2,944 deletions.
4 changes: 2 additions & 2 deletions build/build-ortushq.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ artifact.dir=${artifact.baseDir}${distro.groupID}/${distro.name}
dist.dir=${artifact.dir}/${commandbox.version}

#debian+rpm repos
rpm.repo=${artifact.baseDir}/RPMS/noarch
deb.repo=${artifact.baseDir}/debs/noarch
rpm.repo=${artifact.baseDir}/RPMS-be/noarch
deb.repo=${artifact.baseDir}/debs-be/noarch
rpm.repo.stable=${artifact.baseDir}/RPMS-stable/noarch
deb.repo.stable=${artifact.baseDir}/debs-stable/noarch
#mvn.type=snapshot#
12 changes: 6 additions & 6 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.2.7.63
cfml.loader.version=2.1.11
cfml.version=5.2.8.50
cfml.loader.version=2.1.14
cfml.cli.version=${cfml.loader.version}.${cfml.version}
lucee.version=${cfml.version}
lucee.config.version=5.2.4.37
jre.version=1.8.0_162
launch4j.version=3.11
launch4j.version=3.12
runwar.version=3.8.1-SNAPSHOT
jline.version=3.7.0
jgit.version=4.11.0.201803080745-r
jline.version=3.8.2
jgit.version=5.0.1.201806211838-r

#build locations
build.type=localdev
Expand All @@ -43,7 +43,7 @@ deb.repo.stable=${dist.dir}/debs-stable/noarch
#mvn.type=snapshot

#remote repos
ortus.repoURL=http://integration.stg.ortussolutions.com/artifacts
ortus.repoURL=https://downloads.ortussolutions.com
ortus.repoPRDURL=https://downloads.ortussolutions.com

#apidocs properties
Expand Down
167 changes: 152 additions & 15 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.1.0"/>
<property name="commandbox.stableVersion" value="4.1.0"/>
<property name="commandbox.version" value="4.2.0"/>
<property name="commandbox.stableVersion" value="4.2.0"/>

<!-- Time Label -->
<tstamp prefix="start"/>
Expand Down Expand Up @@ -51,11 +51,13 @@ External Dependencies:
<loadproperties srcFile="build.properties"/>

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

<echo message="ortus.sign.keyring: ${ortus.sign.keyring}" />

<!-- import cfdistro -->
<import file="${cfdistro.build.file}"/>
<property name="maven.repo.local" value="${cfdistro.basedir}/artifacts"/>
Expand Down Expand Up @@ -111,13 +113,13 @@ External Dependencies:

<!-- 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}" />
<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 -->
Expand Down Expand Up @@ -146,8 +148,9 @@ External Dependencies:
<fileset file="${dist.dir}/box" />
<fileset file="${dist.dir}/box.exe" />
</delete>
<!-- BE API Docs -->
<!-- BE API Docs
<unzip src="${dist.dir}/${distro.name}-apidocs-${commandbox.version}.zip" dest="${artifact.dir}/be-apidocs" overwrite="true"/>
-->
</then>
</antcontrib:if>
</target>
Expand Down Expand Up @@ -235,6 +238,7 @@ External Dependencies:
<copy todir="${build.dir}" encoding="UTF-8">
<fileset dir="${src.dir}/cfml">
<exclude name="modules/**"/>
<exclude name="system/mdCache/**"/>
</fileset>
<fileset file="../license.txt"/>
<fileset file="../readme.txt"/>
Expand Down Expand Up @@ -285,9 +289,139 @@ External Dependencies:

<!-- create the libs zip including cli loader, optionally use pack200 -->
<antcontrib:if>
<equals arg1="${isStable}" arg2="true" />
<equals arg1="${isStable}" arg2="${isStable}" />
<then>
<echo>This is a stable build, let's compress these jars!</echo>

<delete dir="${temp.dir}/luceejar"/>
<mkdir dir="${temp.dir}/luceejar"/>
<delete dir="${temp.dir}/luceejarBundles"/>
<mkdir dir="${temp.dir}/luceejarBundles"/>
<delete dir="${temp.dir}/luceejarExtension"/>
<mkdir dir="${temp.dir}/luceejarExtension"/>

<!-- unzip the lucee-5.x.x.x.jar -->
<unzip dest="${temp.dir}/luceejar/" overwrite="true">
<fileset dir="${lucee.lib.dir}">
<include name="lucee-5*.jar"/>
</fileset>
</unzip>

<!-- delete the old lucee jar -->
<delete>
<fileset dir="${lucee.lib.dir}" includes="lucee-5*.jar"/>
</delete>

<!-- pack the OSGI bundles -->
<packjars dir="${temp.dir}/luceejar/bundles" packdir="${temp.dir}/luceejarBundles" excludes="ESAPI*,microsoft-*"/>

<!-- delete the unpacked bundles -->
<delete>
<fileset dir="${temp.dir}/luceejar/bundles" includes="*.jar"/>
</delete>

<!-- copy packed bundles over to jar folder -->
<copy todir="${temp.dir}/luceejar/bundles">
<fileset dir="${temp.dir}/luceejarBundles">
<include name="*"/>
</fileset>
</copy>

<!--
<!- - process each lex extension - ->
<sequential>
<for param="file">
<path>
<fileset dir="${temp.dir}/luceejar/extensions" includes="*.lex"/>
</path>
<sequential>
<var name="pack200.extName" unset = "true"/>
<basename property="pack200.extName" file="@{file}" />
<echo message="Compressing extension: ${pack200.extName}"/>
<delete includeEmptyDirs="true">
<fileset dir="${temp.dir}/luceejarExtension" includes="**/*" defaultexcludes="no"/>
<fileset dir="${temp.dir}/luceejarBundles" includes="**/*" defaultexcludes="no"/>
</delete>
<!- - unzip the extension - ->
<unzip dest="${temp.dir}/luceejarExtension/" src="@{file}" overwrite="true" />
<!- - Test if a directory called "my_directory" is present - ->
<if>
<available file="${temp.dir}/luceejarExtension/jars" type="dir" />
<then>
<echo message="Jars Directory exists" />
<!- - delete the old extension - ->
<delete file="@{file}"/>
<!- - pack the OSGI bundles - ->
<packjars dir="${temp.dir}/luceejarExtension/jars" packdir="${temp.dir}/luceejarBundles" excludes="ESAPI*,microsoft-*"/>
<!- - delete the unpacked bundles - ->
<delete>
<fileset dir="${temp.dir}/luceejarExtension/jars" includes="*.jar"/>
</delete>
<!- - copy packed bundles over to jar folder - ->
<copy todir="${temp.dir}/luceejarExtension/jars">
<fileset dir="${temp.dir}/luceejarBundles">
<include name="*"/>
</fileset>
</copy>
<!- - Zip the extension back up - ->
<zip destfile="@{file}">
<fileset dir="${temp.dir}/luceejarExtension"/>
</zip>
</then>
</if>
</sequential>
</for>
</sequential>
-->

<!--
<echo message="Compressing core.lco"/>
<delete includeEmptyDirs="true">
<fileset dir="${temp.dir}/luceejarBundles" includes="**/*" defaultexcludes="no"/>
</delete>-->

<!-- Temporarily rename lco file to jar file so packjars will pick it up
<move file="${temp.dir}/luceejar/core/core.lco" tofile="${temp.dir}/luceejar/core/core.jar"/>
-->
<!-- pack core.lco
<packjars dir="${temp.dir}/luceejar/core" packdir="${temp.dir}/luceejarBundles" excludes="dummy"/>
-->
<!-- delete the unpacked bundles
<delete>
<fileset dir="${temp.dir}/luceejar/core" includes="*.jar"/>
</delete> -->

<!-- copy packed bundles over to jar folder
<copy todir="${temp.dir}/luceejar/core">
<fileset dir="${temp.dir}/luceejarBundles">
<include name="*"/>
</fileset>
</copy> -->

<!-- put file name back
<move file="${temp.dir}/luceejar/core/core.jar.pack.gz" tofile="${temp.dir}/luceejar/core/core.lco.pack.gz"/>
-->
<!-- Zip lucee jar back up -->
<zip destfile="${lucee.lib.dir}/lucee-${cfml.version}-packed.jar">
<fileset dir="${temp.dir}/luceejar"/>
</zip>


<delete dir="${temp.dir}/packlibs" />
<mkdir dir="${temp.dir}/packlibs"/>
<mkdir dir="${temp.dir}/packlibs/packed"/>
Expand Down Expand Up @@ -776,9 +910,10 @@ External Dependencies:
<!-- Build Checksum -->
<checksum file="${dist.dir}/${distro.name}-rpm-${commandbox.version.noPrereleaseID}.rpm" forceoverwrite="true" fileext=".md5" />

<rpm-repo name="${distro.name}" baseurl="${commandbox.rpm.repourl}" dir="${rpm.repo}" failonerror="false"/>

<antcall target="build.cli.rpm.stablerepo" />

<rpm-repo name="${distro.name}" baseurl="${commandbox.rpm.repourl.stable}" dir="${rpm.repo.stable}" failonerror="false"/>
</target>

<target name="build.cli.rpm.stablerepo" if="${isStable}">
Expand All @@ -799,6 +934,8 @@ External Dependencies:
<tarfileset file="${dist.dir}/box" prefix="/usr/bin" filemode="744" username="root" group="root"/>
</rpm-create>

<rpm-repo name="${distro.name}" baseurl="${commandbox.rpm.repourl.stable}" dir="${rpm.repo.stable}" failonerror="false"/>

</target>

<!-- ********************************************************************************************-->
Expand Down Expand Up @@ -942,8 +1079,8 @@ External Dependencies:
<if>
<equals arg1="${pack.resultcode}" arg2="0" />
<else>
<copy file="@{file}" todir="@{packdir}" verbose="false"/>
<delete file="${pack200.destdir}/${pack200.destfile}.pack.gz" quiet="true" verbose="false"/>
<copy file="@{file}" todir="@{packdir}" verbose="true"/>
<delete file="${pack200.destdir}/${pack200.destfile}.pack.gz" quiet="true" verbose="true"/>
</else>
</if>
<var unset="true" name="pack.resultcode" />
Expand Down
29 changes: 13 additions & 16 deletions src/cfml/system/BaseCommand.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/
component accessors="true" singleton {

// DI
property name="CR";
property name="formatterUtil";
property name="fileSystemUtil";
Expand All @@ -21,6 +20,7 @@ component accessors="true" singleton {
property name="parser";
property name="SystemSettings";
property name="job";
property name="exitCode";

/**
* Constructor
Expand All @@ -38,7 +38,7 @@ component accessors="true" singleton {
variables.SystemSettings = wirebox.getInstance( "SystemSettings" );
variables.job = wirebox.getInstance( "interactiveJob" );

hasErrored = false;
variables.exitCode = 0;
return this;
}

Expand All @@ -52,10 +52,18 @@ component accessors="true" singleton {
return wirebox.getInstance( argumentCollection = arguments );
}

function getExitCode() {
return variables.exitCode;
}

function setExitCode( exitCode ) {
variables.exitCode = arguments.exitCode;
}

// Called prior to each execution to reset any state stored in the CFC
function reset() {
print.clear();
hasErrored = false;
variables.exitCode = 0;
}

// Get the result. This will be called if the run() method doesn't return anything
Expand Down Expand Up @@ -173,8 +181,7 @@ component accessors="true" singleton {
print.line().toConsole();
}

setExitCode( exitCode );
hasErrored = true;
setExitCode( arguments.exitCode );
if( arguments.clearPrintBuffer ) {
// Wipe
print.clear();
Expand All @@ -190,17 +197,7 @@ component accessors="true" singleton {
* 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 );
return variables.exitCode != 0;
}

/**
Expand Down
16 changes: 1 addition & 15 deletions src/cfml/system/Bootstrap.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ I am a CFM because the CLI seems to need a .cfm file to call
This file will stay running the entire time the shell is open
--->

<cfset createObject( 'java', 'java.lang.System' ).setProperty( 'exitCode', '0' )>
<cfset mappings = getApplicationSettings().mappings>

<!--- Move everything over to this mapping which is the "root" of our app --->
Expand Down Expand Up @@ -127,21 +128,6 @@ This file will stay running the entire time the shell is open
silent = bufferedReader.ready();
inStream = system.in;
// If we're piping in data, let's grab it and treat it as commands.
// system.in should work directly, but Windows was blocking forever and not reading the InputStream
// So we'll create our own input stream with a line break at the end
if( silent ) {
piped = [];
// 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() );
}
// Build a string with a line for each line read from the standard input.
piped = piped.toList( chr( 10 ) ) & chr( 10 );
inStream = createObject("java","java.io.ByteArrayInputStream").init(piped.getBytes());
}
// Create the shell
shell = application.wirebox.getInstance( name='Shell', initArguments={ asyncLoad=!silent, inStream=inStream, outputStream=system.out } );
Expand Down
5 changes: 4 additions & 1 deletion src/cfml/system/Quotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,7 @@ Skip "Are you sure?" prompts in most commands with the "--force" flag
Premature cleverness is the root of all evil
You can create ad-hoc aliases for common commands or sets of commands
A unicorn smiles each time someone downloads commandbox-bullet-train
CommandBox makes you feel like a wizard.
CommandBox makes you feel like a wizard.
In the unlikely event of a water landing, CLI can be used as a flotation device
Let me see those Jazz Hands!
Have brainstorms so big they leave your hair windswept
Loading

0 comments on commit 5918e2d

Please sign in to comment.