Compare commits

...

6 Commits

Author SHA1 Message Date
ge
171ec8fe4b rm Makefile 2025-05-29 22:47:13 +03:00
ge
b7d5f4fcb1 all: stop using src/ dir, make tests reproducible, fix CI 2025-04-22 20:14:55 +03:00
ge
e79f83f800 make path required 2025-04-13 07:13:37 +03:00
8416067007 ci: fix tests one more time 2025-04-13 06:13:38 +03:00
1723bf75b8 ci: fix tests again 2025-04-13 06:12:07 +03:00
8d68479194 ci: fix tests 2025-04-13 06:08:51 +03:00
6 changed files with 2 additions and 44 deletions

View File

@ -1,20 +0,0 @@
SRC_DIR ?= src
DOC_DIR ?= doc
TESTS_DIR ?= .
all: test
test:
v test $(TESTS_DIR)
doc:
v doc -f html -m ./$(SRC_DIR) -o $(DOC_DIR)
serve: clean doc
v -e "import net.http.file; file.serve(folder: '$(DOC_DIR)')"
clean:
rm -r $(DOC_DIR) || true
cli:
v cmd/mkembedfs -o mkembedfs

View File

@ -7,7 +7,7 @@ import net.http.mime
pub struct CodeGenerator {
pub:
// Path to file or directory to embed
path string
path string @[required]
// Path prefix if you want to add extra prefix for file paths
prefix string
// Glob patterns to match files the must be ignored when generating the code

View File

@ -1,7 +1,6 @@
module main
fn main() {
println(embedfs)
$if bare_map ? {
json_file := embedfs['assets/example.json'] or { EmbedFile{} }
println(json_file.data.to_string().trim_space())

View File

@ -1,12 +1 @@
EmbedFileSystem{
files: {'assets/example.json': EmbedFile{
data: embed_file.EmbedFileData{ len: 22, path: "assets/example.json", apath: "", uncompressed: 846284 }
meta: EmbedFileMetadata{
key: 'assets/example.json'
name: 'example.json'
ext: 'json'
mimetype: 'application/json'
}
}}
}
{"some": "JSON data"}

View File

@ -20,7 +20,7 @@ fn test_mymod() {
fn test_mymod_bare_map() {
oldpwd := os.getwd()
expected_out := os.read_file('tests/mymod_test_bare_map.out')!
expected_out := os.read_file('tests/mymod_test.out')!
os.chdir('tests/mymod')!
gen := embedfs.CodeGenerator{
path: 'assets'

View File

@ -1,10 +0,0 @@
{'assets/example.json': EmbedFile{
data: embed_file.EmbedFileData{ len: 22, path: "assets/example.json", apath: "", uncompressed: 845da4 }
meta: EmbedFileMetadata{
key: 'assets/example.json'
name: 'example.json'
ext: 'json'
mimetype: 'application/json'
}
}}
{"some": "JSON data"}