Skip to content

Commit 61a2c1b

Browse files
committed
improve execute documentation and examples
1 parent 820a1b9 commit 61a2c1b

2 files changed

Lines changed: 26 additions & 23 deletions

File tree

README.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ The script-runner can be used from any directory by specifying the build file lo
2121

2222
```bash
2323
# From the script-runner directory (simple)
24-
ant -Dwebroot="/path/to/your/project" -Dexecute="/yourscript.cfm"
24+
ant -Dwebroot="/path/to/your/project" -Dexecute="yourscript.cfm"
2525

2626
# From your project directory (recommended for external projects)
27-
ant -buildfile="/path/to/script-runner/build.xml" -Dwebroot="." -Dexecute="/yourscript.cfm"
27+
ant -buildfile="/path/to/script-runner/build.xml" -Dwebroot="." -Dexecute="yourscript.cfm"
2828

2929
# From any directory with absolute paths
30-
ant -buildfile="C:\tools\script-runner\build.xml" -Dwebroot="C:\work\myproject" -Dexecute="/test.cfm"
30+
ant -buildfile="C:\tools\script-runner\build.xml" -Dwebroot="C:\work\myproject" -Dexecute="test.cfm"
31+
32+
# execute a script below the webroot
33+
ant -buildfile="C:\tools\script-runner\build.xml" -Dwebroot="C:\work\myproject" -Dexecute="extended/index.cfm"
3134
```
3235

3336
**Key Points:**
@@ -47,7 +50,7 @@ You can specify:
4750
- Lucee version by query `-DluceeVersionQuery="5.4/stable/light` ( optional overrides luceeVersion, (version)/(stable/rc/snapshot)/(jar,light/zero) )
4851
- Local Lucee JAR `-DluceeJar="/path/to/lucee.jar"` (optional, overrides both luceeVersion and luceeVersionQuery, perfect for testing locally built JARs)
4952
- Webroot `-Dwebroot=` (default `tests/`) on Windows, avoid a trailing \ as that is treated as an escape character causes script runner to fail
50-
- CFML Script to run, `-Dexecute=` (default `/index.cfm`)
53+
- CFML Script to run, `-Dexecute=` (default `index.cfm`) a relative path the webroot, no leading `/` is needed, some bash shells like git bash on windows get's confused and tries to expand that to a full path
5154
- run script via include or _internalRequest (which runs the Application.cfc if present, default ) `-DexecuteScriptByInclude="true"`
5255
- any extra extensions `-Dextensions=` (default ``)
5356
- manual extension install (`*.lex`) from a directory `-DextensionDir=` (default ``)
@@ -115,9 +118,9 @@ Multiple script-runner instances can be run simultaneously using unique working
115118

116119
```bash
117120
# Run multiple instances concurrently
118-
ant -DuniqueWorkingDir="true" -Dexecute="/test1.cfm" &
119-
ant -DuniqueWorkingDir="true" -Dexecute="/test2.cfm" &
120-
ant -DuniqueWorkingDir="true" -Dexecute="/test3.cfm" &
121+
ant -DuniqueWorkingDir="true" -Dexecute="test1.cfm" &
122+
ant -DuniqueWorkingDir="true" -Dexecute="test2.cfm" &
123+
ant -DuniqueWorkingDir="true" -Dexecute="test3.cfm" &
121124
wait
122125
```
123126

@@ -149,48 +152,48 @@ systemOutput(serializeJSON(myData, "struct"), true);
149152

150153
### Common Issues on Windows
151154

152-
**Problem**: Build fails with path-related errors
155+
**Problem**: Build fails with path-related errors
153156
**Solution**: Avoid trailing backslashes in webroot paths:
154157
```bash
155158
# ❌ Wrong - trailing backslash causes escape issues
156-
ant -Dwebroot="C:\work\myproject\"
159+
ant -Dwebroot="C:\work\myproject\"
157160
158161
# ✅ Correct - no trailing backslash
159-
ant -Dwebroot="C:\work\myproject"
162+
ant -Dwebroot="C:\work\myproject"
160163
ant -Dwebroot="C:/work/myproject/" # Forward slashes work too
161164
```
162165
163-
**Problem**: "Could not locate build file" from other directories
166+
**Problem**: "Could not locate build file" from other directories
164167
**Solution**: Use absolute path to build.xml:
165168
```bash
166169
# ❌ Wrong - looking for build.xml in current directory
167170
ant -Dwebroot="." -Dexecute="/test.cfm"
168171
169172
# ✅ Correct - specify script-runner location
170-
ant -buildfile="C:\tools\script-runner\build.xml" -Dwebroot="." -Dexecute="/test.cfm"
173+
ant -buildfile="C:\tools\script-runner\build.xml" -Dwebroot="." -Dexecute="test.cfm"
171174
```
172175
173-
**Problem**: "File not found" for CFML scripts
176+
**Problem**: "File not found" for CFML scripts
174177
**Solution**: Check webroot and execute paths:
175178
```bash
176179
# Verify your paths - execute is relative to webroot
177-
ant -buildfile="/path/to/script-runner/build.xml" -Dwebroot="/your/project" -Dexecute="/debug.cfm"
180+
ant -buildfile="/path/to/script-runner/build.xml" -Dwebroot="/your/project" -Dexecute="debug.cfm"
178181
```
179182
180-
**Problem**: "No shell found" or quote/escape errors on Windows
183+
**Problem**: "No shell found" or quote/escape errors on Windows
181184
**Solution**: Use proper quote formatting for Windows command line:
182185
```bash
183186
# ❌ Wrong - excessive escaping or nested quotes
184187
ant -buildfile=\"d:\work\script-runner\" -Dwebroot=\"D:\work\project\"
185188
186189
# ✅ Correct - Windows Command Prompt (no quotes needed for paths without spaces)
187-
ant -buildfile=d:\work\script-runner\build.xml -Dwebroot=D:\work\project -Dexecute=/test.cfm
190+
ant -buildfile=d:\work\script-runner\build.xml -Dwebroot=D:\work\project -Dexecute=test.cfm
188191
189192
# ✅ Correct - Windows with spaces in paths (use quotes around entire parameter)
190-
ant "-buildfile=C:\Program Files\script-runner\build.xml" "-Dwebroot=C:\My Projects\test" -Dexecute=/test.cfm
193+
ant "-buildfile=C:\Program Files\script-runner\build.xml" "-Dwebroot=C:\My Projects\test" -Dexecute=test.cfm
191194
192195
# ✅ Correct - PowerShell (use single quotes to avoid variable expansion)
193-
ant -buildfile='d:\work\script-runner\build.xml' -Dwebroot='D:\work\project' -Dexecute='/test.cfm'
196+
ant -buildfile='d:\work\script-runner\build.xml' -Dwebroot='D:\work\project' -Dexecute='test.cfm'
194197
```
195198
196199
**Important Windows Tips:**
@@ -201,9 +204,9 @@ ant -buildfile='d:\work\script-runner\build.xml' -Dwebroot='D:\work\project' -De
201204
202205
If no webroot is specfied, you can run the provided debug script, to see which extensions are available and all the env / sys properties
203206
204-
`ant -buildfile="C:\work\script-runner" -Dexecute="/debug.cfm"`
207+
`ant -buildfile="C:\work\script-runner" -Dexecute="debug.cfm"`
205208
206-
`ant -buildfile="C:\work\script-runner" -Dexecute="/debug.cfm" -DluceeVersion="light-6.2.2.91"` (`light` has no bundled extensions, `zero` has no extension or admin)
209+
`ant -buildfile="C:\work\script-runner" -Dexecute="debug.cfm" -DluceeVersion="light-6.2.2.91"` (`light` has no bundled extensions, `zero` has no extension or admin)
207210
208211
## As a GitHub Action
209212
@@ -229,7 +232,7 @@ To use as a GitHub Action, to run the PDF tests after building the PDF Extension
229232
uses: lucee/script-runner@main
230233
with:
231234
webroot: ${{ github.workspace }}/lucee/test
232-
execute: /bootstrap-tests.cfm
235+
execute: bootstrap-tests.cfm
233236
luceeVersion: ${{ env.luceeVersion }}
234237
luceeVersionQuery: 5.4/stable/light (optional, overrides luceeVersion )
235238
luceeJar: /path/to/local/lucee.jar (optional, overrides both luceeVersion and luceeVersionQuery)
@@ -278,5 +281,5 @@ pipelines:
278281
- git clone https://github.com/lucee/lucee
279282
- export testLabels="PDF"
280283
- echo $testLabels
281-
- ant -buildfile script-runner/build.xml -DluceeVersion="light-6.2.2.91" -Dwebroot="$BITBUCKET_CLONE_DIR/lucee/test" -DextensionDir="$BITBUCKET_CLONE_DIR/dist" -Dexecute="/bootstrap-tests.cfm" -DtestAdditional="$BITBUCKET_CLONE_DIR/tests"
284+
- ant -buildfile script-runner/build.xml -DluceeVersion="light-6.2.2.91" -Dwebroot="$BITBUCKET_CLONE_DIR/lucee/test" -DextensionDir="$BITBUCKET_CLONE_DIR/dist" -Dexecute="bootstrap-tests.cfm" -DtestAdditional="$BITBUCKET_CLONE_DIR/tests"
282285
```

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
</condition>
176176

177177
<!-- Check if execute script exists under webroot (catch Git Bash path conversion and other issues) -->
178-
<fail message="Execute script '${execute}' not found under webroot '${webroot}' (looking for: ${execute.fullpath}). If using Git Bash and your execute parameter starts with '/', this may be due to path conversion. Solutions: 1) Use cmd instead of Git Bash, 2) Use double slash '//debug.cfm', 3) Set MSYS_NO_PATHCONV=1, or ensure the script exists in the webroot.">
178+
<fail message="Execute script '${execute}' not found under webroot '${webroot}' (looking for: ${execute.fullpath}). If using Git Bash, try: 1) Remove leading slash: -Dexecute=&quot;test.cfm&quot; instead of &quot;/test.cfm&quot;, 2) Use cmd.exe instead of Git Bash, or 3) Ensure the script exists in the webroot.">
179179
<condition>
180180
<and>
181181
<not>

0 commit comments

Comments
 (0)