[env] RUST_FILES = { glob = "./**/*.rs", include_files = true, include_dirs = false, ignore_type = "git" } [tasks.openapi-delete] cwd = "openapi" command = "rm" args = ["-rf", "spec3.json", "out"] # verifies if all the apis are exported, and reports which are missing [tasks.verify] script = ''' #!/usr/bin/env bash for filename in src/resources/generated/*.rs ; do BASE=$(basename $filename '.rs') if ! grep -Fq "pub mod $BASE;" src/resources/generated.rs ; then echo $BASE missing module fi if ! grep -Fq "$BASE::*," src/resources.rs ; then echo $BASE missing export fi done ''' [tasks.duplicates] script = ''' rg -N --no-filename -i '^pub (struct|enum) ([A-Z][a-zA-z0-9]+).*?$' src/resources/generated -g '!placeholders.rs' -r '$2'\ | sort\ | uniq -cd ''' [tasks.openapi-fetch] cwd = "openapi" command = "wget" args = [ "https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json", ] dependencies = ["openapi-delete"] [tasks.openapi-generate] cwd = "openapi" command = "cargo" args = ["run", "spec3.json"] dependencies = ["openapi-fetch"] [tasks.openapi-copy] cwd = "openapi" command = "cp" args = ["-a", "out/.", "../src/resources/generated"] dependencies = ["openapi-generate"] [tasks.fmt] command = "cargo" toolchain = "nightly" install_crate = "rustfmt" args = ["fmt", "--", "@@split(RUST_FILES,;)"] [tasks.check] command = "cargo" toolchain = "nightly" install_crate = "rustfmt" args = ["fmt", "--", "--check", "@@split(RUST_FILES,;)"] [tasks.openapi-install] dependencies = ["openapi-copy", "fmt"] [config] default_to_workspace = false