1zef(1)                User Contributed Perl Documentation               zef(1)
2
3
4
5   Zef
6       Perl6 Module Management
7

Installation

9       Manual
10
11           $ git clone https://github.com/ugexe/zef.git
12           $ cd zef
13           $ perl6 -I. bin/zef install .
14
15       Rakudobrew
16
17       To install via rakudobrew, please use the following command:
18
19           $ rakudobrew build zef
20

USAGE

22           zef --help
23           zef --version
24
25           # install the CSV::Parser distribution
26           zef install CSV::Parser
27
28           # search for distribution names matching `CSV`
29           zef search CSV
30
31           # detailed information for a matching distribution
32           zef info CSV::Parser
33
34           # list all available distributions
35           zef list
36
37           # list reverse dependencies of an identity
38           zef rdepends HTTP::UserAgent
39
40           # test project in current directory
41           zef test .
42
43           # fetch a specific module only
44           zef fetch CSV::Parser
45
46           # fetch a module, then shell into its local path
47           zef look CSV::Parser
48
49           # smoke test modules from all repositories
50           zef smoke
51
52           # run Build.pm if one exists in given path
53           zef build .
54
55           # update Repository package lists
56           zef update
57
58           # upgrade all distributions (BETA)
59           zef upgrade
60
61           # upgrade specific distribution (BETA)
62           zef upgrade CSV::Parser
63
64           # lookup module info by name/path/sha1
65           zef --sha1 locate 9FA0AC28824EE9E5A9C0F99951CA870148AE378E
66
67           # launch browser to named support urls from meta data
68           zef browse zef bugtracker
69
70   More CLI
71       install [*@identities]
72
73       Note: The install process does not install anything until all phases
74       have completed. So, if the user requested to "install A", and A
75       required module B: both would be downloaded, potentially built, tested,
76       and installed -- but only if both passed all their tests. For example:
77       if module A failed its tests, then module B would not be installed
78       (even if it passed its own tests) unless forced.
79
80       [@identities] can take the form of a file path (starting with . or /),
81       URLs, paths, or identities:
82
83           # IDENTITY
84           zef install CSV::Parser
85           zef install "CSV::Parser:auth<tony-o>:ver<0.1.2>"
86           zef install "CSV::Parser:ver<0.1.2>"
87
88           # PATH
89           zef install ./Perl6-Net--HTTP
90
91           # URL
92           zef -v install git://github.com/ugexe/zef.git
93           zef -v install https://github.com/ugexe/zef/archive/master.tar.gz
94           zef -v install https://github.com/ugexe/zef.git@v0.1.22
95
96       A request may contain any number and combination of these. Paths and
97       URLs will be resolved first so they are available to fulfill any
98       dependencies of other requested identities.
99
100       Options
101
102           # Install to a custom locations
103           --install-to=<id> # site/home/vendor/perl, or
104           -to=<id>          # inst#/home/some/path/custom
105
106           # Install all transitive and direct dependencies
107           # even if they are already installed globally (BETA)
108           --contained
109
110           # Load a specific Zef config file
111           --config-path=/some/path/config.json
112
113           # Install only the dependency chains of the requested distributions
114           --deps-only
115
116           # Ignore errors occuring during the corresponding phase
117           --force-resolve
118           --force-fetch
119           --force-extract
120           --force-build
121           --force-test
122           --force-install
123
124           # or set the default to all unset --force-* flags to True
125           --force
126
127           # Set the timeout for corresponding phases
128           --fetch-timeout=600
129           --extract-timeout=3600
130           --build-timeout=3600
131           --test-timeout=3600
132           --install-timeout=3600
133
134           # or set the default to all unset --*-timeout flags to 0
135           --timeout=0
136
137           # Do everything except the actual installations
138           --dry
139
140           # Build/Test/Install each dependency serially before proceeding to Build/Test/Install the next
141           --serial
142
143           # Disable testing
144           --/test
145
146           # Disable build phase
147           --/build
148
149           # Disable fetching dependencies
150           --/depends
151           --/build-depends
152           --/test-depends
153
154       uninstall [*@identities]
155
156       Uninstall the specified distributions
157
158       Note: Requires a bleeding edge rakudo (not available in 6.c)
159
160       update
161
162       Update the package indexes for all "Repository" backends
163
164       Note: Some "Repository" backends, like the default Ecosystems, have an
165       "auto-update" option in "resources/config.json" that can be enabled.
166       This should be the number of hours until it should auto update based on
167       the file system last modified time of the ecosystem json file location.
168
169       upgrade [*@identities] BETA
170
171       Upgrade specified identities. If no identities are provided, zef
172       attempts to upgrade all installed distributions.
173
174       search [$identity]
175
176       How these are handled depends on the "Repository" engine used, which by
177       default is "Zef::Repository::Ecosystems>p6c<"
178
179           $ zef -v --cpan --metacpan search URI
180           ===> Found 4 results
181           -------------------------------------------------------------------------
182           ID|From                              |Package             |Description
183           -------------------------------------------------------------------------
184           1 |Zef::Repository::LocalCache       |URI:ver<0.1.1>    |A URI impleme...
185           2 |Zef::Repository::Ecosystems<p6c>  |URI:ver<0.1.1>    |A URI impleme...
186           3 |Zef::Repository::Ecosystems<cpan> |URI:ver<0.1.1>    |A URI impleme...
187           4 |Zef::Repository::Ecosystems<cpan> |URI:ver<0.000.001>|A URI impleme...
188           5 |Zef::Repository::MetaCPAN         |URI:ver<0.1.1>    |A URI impleme...
189           6 |Zef::Repository::MetaCPAN         |URI:ver<0.000.001>|A URI impleme...
190           -------------------------------------------------------------------------
191
192       info [$identity]
193
194       View meta information of a distribution
195
196           $ zef -v info HTTP::UserAgent
197           - Info for: HTTP::UserAgent
198           - Identity: HTTP::UserAgent:ver<1.1.16>:auth<github:sergot>
199           - Recommended By: Zef::Repository::LocalCache
200           Author:  github:sergot
201           Description:     Web user agent
202           Source-url:      git://github.com/sergot/http-useragent.git
203           Provides: 11 modules
204           #       HTTP::Cookie
205           #       HTTP::Header
206           #       HTTP::Cookies
207           #       HTTP::Message
208           #       HTTP::Request
209           #       HTTP::Response
210           #       HTTP::MediaType
211           #       HTTP::UserAgent
212           #       HTTP::Header::Field
213           #       HTTP::Request::Common
214           #       HTTP::UserAgent::Common
215           Depends: 7 items
216           ---------------------------------
217           ID|Identity           |Installed?
218           ---------------------------------
219           1 |HTTP::Status       |X
220           2 |File::Temp         |X
221           3 |DateTime::Parse    |X
222           4 |Encode             |X
223           5 |MIME::Base64       |X
224           6 |URI                |X
225           7 |IO::Capture::Simple|X
226           ---------------------------------
227
228       Options
229
230           # Extra details (eg, list dependencies and which ones are installed)
231           -v
232
233       list [*@from]
234
235       List known available distributions
236
237           $ zef --installed list
238           ===> Found via /home/nickl/.rakudobrew/moar-master/install/share/perl6/site
239           CSV::Parser:ver<0.1.2>:auth<github:tony-o>
240           Zef:auth<github:ugexe>
241           ===> Found via /home/nickl/.rakudobrew/moar-master/install/share/perl6
242           CORE:ver<6.c>:auth<perl>
243
244       Note that not every Repository may provide such a list, and such lists
245       may only be a subset. For example: We may not be able to get a list of
246       every distribution on metacpan, but we *can* get the $x most recent
247       additions (we use 100 for now).
248
249       [@from] allows you to show results from specific repositories only:
250
251           zef --installed list perl   # Only list modules installed by rakudo itself
252
253           zef list cpan               # Only show available modules from the repository
254           zef list p6c                # with a name field matching the arguments to `list`
255           zef list cached             # (be sure the repository is enabled in config)
256
257       Otherwise results from all enabled repositories will be returned.
258
259       Options
260
261           # Only list installed distributions
262           --installed
263
264           # Additionally list the modules of discovered distributions
265           -v
266
267       depends [$identity]
268
269       List direct and transitive dependencies to the first successful build
270       graph for $identity
271
272           $ zef depends Cro::SSL
273           Cro::Core:ver<0.7>
274           IO::Socket::Async::SSL:ver<0.3>
275           OpenSSL:ver<0.1.14>:auth<github:sergot>
276
277       rdepends [$identity]
278
279       List available distributions that directly depend on $identity
280
281           $ zef rdepends Net::HTTP
282           Minecraft-Tools:ver<0.1.0>
283           LendingClub:ver<0.1.0>
284
285       fetch [*@identities]
286
287       Fetches candidates for given identities
288
289       test [*@paths]
290
291       Run tests on each distribution located at [@paths]
292
293       build [*@paths]
294
295       Run the Build.pm file located in the given [@paths]
296
297       If you want to create a build hook, put the following dependency-free
298       boilerplate in a file named "Build.pm" at the root of your
299       distribution:
300
301           class Build {
302               method build($dist-path) {
303                   # do build stuff to your module
304                   # which is located at $dist-path
305               }
306           }
307
308       Set the env variable ZEF_BUILDPM_DEBUG=1 or use the --debug flag for
309       additional debugging information.
310
311       Note: In the future, a more appropriate hooking solution will replace
312       this.
313
314       look [$identity]
315
316       Fetches the requested distribution and any dependencies (if requested),
317       changes the directory to that of the fetched distribution, and then
318       stops program execution. This allows you modify or look at the source
319       code before manually continuing the install via "zef install ."
320
321       Note that the path to any dependencies that needed to be fetched will
322       be set in env at PERL6LIB, so you should be able to run any build
323       scripts, tests, or complete a manual install without having to specify
324       their locations.
325
326       browse $identity [bugtracker | homepage | source]
327
328       Options
329
330           # disables launching a browser window (just shows url)
331           --/open
332
333       Output the url and launch a browser to open it.
334
335           # also opens browser
336           $ zef browse Net::HTTP bugtracker
337           https://github.com/ugexe/Perl6-Net--HTTP/issues
338
339           # only outputs the url
340           $ zef browse Net::HTTP bugtracker --/open
341           https://github.com/ugexe/Perl6-Net--HTTP/issues
342
343       locate [$identity, $name-path, $sha1-id]
344
345       Options
346
347           # The argument is a sha1-id (otherwise assumed to be an identity or name-path)
348           --sha1
349
350       Lookup a locally installed module by $identity, $name-path, or $sha1-id
351
352           $ zef --sha1 locate A9948E7371E0EB9AFDF1EEEB07B52A1B75537C31
353           ===> From Distribution: zef:ver<*>:auth<github:ugexe>:api<>
354           lib/Zef/CLI.pm6 => ~/rakudo/install/share/perl6/site/sources/A9948E7371E0EB9AFDF1EEEB07B52A1B75537C31
355
356           $ zef locate Zef::CLI
357           ===> From Distribution: zef:ver<*>:auth<github:ugexe>:api<>
358           lib/Zef/CLI.pm6 => ~/rakudo/install/share/perl6/site/sources/A9948E7371E0EB9AFDF1EEEB07B52A1B75537C31
359
360           $ zef locate lib/Zef/CLI.pm6
361           ===> From Distribution: zef:ver<*>:auth<github:ugexe>:api<>
362           Zef::CLI => ~/rakudo/install/share/perl6/site/sources/A9948E7371E0EB9AFDF1EEEB07B52A1B75537C31
363
364       nuke [RootDir | TempDir | StoreDir]
365
366       Deletes all paths in the specific configuration directory
367
368       nuke [site | home]
369
370       Deletes all paths that are rooted in the prefix of the matching
371       CompUnit::Repository name
372
373           # uninstall all modules
374           $ zef nuke site home
375
376   Output Verbosity
377       You can control the logging level using the following flags:
378
379           # More/less detailed output
380           --error, --warn, --info (default), --verbose (-v), --debug
381

Global Configuration

383       Finding the configuration file
384
385       You can always see the configuration file that will be used by running:
386
387           $ zef --help
388
389       In most cases the default configuration combined with command line
390       options should be enough for most users.
391
392       If you are most users (e.g. not: power users, packagers, zef plugin
393       developers) you hopefully don't care about this section!
394
395       How the configuration file is chosen
396
397       The configuration file will be chosen at runtime from one of two
398       (technically four) locations, and one can affect the others (this is
399       not really a design decision and suggestions and PRs are welcome).
400
401       First, and the most precise way, is to specify the config file by
402       passing "--config-path="..."" to any zef command.
403
404       Second, third, and fourth we look at the path pointed to by
405       "%?RESOURCES<config.json>". This will point to
406       "$zef-dir/resources/config.json", where "$zef-dir" will be either:
407
408       ·   The prefix of a common configuration directory, such as
409           $XDG_CONFIG_HOME  or "$HOME/.config".
410
411       ·   The prefix of a rakudo installation location - This is the case if
412           the modules loaded for bin/zef come from an installation
413           CompUnit::Repository.
414
415       ·   The current working directory $*CWD - This is the case when modules
416           loaded for bin/zef come from a non-installation
417           CompUnit::Repository (such as "-I $dist-path").
418
419           To understand how this is chosen, consider:
420
421               # Modules not loaded from an ::Installation,
422               # so %?RESOURCES is $*CWD/resources
423               $ perl6 -I. bin/zef --help
424               ...
425               CONFIGURATION /home/user/perl6/zef/resources/config.json
426               ...
427
428               # Installed zef script loads modules from an ::Installation,
429               # so %?RESOURCES is $perl6-share-dir/site/resources
430               $ zef --help
431               ...
432               CONFIGURATION /home/user/perl6/install/share/perl6/site/resources/EE5DBAABF07682ECBE72BEE98E6B95E5D08675DE.json
433               ...
434
435       This config is loaded, but it is not yet the chosen config! We check
436       that temporary config's "%config<RootDir>" for valid json in a file
437       named "config.json" (i.e. "%config<RootDir>/config.json"). This can be
438       confusing (so it may go away or be refined - PRs welcome) but for most
439       cases it just means "$*HOME/.zef/config.json" will override an
440       installed zef configuration file.
441
442       To summarize:
443
444       ·   You can edit the "resources/config.json" file before you install
445           zef.
446
447           When you "perl6 -I. bin/zef install ." that configuration file be
448           be used to install zef and will also be installed with zef such
449           that it will be the default.
450
451       ·   You can create a "%config<RootDir>/config.json" file.
452
453           Where "%config<RootDir>" comes from the previously mentioned
454           "%?RESOURCES<config.json>"'s "RootDir" field ("$*HOME/.zef" in most
455           cases), to allow overriding zef config behavior on a per user basis
456           (allows setting different "--install-to" targets for, say, a root
457           user and a regular user). Since this new config file could have a
458           different "RootDir" than the default config (used to find the new
459           one in the first place) this behavior may be changed in the future
460           to be less confusing.
461
462       ·   You can override both of the previous entries by passing "zef
463           --config-path="$path" <any command>"
464
465       Configuration fields
466
467       Basic Settings
468
469       ·   RootDir - Where zef will look for a custom config.json file
470
471       ·   TempDir - A staging area for items that have been fetched and need
472           to be extracted/moved
473
474       ·   StoreDir - Where zef caches distributions, package lists, etc after
475           they've been fetched and extracted
476
477       ·   DefaultCUR - This sets the default value for "--install-to="..."".
478           The default value of "auto" means it will first try installing to
479           rakudo's installation prefix, and if its not writable by the
480           current user it will install to "$*HOME/.perl6". These directories
481           are not chosen by zef - they are actually represented by the magic
482           strings "site" and "home" (which, like "auto", are valid values
483           despite not being paths along with "vendor" and "perl")
484
485       Phases / Plugins Settings
486
487       These consist of an array of hashes that describe how to instantiate
488       some class that fulfills the appropriate interface from Zef.pm
489       ("Repository" "Fetcher" "Extractor" "Builder" "Tester")
490
491       The descriptions follow this format:
492
493           {
494               "short-name" : "p6c",
495               "enabled" : 1,
496               "module" : "Zef::Repository::Ecosystems",
497               "options" : { }
498           }
499
500       and are instantiated via
501
502           ::($hash<module>).new(|($hash<options>)
503
504       ·   short-name - This adds an enable and disable flag by the same name
505           to the CLI (e.g. "--p6c" and "--/p6c") and is used when referencing
506           which object took some action.
507
508       ·   enabled - Set to 0 to skip over the object during consideration (it
509           will never be loaded). If omitted or if the value is non 0 then it
510           will be enabled for use.
511
512       ·   module - The name of the class to instantiate. While it doesn't
513           technically have to be a module it does need to be a known
514           namespace to "require".
515
516       ·   options - These are passed to the objects "new" method and may not
517           be consistent between modules as they are free to implement their
518           own requirements.
519
520       See the configuration file in resources/config.json
521       <https://github.com/ugexe/zef/blob/master/resources/config.json> for a
522       little more information on how plugins are invoked.
523
524       You can see debug output related to chosing and loading plugins by
525       setting the env variable ZEF_PLUGIN_DEBUG=1
526

FAQ

528       CPAN?
529
530       CPAN is now used as a default (alongside the familiar p6c "ecosystem").
531
532           # Explicitly enable cpan (now defaults to the same as `zef search zef`)
533           $ zef --cpan search Inline::Perl5
534
535       You can also use a beta version of MetaCPAN with --metacpan which uses
536       Repository::MetaCPAN
537
538           $ zef --metacpan search Inline::Perl5
539
540       Proxy support?
541
542       All the default fetching plugins have proxy support, but you'll need to
543       refer to the backend program's (wget, curl, git, etc) docs. You may
544       need to set an ENV variable, or you may need to add a command line
545       option for that specific plugin in resources/config.json
546
547       Custom installation locations?
548
549       Pass a path to the -to / --install-to option and prefix the path with
550       "inst#" (unless you know what you're doing)
551
552           $ zef -to="inst#/home/perl6/custom" install Text::Table::Simple
553           ===> Searching for: Text::Table::Simple
554           ===> Testing: Text::Table::Simple:ver<0.0.3>:auth<github:ugexe>
555           ===> Testing [OK] for Text::Table::Simple:ver<0.0.3>:auth<github:ugexe>
556           ===> Installing: Text::Table::Simple:ver<0.0.3>:auth<github:ugexe>
557
558       To make the custom location discoverable:
559
560           # Set the PERL6LIB env:
561           $ PERL6LIB="inst#/home/perl6/custom" perl6 -e "use Text::Table::Simple; say 'ok'"
562           ok
563
564           # or simply include it as needed
565           $ perl6 -Iinst#/home/perl6/custom -e "use Text::Table::Simple; say 'ok'"
566           ok
567
568       Test reporting?
569
570       This feature can be enabled by passing `--p6ctesters` (and having
571       "Net::HTTP" installed) or `--cpantesters` (and having
572       "Zef::CPANReporter" installed)
573
574
575
576perl v5.28.1                      2019-03-02                            zef(1)
Impressum