Skip to main content

Module ignore

Module ignore 

Source
Expand description

.isoloomignore: the project’s paths the machines don’t get when the project is copied into them (Vagrant’s project step, Proxmox’s cloud-init, the cloud modules’ archive, and the runner’s project.archive). Part of the contract: a runner archiving the project leaves out exactly what the generated files do. Gitignore-style, at the project’s root:

  • one pattern per line; blank lines and # comments are skipped, spaces around a pattern too;
  • !pattern brings back what an earlier pattern left out;
  • a trailing / (or /**) matches folders only (and so everything in them);
  • a / at the start or in the middle anchors the pattern at the project’s root; otherwise it matches at any depth (*.log, .env);
  • * is any run of characters but /, ? one character but /, [abc] / [a-z] / [!abc] a set, ** any number of folders (a/**/b, **/x);
  • a pattern matching a folder matches everything in it, and the last pattern matching a path (or a folder it is in) decides: unlike git, ! can bring back a file of an ignored folder.

The generated files read the file when they run, each translating a pattern into the same regular expression (^<glob>(/|$), or ^<glob>/ for folders only); this matcher follows the same rules, for a copy made outside those tools (the runner’s), so it can’t disagree with them. It reads text only: walking the project is the caller’s.

use isoloom_manifest::ignore::Rules;

let rules = Rules::parse("*.log\n!keep.log\nbuild/\n");
assert!(rules.ignored("logs/x.log") && !rules.ignored("keep.log"));
assert!(rules.ignored("src/build/") && !rules.ignored("src/app.py"));

Structs§

Rules
The rules of an .isoloomignore, in order.

Constants§

FILE
The file’s name, at the project’s root.