mirror of
https://github.com/janet-lang/janet
synced 2025-02-02 10:19:10 +00:00
Add option for using tags in jpm deps.
This commit is contained in:
parent
98eaadf2d1
commit
141d3e9588
10
auxbin/jpm
10
auxbin/jpm
@ -569,17 +569,25 @@ int main(int argc, const char **argv) {
|
|||||||
(defn install-git
|
(defn install-git
|
||||||
"Install a bundle from git. If the bundle is already installed, the bundle
|
"Install a bundle from git. If the bundle is already installed, the bundle
|
||||||
is reinistalled (but not rebuilt if artifacts are cached)."
|
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))
|
(def cache (find-cache))
|
||||||
(os/mkdir cache)
|
(os/mkdir cache)
|
||||||
(def id (filepath-replace repo))
|
(def id (filepath-replace repo))
|
||||||
(def module-dir (string cache sep id))
|
(def module-dir (string cache sep id))
|
||||||
|
(var fresh false)
|
||||||
(when (os/mkdir module-dir)
|
(when (os/mkdir module-dir)
|
||||||
|
(set fresh true)
|
||||||
(os/execute ["git" "clone" repo module-dir] :p))
|
(os/execute ["git" "clone" repo module-dir] :p))
|
||||||
(def olddir (os/cwd))
|
(def olddir (os/cwd))
|
||||||
(os/cd module-dir)
|
(os/cd module-dir)
|
||||||
(try
|
(try
|
||||||
(with-dyns [:rules @{}]
|
(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)
|
(os/execute ["git" "submodule" "update" "--init" "--recursive"] :p)
|
||||||
(import-rules "./project.janet")
|
(import-rules "./project.janet")
|
||||||
(do-rule "install-deps")
|
(do-rule "install-deps")
|
||||||
|
Loading…
Reference in New Issue
Block a user