RedMadRobot / catbird

Mock server for UI tests
MIT License
50 stars 10 forks source link

Add html files as bundle resources #29

Closed subdan closed 3 years ago

subdan commented 3 years ago

When debugging Catbird using Xcode webpage http://127.0.0.1:8080/catbird doesn't work because index.html file cannot be found in DerivedData.

{
  "error":true,
  "reason":"Template named `index.html` does not exist in loader FileSystemLoader([\/Users\/subdan\/Library\/Developer\/Xcode\/DerivedData\/catbird-btinvbwiywkjwhciwwdacqygknhe\/Build\/Products\/Debug\/Resources\/Views\/])"
}
  1. Moved html files to the Resources folder of CatbirdApp target and marked them as resources.

    .target(name: "CatbirdApp", dependencies: [
           ...
    ], resources: [ .copy("Resources") ]),
  2. Update Makefile and .travis.yml to use Catbird_CatbirdApp.bundle file generated by swift build.

  3. Updated swift-tools-version to 5.3 to use Resources with a Swift Package

  4. Fixed a typo in ViewRenderer.

  5. Excluded Files directory of CatbirdAppTests target to fix warning showed by Xcode.

image
Alexander-Ignition commented 3 years ago

It looks like a bug just to run in Xcode. Is this problem reproducible in the terminal ?

subdan commented 3 years ago

It looks like a bug just to run in Xcode. Is this problem reproducible in the terminal ?

This issue is reproduced only when running catbird via Xcode.

Alexander-Ignition commented 3 years ago

This issue is reproduced only when running catbird via Xcode.

Probably the behavior of the app.directory.viewsDirectory has changed in Vapor Before Vapor gave a different path depending on the launch in Xcode or Terminal

subdan commented 3 years ago

It seems that changing working directory in scheme fixes this issue.

Alexander-Ignition commented 3 years ago

The Vapor team changed the working directory search in version 4

DirectoryConfiguration diff