BoxLang: Our new JVM Dynamic Language made by Ortus! Check it out: https://www.boxlang.io

New conditional commands pathExists, assertTrue and assertEqual

Description

CommandBox already has a concept of exit codes as well as the ability to chain commands with

 

and && so the exit code of the first command acts as a conditional to control whether the second command executes.

testbox run && publish

Build on this concept with three new commands that output nothing but return a 0 or 1 exit code based on the parameters.

pathExists
Returns a passing (0) or failing (1) exit code whether the path exists.

pathExists box.json && package show

assertTrue
Returns a passing (0) or failing (1) exit code whether truthy parameter passed.
Truthy values are "yes", "true" and positive integers.
All other values are considered falsy

assertTrue `package show private` && run-script foo assertTrue ${ENABLE_DOOM} && run-doom assertTrue `#fileExists foo.txt` && echo "it's there!"

assertEqual
Returns a passing (0) or failing (1) exit code whether both parameters match.
Comparsion is case insensitive.

assertEqual `package show name` "My Package" || package set name="My Package" assertEqual ${ENVIRONMENT} production && install --production

Activity

Show:

Brad Wood August 11, 2018 at 8:46 PM

Because then it isn't differentiated enough from assertTrue.

Luis Majano August 11, 2018 at 2:46 PM

I love this Brad. Why not make assertequAl to just assert.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Priority

Sentry

Created August 11, 2018 at 1:46 AM
Updated August 11, 2018 at 8:46 PM
Resolved August 11, 2018 at 1:50 AM

Flag notifications