code.project
all-files
added in 3.0
(all-files)(all-files paths)(all-files paths opts)(all-files paths opts project)code-files
added in 3.0
(code-files)returns only the code files for the current project
(code-files)
code-path
added in 3.0
(code-path ns relative)returns the path of the code
(str (code-path (h/ns-sym) true)) => “test/code/project_test.clj”
exclude
added in 3.0
(exclude lookup exclusions)helper function for excluding certain namespaces
(exclude ’{lucid.legacy.analyzer :a lucid.legacy :a lib.aether :b} “lucid.legacy”) => ’{lib.aether :b}
file-lookup
added in 3.0
(file-lookup)(file-lookup project)creates a lookup of namespaces and files in the project
(-> (file-lookup (project)) (get ’code.project)) => #(.endsWith ^String % “/src/code/project.clj”)
file-suffix
added in 3.0
(file-suffix)(file-suffix type)returns the file suffix for a given type
(file-suffix) => “.clj”
(file-suffix :cljs) => “.cljs”
file-type
added in 3.0
(file-type path)returns the type of file according to the suffix
(file-type “project.clj”) => :source
(file-type “test/code/project_test.clj”) => :test
get-path
added in 4.0
(get-path ns & [project])gets the path given the ns
(reset! code.project.common/lookup {}) (get-path (h/ns-sym)) => “test/code/project_test.clj”
in-context
macro
added in 3.0
(in-context [func & args])creates a local context for executing code functions
(in-context ((fn current params _ project current))) => ’code.project-test
lookup-ns
added in 3.0
(lookup-ns path)fast lookup for all-files function
(first (lookup-ns (lookup-path (h/ns-sym)))) => ’code.project-test
lookup-path
added in 3.0
(lookup-path ns)looks up the path given the ns
(lookup-path (h/ns-sym))
parse-ns-name
added in 4.1
(parse-ns-name forms)(parse-ns-name forms file-path)returns the declared namespace from read forms, with an optional file-path fallback
(parse-ns-name ’(comment x) (ns sample.core) (def x 1)) => ’sample.core
project
added in 3.0
(project)(project path)returns project options as a map
(project) => (contains {:name symbol? :dependencies vector?})
project-file
added in 3.0
(project-file)returns the current project file
(project-file) => “project.clj”
project-map
added in 3.0
(project-map path)returns the project map
(project-map (fs/path “project.clj”))
project-name
added in 3.0
(project-name)(project-name path)returns the name, read from the project map
(project-name) => symbol?
source-ns
added in 3.0
(source-ns ns)returns the source namespace
(source-ns ’a) => ’a (source-ns ’a-test) => ’a
sym-name
added in 3.0
(sym-name x)returns the symbol of the namespace
(sym-name ns) => ’code.project-test
(sym-name ’a) => ’a
test-ns
added in 3.0
(test-ns ns)returns the test namespace
(test-ns ’a) => ’a-test (test-ns ’a-test) => ’a-test
test-root
added in 4.1
(test-root path project)returns the preferred test root for a path within the project
test-suffix
added in 3.0
(test-suffix)(test-suffix s)returns the test suffix
(test-suffix) => “-test”