1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-18 11:19:56 +00:00

Add option for using tags in jpm deps.

This commit is contained in:
Calvin Rose 2019-08-30 18:23:13 -05:00
parent 98eaadf2d1
commit 141d3e9588

View File

@ -569,17 +569,25 @@ int main(int argc, const char **argv) {
(defn install-git
"Install a bundle from git. If the bundle is already installed, the bundle
is reinistalled (but not rebuilt if artifacts are cached)."
[repo]
[repotab]
(def repo (if (string? repotab) repotab (repotab :repo)))
(def tag (unless (string? repotab) (repotab :tag)))
(def cache (find-cache))
(os/mkdir cache)
(def id (filepath-replace repo))
(def module-dir (string cache sep id))
(var fresh false)
(when (os/mkdir module-dir)
(set fresh true)
(os/execute ["git" "clone" repo module-dir] :p))
(def olddir (os/cwd))
(os/cd module-dir)
(try
(with-dyns [:rules @{}]
(unless fresh
(os/execute ["git" "pull" "origin" "master"] :p))
(when tag
(os/execute ["git" "reset" "--hard" tag] :p))
(os/execute ["git" "submodule" "update" "--init" "--recursive"] :p)
(import-rules "./project.janet")
(do-rule "install-deps")