mirror of
https://github.com/janet-lang/janet
synced 2025-02-02 10:19:10 +00:00
Add update-pkgs to jpm.
This allows for periodically updating the package listing.
This commit is contained in:
parent
54b66a4199
commit
088c926196
25
auxbin/jpm
25
auxbin/jpm
@ -187,7 +187,7 @@
|
|||||||
|
|
||||||
(def- path-splitter
|
(def- path-splitter
|
||||||
"split paths on / and \\."
|
"split paths on / and \\."
|
||||||
(peg/compile ~(any (* '(any (if-not (set `\/`) 1)) (set `\/`)))))
|
(peg/compile ~(any (* '(any (if-not (set `\/`) 1)) (+ (set `\/`) -1)))))
|
||||||
|
|
||||||
(def- filepath-replacer
|
(def- filepath-replacer
|
||||||
"Convert url with potential bad characters into a file path element."
|
"Convert url with potential bad characters into a file path element."
|
||||||
@ -579,10 +579,17 @@ int main(int argc, const char **argv) {
|
|||||||
(error "too many references resolving package url"))
|
(error "too many references resolving package url"))
|
||||||
# Handle short names
|
# Handle short names
|
||||||
(unless (string/find ":" repo)
|
(unless (string/find ":" repo)
|
||||||
|
(def pkgs
|
||||||
|
(try (require "pkgs")
|
||||||
|
([err f]
|
||||||
(install-git (dyn :pkglist default-pkglist))
|
(install-git (dyn :pkglist default-pkglist))
|
||||||
(def pkgs (require "pkgs"))
|
(require "pkgs"))))
|
||||||
(break (install-git (get-in pkgs ['packages :value (symbol repo)])
|
(def next-repo (get-in pkgs ['packages :value (symbol repo)]))
|
||||||
(if recurse (inc recurse) 0))))
|
(unless next-repo
|
||||||
|
(error (string "package " repo " not found.")))
|
||||||
|
(unless (or (string? next-repo) (dictionary? next-repo))
|
||||||
|
(error (string "expected string or table for repository, got " next-repo)))
|
||||||
|
(break (install-git next-repo (if recurse (inc recurse) 0))))
|
||||||
(def cache (find-cache))
|
(def cache (find-cache))
|
||||||
(os/mkdir cache)
|
(os/mkdir cache)
|
||||||
(def id (filepath-replace repo))
|
(def id (filepath-replace repo))
|
||||||
@ -619,7 +626,7 @@ int main(int argc, const char **argv) {
|
|||||||
(def path (string destdir sep name))
|
(def path (string destdir sep name))
|
||||||
(array/push (dyn :installed-files) path)
|
(array/push (dyn :installed-files) path)
|
||||||
(add-body "install"
|
(add-body "install"
|
||||||
(try (os/mkdir destdir) ([err] nil))
|
(os/mkdir destdir)
|
||||||
(copy src destdir)))
|
(copy src destdir)))
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -823,7 +830,7 @@ on a project, or from anywhere to do operations on the global module cache (modp
|
|||||||
Subcommands are:
|
Subcommands are:
|
||||||
build : build all artifacts
|
build : build all artifacts
|
||||||
help : show this help text
|
help : show this help text
|
||||||
install (repo) : install artifacts. If a repo is given, install the contents of that
|
install (repo or name) : install artifacts. If a repo is given, install the contents of that
|
||||||
git repository, assuming that the repository is a jpm project. If not, build
|
git repository, assuming that the repository is a jpm project. If not, build
|
||||||
and install the current project.
|
and install the current project.
|
||||||
uninstall (module) : uninstall a module. If no module is given, uninstall the module
|
uninstall (module) : uninstall a module. If no module is given, uninstall the module
|
||||||
@ -835,6 +842,7 @@ Subcommands are:
|
|||||||
run rule : run a rule. Can also run custom rules added via (phony "task" [deps...] ...)
|
run rule : run a rule. Can also run custom rules added via (phony "task" [deps...] ...)
|
||||||
or (rule "ouput.file" [deps...] ...).
|
or (rule "ouput.file" [deps...] ...).
|
||||||
rules : list rules available with run.
|
rules : list rules available with run.
|
||||||
|
update-pkgs : Update the current package listing from the remote git repository selected.
|
||||||
|
|
||||||
Keys are:
|
Keys are:
|
||||||
--modpath : The directory to install modules to. Defaults to $JANET_MODPATH, $JANET_PATH, or (dyn :syspath)
|
--modpath : The directory to install modules to. Defaults to $JANET_MODPATH, $JANET_PATH, or (dyn :syspath)
|
||||||
@ -888,6 +896,10 @@ Flags are:
|
|||||||
(def ks (sort (seq [k :keys (dyn :rules)] k)))
|
(def ks (sort (seq [k :keys (dyn :rules)] k)))
|
||||||
(each k ks (print k)))
|
(each k ks (print k)))
|
||||||
|
|
||||||
|
(defn- update-pkgs
|
||||||
|
[]
|
||||||
|
(install-git (dyn :pkglist default-pkglist)))
|
||||||
|
|
||||||
(def- subcommands
|
(def- subcommands
|
||||||
{"build" build
|
{"build" build
|
||||||
"clean" clean
|
"clean" clean
|
||||||
@ -899,6 +911,7 @@ Flags are:
|
|||||||
"clear-cache" clear-cache
|
"clear-cache" clear-cache
|
||||||
"run" local-rule
|
"run" local-rule
|
||||||
"rules" list-rules
|
"rules" list-rules
|
||||||
|
"update-pkgs" update-pkgs
|
||||||
"uninstall" uninstall-cmd})
|
"uninstall" uninstall-cmd})
|
||||||
|
|
||||||
(def- args (tuple/slice (dyn :args) 1))
|
(def- args (tuple/slice (dyn :args) 1))
|
||||||
|
4
jpm.1
4
jpm.1
@ -134,6 +134,10 @@ like make. run will run a single rule or build a single file.
|
|||||||
.BR rules
|
.BR rules
|
||||||
List all rules that can be run via run. This is useful for exploring rules in the project.
|
List all rules that can be run via run. This is useful for exploring rules in the project.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.BR update-pkgs
|
||||||
|
Update the package listing by installing the 'pkgs' package. Same as jpm install pkgs
|
||||||
|
|
||||||
.SH ENVIRONMENT
|
.SH ENVIRONMENT
|
||||||
|
|
||||||
.B JANET_PATH
|
.B JANET_PATH
|
||||||
|
Loading…
Reference in New Issue
Block a user