Skip to content

Commit f760ee7

Browse files
authored
Merge pull request #11 from ColdBox/development
Version Release
2 parents fe6acf9 + d94b869 commit f760ee7

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

box.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"ColdBox CLI",
3-
"version":"7.4.0",
3+
"version":"7.5.0",
44
"location":"https://downloads.ortussolutions.com/ortussolutions/commandbox-modules/coldbox-cli/@build.version@/coldbox-cli-@build.version@.zip",
55
"slug":"coldbox-cli",
66
"author":"Ortus Solutions, Corp",

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Fixed
1313

14+
- watch reinit issues with `coldbox watch` command
1415
- key [TEMPLATEPATH] doesn't exist when doing orm operations. This was a typo, it should have been `templatesPath`
1516

1617
## [7.4.0] - 2024-03-20

commands/coldbox/create/orm-crud.cfc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ component extends="coldbox-cli.models.BaseCommand" {
2626
boolean tests = true,
2727
testsDirectory = "tests/specs/integration"
2828
){
29-
3029
// This will make each directory canonical and absolute
3130
arguments.handlersDirectory = resolvePath( arguments.handlersDirectory );
3231
arguments.viewsDirectory = resolvePath( arguments.viewsDirectory );

commands/coldbox/watch-reinit.cfc

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
*
1818
* {code}
1919
* package set reinitWatchDelay=1000
20-
* package set reinitWatchPaths= "config/**.cfc,handlers/**.cfc,models/**.cfc,ModuleConfig.cfc"
20+
* package set reinitWatchPaths="config/**.cfc,handlers/**.cfc,models/**.cfc,ModuleConfig.cfc"
21+
* package set reinitWatchDirectory="../"
2122
* {code}
2223
*
2324
* This command will run in the foreground until you stop it. When you are ready to shut down the watcher, press Ctrl+C.
@@ -33,14 +34,16 @@ component {
3334
variables.PATHS = "/config/**.cfc,/handlers/**.cfc,/models/**.cfc,/modules_app/**/*.cfc";
3435

3536
/**
36-
* @paths Command delimited list of file globbing paths to watch relative to the working directory, defaults to **.cfc
37-
* @delay How may milliseconds to wait before polling for changes, defaults to 500 ms
37+
* @paths Command delimited list of file globbing paths to watch relative to the working directory, defaults to **.cfc
38+
* @delay How may milliseconds to wait before polling for changes, defaults to 500 ms
3839
* @password Reinit password
40+
* @directory Working directory to start watcher in
3941
**/
4042
function run(
4143
string paths,
4244
number delay,
43-
string password = "1"
45+
string password = "1",
46+
string directory
4447
){
4548
// Get watch options from package descriptor
4649
var boxOptions = packageService.readPackageDescriptor( getCWD() );
@@ -59,10 +62,14 @@ component {
5962

6063
// Determine watching patterns, either from arguments or boxoptions or defaults
6164
var globbingPaths = arguments.paths ?: getOptionsWatchers() ?: variables.PATHS;
62-
// handle non numeric config and put a floor of 150ms
63-
var delayMs = max(
65+
var globArray = globbingPaths.listToArray();
66+
var theDirectory = arguments.directory ?: boxOptions.reinitWatchDirectory ?: getCWD();
67+
theDirectory = resolvePath( theDirectory );
68+
69+
// handle non numeric config
70+
var delayMs = max(
6471
val( arguments.delay ?: boxOptions.reinitWatchDelay ?: variables.WATCH_DELAY ),
65-
150
72+
variables.WATCH_DELAY
6673
);
6774
var statusColors = {
6875
"added" : "green",
@@ -95,15 +102,19 @@ component {
95102
.greenLine( "---------------------------------------------------" )
96103
.greenLine( "Watching the following files for a framework reinit" )
97104
.greenLine( "---------------------------------------------------" )
98-
.greenLine( " " & globbingPaths )
105+
.line();
106+
globArray.each( ( p ) => print.greenLine( " " & p ) );
107+
print
108+
.line()
109+
.greenLine( " in directory: #theDirectory#" )
99110
.greenLine( " Press Ctrl-C to exit " )
100111
.greenLine( "---------------------------------------------------" )
101112
.toConsole();
102113

103114
// Start watcher
104115
watch()
105-
.paths( globbingPaths.listToArray() )
106-
.inDirectory( getCWD() )
116+
.paths( globArray )
117+
.inDirectory( theDirectory )
107118
.withDelay( delayMs )
108119
.onChange( function( changeData ){
109120
// output file changes

0 commit comments

Comments
 (0)