Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ All historical references to "CFWheels" in this changelog have been preserved fo
- Use the Adobe-safe 3-argument `mid()` form when stripping the `wheels` prefix in the MCP command executor and its security spec; the prior 2-arg call crashed the entire `security/` test bundle on Adobe ColdFusion (#2613)
- Replace Lucee-only `directoryCreate(path, true)` calls in `BrowserTest.$captureFailureArtifacts` and `McpServer` test-file generation with `java.io.File.mkdirs()` so artifact directory creation no longer trips Adobe ColdFusion's `DIRECTORYCREATE` single-argument validator (#2614)
- Generated `Application.cfc` (and the in-repo `public/`, `examples/tweet/`, `examples/starter-app/` copies) now assigns the injector directly to `application.wheelsdi` in `onApplicationStart()` and `onError()` instead of an orphan local `injector` variable, matching the documented 4.0 DI container name and the way every other reference in the file reads (#2622)
- `wheels new --no-sqlite` now suppresses the SQLite datasource pair in the scaffolded `lucee.json` so Lucee no longer auto-creates `db/development.sqlite` / `db/test.sqlite` on first connection (#2621)

----

Expand Down
32 changes: 30 additions & 2 deletions cli/lucli/Module.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -4115,14 +4115,15 @@ component extends="modules.BaseModule" {
);
}

// Template variable context — all config values flow through here
// datasourcesBlock: SQLite pair by default; "{}" when --no-sqlite (#2621)
var context = {
"appName": appName,
"datasourceName": opts.datasource,
"reloadPassword": opts.reloadPassword,
"port": opts.port,
"shutdownPort": opts.port + 1,
"openBrowser": opts.openBrowser ? "true" : "false"
"openBrowser": opts.openBrowser ? "true" : "false",
"datasourcesBlock": opts.noSQLite ? "{}" : buildSQLiteDatasourcesBlock(opts.datasource)
};

// Copy template directory tree to target, processing placeholders.
Expand Down Expand Up @@ -4309,6 +4310,33 @@ component extends="modules.BaseModule" {
}
}

private string function buildSQLiteDatasourcesBlock(required string datasourceName) {
var nl = chr(10);
var pad = " ";
var inner = " ";
var block = "{" & nl;
block &= pad & '"#datasourceName#": {' & nl;
block &= inner & '"class": "org.sqlite.JDBC",' & nl;
block &= inner & '"database": "#datasourceName#",' & nl;
block &= inner & '"dbdriver": "Other",' & nl;
block &= inner & '"dsn": "jdbc:sqlite:{project}/db/development.sqlite",' & nl;
block &= inner & '"host": "",' & nl;
block &= inner & '"password": "",' & nl;
block &= inner & '"username": ""' & nl;
block &= pad & "}," & nl;
block &= pad & '"#datasourceName#_test": {' & nl;
block &= inner & '"class": "org.sqlite.JDBC",' & nl;
block &= inner & '"database": "#datasourceName#_test",' & nl;
block &= inner & '"dbdriver": "Other",' & nl;
block &= inner & '"dsn": "jdbc:sqlite:{project}/db/test.sqlite",' & nl;
block &= inner & '"host": "",' & nl;
block &= inner & '"password": "",' & nl;
block &= inner & '"username": ""' & nl;
block &= pad & "}" & nl;
block &= " }";
return block;
}

/**
* Resolve the Wheels framework source or fail fast. Prints a diagnostic
* listing every path tried plus a WHEELS_FRAMEWORK_PATH hint, then throws
Expand Down
21 changes: 1 addition & 20 deletions cli/lucli/templates/app/lucee.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,7 @@
"enabled": false
},
"configuration": {
"datasources": {
"{{datasourceName}}": {
"class": "org.sqlite.JDBC",
"database": "{{datasourceName}}",
"dbdriver": "Other",
"dsn": "jdbc:sqlite:{project}/db/development.sqlite",
"host": "",
"password": "",
"username": ""
},
"{{datasourceName}}_test": {
"class": "org.sqlite.JDBC",
"database": "{{datasourceName}}_test",
"dbdriver": "Other",
"dsn": "jdbc:sqlite:{project}/db/test.sqlite",
"host": "",
"password": "",
"username": ""
}
},
"datasources": {{datasourcesBlock}},
"mappings": {
"/wheels": "../vendor/wheels",
"/app": "../app",
Expand Down
42 changes: 42 additions & 0 deletions vendor/wheels/tests/specs/cli/NoSQLiteScaffoldSpec.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
component extends="wheels.WheelsTest" {

function run() {

describe("wheels new --no-sqlite (issue 2621)", function() {

it("lucee.json template uses a datasourcesBlock placeholder so --no-sqlite can suppress SQLite", function() {
var templatePath = expandPath("/cli/lucli/templates/app/lucee.json");
expect(fileExists(templatePath)).toBeTrue(
"Template missing at " & templatePath
);

var template = fileRead(templatePath);
var placeholder = "{{" & "datasourcesBlock" & "}}";

expect(template contains placeholder).toBeTrue(
"Template should use the " & placeholder & " placeholder so scaffoldNewApp() can substitute either the SQLite datasource pair (default) or an empty block (--no-sqlite). Issue 2621."
);

// The template must NOT hardcode the SQLite class — emitting it
// has to go through the placeholder so --no-sqlite can suppress.
expect(template contains "org.sqlite.JDBC").toBeFalse(
"Template should not hardcode 'org.sqlite.JDBC' — emit it via the " & placeholder & " placeholder. Issue 2621."
);
});

it("Module.cfc threads opts.noSQLite into the datasourcesBlock template context", function() {
var modulePath = expandPath("/cli/lucli/Module.cfc");
expect(fileExists(modulePath)).toBeTrue();

var moduleSrc = fileRead(modulePath);

expect(moduleSrc contains "datasourcesBlock").toBeTrue(
"Module.cfc::scaffoldNewApp() should compute a 'datasourcesBlock' value into the template context based on opts.noSQLite so the rendered lucee.json honors --no-sqlite. Issue 2621."
);
});

});

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ myblog/
lucee.json
```

The `.env` file is created from the template's `_env` stub and carries environment-specific values; it is gitignored by the generated `.gitignore`. `lucee.json` pins the server port and shutdown port to the flags you passed. `config/app.cfm` carries the datasource configuration — SQLite by default, H2 under `--setup-h2`, or no datasource block under `--no-sqlite`.
The `.env` file is created from the template's `_env` stub and carries environment-specific values; it is gitignored by the generated `.gitignore`. `lucee.json` pins the server port, shutdown port, and Lucee-level JDBC datasource entries. `config/app.cfm` carries the runtime datasource configuration. Both files honor `--no-sqlite`: the flag emits an empty `datasources` object in `lucee.json` so Lucee never auto-creates `db/development.sqlite` and `db/test.sqlite` on first connection, and omits the datasource block from `config/app.cfm`.

## Common workflows

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ myblog/
lucee.json
```

The `.env` file is created from the template's `_env` stub and carries environment-specific values; it is gitignored by the generated `.gitignore`. `lucee.json` pins the server port and shutdown port to the flags you passed. `config/app.cfm` carries the datasource configuration — SQLite by default, H2 under `--setup-h2`, or no datasource block under `--no-sqlite`.
The `.env` file is created from the template's `_env` stub and carries environment-specific values; it is gitignored by the generated `.gitignore`. `lucee.json` pins the server port, shutdown port, and Lucee-level JDBC datasource entries. `config/app.cfm` carries the runtime datasource configuration. Both files honor `--no-sqlite`: the flag emits an empty `datasources` object in `lucee.json` so Lucee never auto-creates `db/development.sqlite` and `db/test.sqlite` on first connection, and omits the datasource block from `config/app.cfm`.

## Common workflows

Expand Down
Binary file modified web/tests/visual-baselines/blog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading