Skip to content

Commit 6a96b61

Browse files
pyrmontbakpakin
authored andcommitted
Tidy up bundle/ docstrings
1 parent 8ec465d commit 6a96b61

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

src/boot/boot.janet

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4194,7 +4194,7 @@
41944194
(spit manifest-name b))
41954195

41964196
(defn bundle/manifest
4197-
"Get the manifest for a give installed bundle"
4197+
"Get the manifest for a given installed bundle."
41984198
[bundle-name]
41994199
(def name (get-manifest-filename bundle-name))
42004200
(assertf (fexists name) "no bundle %v found" bundle-name)
@@ -4256,7 +4256,9 @@
42564256
nil)
42574257

42584258
(defn bundle/uninstall
4259-
"Remove a bundle from the current syspath"
4259+
``Remove a bundle from the current syspath. There is 1 hook called during
4260+
uninstallation (uninstall). A user can register a hook by defining a
4261+
function with the same name in the bundle script.``
42604262
[bundle-name]
42614263
(def breakage @{})
42624264
(each b (bundle/list)
@@ -4292,8 +4294,8 @@
42924294
order)
42934295

42944296
(defn bundle/prune
4295-
"Remove all orphaned bundles from the syspath. An orphaned bundle is a bundle that is
4296-
marked for :auto-remove and is not depended on by any other bundle."
4297+
``Remove all orphaned bundles from the current syspath. An orphaned bundle is a
4298+
bundle that is marked for :auto-remove and is not depended on by any other bundle.``
42974299
[]
42984300
(def topo (bundle/topolist))
42994301
(def rtopo (reverse topo))
@@ -4322,7 +4324,11 @@
43224324
(not (not (os/stat (bundle-dir bundle-name) :mode))))
43234325

43244326
(defn bundle/install
4325-
"Install a bundle from the local filesystem. The name of the bundle will be inferred from the bundle, or passed as a parameter :name in `config`."
4327+
``Install a bundle from the local filesystem. The name of the bundle is
4328+
the value mapped to :name in either `config` or the info file. There are
4329+
5 hooks called during installation (dependencies, clean, build, install and
4330+
check). A user can register a hook by defining a function with the same name
4331+
in the bundle script.``
43264332
[path &keys config]
43274333
(def path (bundle-rpath path))
43284334
(def s (sep))
@@ -4366,30 +4372,27 @@
43664372
(error (string "missing dependencies " (string/join missing ", "))))
43674373
(put man :dependencies deps)
43684374
(put man :info info))
4369-
(def clean (get config :clean))
4370-
(def check (get config :check))
43714375
(def module (get-bundle-module bundle-name))
43724376
(def all-hooks (seq [[k v] :pairs module :when (symbol? k) :unless (get v :private)] (keyword k)))
43734377
(put man :hooks all-hooks)
43744378
(do-hook module bundle-name :dependencies man)
4375-
(when clean
4376-
(do-hook module bundle-name :clean man))
4379+
(do-hook module bundle-name :clean man)
43774380
(do-hook module bundle-name :build man)
43784381
(do-hook module bundle-name :install man)
43794382
(if (empty? (get man :files)) (print "no files installed, is this a valid bundle?"))
43804383
(sync-manifest man)
4381-
(when check
4382-
(do-hook module bundle-name :check man)))
4384+
(do-hook module bundle-name :check man))
43834385
(print "installed " bundle-name)
43844386
(when (get man :has-bin-script)
43854387
(def binpath (string (dyn *syspath*) s "bin"))
43864388
(eprintf "executable scripts have been installed to %s" binpath))
43874389
bundle-name)
43884390

43894391
(defn- bundle/pack
4390-
"Take an installed bundle and create a bundle source directory that can be used to
4391-
reinstall the bundle on a compatible system. This is used to create backups for installed
4392-
bundles without rebuilding, or make a prebuilt bundle for other systems."
4392+
``Take an installed bundle and create a bundle source directory that can be
4393+
used to reinstall the bundle on a compatible system. This is used to create
4394+
backups for installed bundles without rebuilding, or make a prebuilt bundle
4395+
for other systems.``
43934396
[bundle-name dest-dir &opt is-backup]
43944397
(var i 0)
43954398
(def man (bundle/manifest bundle-name))
@@ -4419,9 +4422,9 @@
44194422
dest-dir)
44204423

44214424
(defn bundle/replace
4422-
"Reinstall an existing bundle from a new directory. Similar to bundle/reinstall,
4423-
but installs the replacement bundle from any directory. This is necesarry to replace a package without
4424-
breaking any dependencies."
4425+
``Reinstall an existing bundle from a new directory. Similar to
4426+
bundle/reinstall, but installs the replacement bundle from any directory.
4427+
This is necessary to replace a package without breaking any dependencies.``
44254428
[bundle-name path &keys new-config]
44264429
(def manifest (bundle/manifest bundle-name))
44274430
(def config (get manifest :config @{}))
@@ -4448,7 +4451,7 @@
44484451
bundle-name)
44494452

44504453
(defn bundle/add-directory
4451-
"Add a directory during the install process relative to `(dyn *syspath*)`"
4454+
"Add a directory during an install relative to `(dyn *syspath*)`."
44524455
[manifest dest &opt chmod-mode]
44534456
(def files (get-files manifest))
44544457
(def s (sep))
@@ -4476,7 +4479,7 @@
44764479
ret)
44774480

44784481
(defn bundle/add-file
4479-
"Add files during an install relative to `(dyn *syspath*)`"
4482+
"Add a file during an install relative to `(dyn *syspath*)`."
44804483
[manifest src &opt dest chmod-mode]
44814484
(default dest src)
44824485
(def files (get-files manifest))
@@ -4493,9 +4496,9 @@
44934496
absdest)
44944497

44954498
(defn bundle/add
4496-
"Add files and directories during a bundle install relative to `(dyn *syspath*)`.
4497-
Added files and directories will be recorded in the bundle manifest such that they are properly tracked
4498-
and removed during an upgrade or uninstall."
4499+
``Add a file or directory during an install relative to `(dyn *syspath*)`.
4500+
Added files and directories will be recorded in the bundle manifest such
4501+
that they are properly tracked and removed during an upgrade or uninstall.``
44994502
[manifest src &opt dest chmod-mode]
45004503
(default dest src)
45014504
(def s (sep))
@@ -4510,20 +4513,18 @@
45104513
(errorf "bad path %s - file is a %s" src mode)))
45114514

45124515
(defn bundle/add-bin
4513-
``
4514-
Shorthand for adding scripts during an install. Scripts will be installed to
4515-
`(string (dyn *syspath*) "/bin")` by default and will be set to be executable.
4516-
``
4517-
[manifest src &opt dest chmod-mode]
4516+
``Add a script to the bin subdirectory of the current syspath. Scripts will
4517+
be set to be executable.``
4518+
[manifest src &opt filename chmod-mode]
45184519
(def s (sep))
4519-
(default dest (last (string/split s src)))
4520+
(default filename (last (string/split s src)))
45204521
(default chmod-mode 8r755)
45214522
(os/mkdir (string (dyn *syspath*) s "bin"))
45224523
(put manifest :has-bin-script true)
4523-
(bundle/add-file manifest src (string "bin" s dest) chmod-mode))
4524+
(bundle/add-file manifest src (string "bin" s filename) chmod-mode))
45244525

45254526
(defn bundle/update-all
4526-
"Reinstall all bundles"
4527+
"Reinstall all bundles."
45274528
[&keys configs]
45284529
(each bundle (bundle/topolist)
45294530
(bundle/reinstall bundle ;(kvs configs)))))

0 commit comments

Comments
 (0)