Compare commits
1 Commits
master
...
954d71cb3f
Author | SHA1 | Date | |
---|---|---|---|
954d71cb3f |
20
Makefile
Normal file
20
Makefile
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
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
|
@ -1,6 +1,7 @@
|
|||||||
module main
|
module main
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
println(embedfs)
|
||||||
$if bare_map ? {
|
$if bare_map ? {
|
||||||
json_file := embedfs['assets/example.json'] or { EmbedFile{} }
|
json_file := embedfs['assets/example.json'] or { EmbedFile{} }
|
||||||
println(json_file.data.to_string().trim_space())
|
println(json_file.data.to_string().trim_space())
|
||||||
|
@ -1 +1,12 @@
|
|||||||
|
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"}
|
{"some": "JSON data"}
|
||||||
|
@ -20,7 +20,7 @@ fn test_mymod() {
|
|||||||
|
|
||||||
fn test_mymod_bare_map() {
|
fn test_mymod_bare_map() {
|
||||||
oldpwd := os.getwd()
|
oldpwd := os.getwd()
|
||||||
expected_out := os.read_file('tests/mymod_test.out')!
|
expected_out := os.read_file('tests/mymod_test_bare_map.out')!
|
||||||
os.chdir('tests/mymod')!
|
os.chdir('tests/mymod')!
|
||||||
gen := embedfs.CodeGenerator{
|
gen := embedfs.CodeGenerator{
|
||||||
path: 'assets'
|
path: 'assets'
|
||||||
|
10
tests/mymod_test_bare_map.out
Normal file
10
tests/mymod_test_bare_map.out
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{'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"}
|
Reference in New Issue
Block a user