|
4194 | 4194 | (spit manifest-name b)) |
4195 | 4195 |
|
4196 | 4196 | (defn bundle/manifest |
4197 | | - "Get the manifest for a give installed bundle" |
| 4197 | + "Get the manifest for a given installed bundle." |
4198 | 4198 | [bundle-name] |
4199 | 4199 | (def name (get-manifest-filename bundle-name)) |
4200 | 4200 | (assertf (fexists name) "no bundle %v found" bundle-name) |
|
4256 | 4256 | nil) |
4257 | 4257 |
|
4258 | 4258 | (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.`` |
4260 | 4262 | [bundle-name] |
4261 | 4263 | (def breakage @{}) |
4262 | 4264 | (each b (bundle/list) |
|
4292 | 4294 | order) |
4293 | 4295 |
|
4294 | 4296 | (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.`` |
4297 | 4299 | [] |
4298 | 4300 | (def topo (bundle/topolist)) |
4299 | 4301 | (def rtopo (reverse topo)) |
|
4322 | 4324 | (not (not (os/stat (bundle-dir bundle-name) :mode)))) |
4323 | 4325 |
|
4324 | 4326 | (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.`` |
4326 | 4332 | [path &keys config] |
4327 | 4333 | (def path (bundle-rpath path)) |
4328 | 4334 | (def s (sep)) |
|
4366 | 4372 | (error (string "missing dependencies " (string/join missing ", ")))) |
4367 | 4373 | (put man :dependencies deps) |
4368 | 4374 | (put man :info info)) |
4369 | | - (def clean (get config :clean)) |
4370 | | - (def check (get config :check)) |
4371 | 4375 | (def module (get-bundle-module bundle-name)) |
4372 | 4376 | (def all-hooks (seq [[k v] :pairs module :when (symbol? k) :unless (get v :private)] (keyword k))) |
4373 | 4377 | (put man :hooks all-hooks) |
4374 | 4378 | (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) |
4377 | 4380 | (do-hook module bundle-name :build man) |
4378 | 4381 | (do-hook module bundle-name :install man) |
4379 | 4382 | (if (empty? (get man :files)) (print "no files installed, is this a valid bundle?")) |
4380 | 4383 | (sync-manifest man) |
4381 | | - (when check |
4382 | | - (do-hook module bundle-name :check man))) |
| 4384 | + (do-hook module bundle-name :check man)) |
4383 | 4385 | (print "installed " bundle-name) |
4384 | 4386 | (when (get man :has-bin-script) |
4385 | 4387 | (def binpath (string (dyn *syspath*) s "bin")) |
4386 | 4388 | (eprintf "executable scripts have been installed to %s" binpath)) |
4387 | 4389 | bundle-name) |
4388 | 4390 |
|
4389 | 4391 | (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.`` |
4393 | 4396 | [bundle-name dest-dir &opt is-backup] |
4394 | 4397 | (var i 0) |
4395 | 4398 | (def man (bundle/manifest bundle-name)) |
|
4419 | 4422 | dest-dir) |
4420 | 4423 |
|
4421 | 4424 | (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.`` |
4425 | 4428 | [bundle-name path &keys new-config] |
4426 | 4429 | (def manifest (bundle/manifest bundle-name)) |
4427 | 4430 | (def config (get manifest :config @{})) |
|
4448 | 4451 | bundle-name) |
4449 | 4452 |
|
4450 | 4453 | (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*)`." |
4452 | 4455 | [manifest dest &opt chmod-mode] |
4453 | 4456 | (def files (get-files manifest)) |
4454 | 4457 | (def s (sep)) |
|
4476 | 4479 | ret) |
4477 | 4480 |
|
4478 | 4481 | (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*)`." |
4480 | 4483 | [manifest src &opt dest chmod-mode] |
4481 | 4484 | (default dest src) |
4482 | 4485 | (def files (get-files manifest)) |
|
4493 | 4496 | absdest) |
4494 | 4497 |
|
4495 | 4498 | (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.`` |
4499 | 4502 | [manifest src &opt dest chmod-mode] |
4500 | 4503 | (default dest src) |
4501 | 4504 | (def s (sep)) |
|
4510 | 4513 | (errorf "bad path %s - file is a %s" src mode))) |
4511 | 4514 |
|
4512 | 4515 | (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] |
4518 | 4519 | (def s (sep)) |
4519 | | - (default dest (last (string/split s src))) |
| 4520 | + (default filename (last (string/split s src))) |
4520 | 4521 | (default chmod-mode 8r755) |
4521 | 4522 | (os/mkdir (string (dyn *syspath*) s "bin")) |
4522 | 4523 | (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)) |
4524 | 4525 |
|
4525 | 4526 | (defn bundle/update-all |
4526 | | - "Reinstall all bundles" |
| 4527 | + "Reinstall all bundles." |
4527 | 4528 | [&keys configs] |
4528 | 4529 | (each bundle (bundle/topolist) |
4529 | 4530 | (bundle/reinstall bundle ;(kvs configs))))) |
|
0 commit comments