Commit Graph

23 Commits

Author SHA1 Message Date
Tim Byrne ebb6715aad
Reduce supported labels for architecture 2022-02-21 14:01:08 -06:00
Tim Byrne 027c7359ac
Merge pull request #304 from erijo/multiple-classes 2022-01-22 18:14:23 -06:00
Tim Byrne 5ae553b078
Add support for distro_family (#213)
Obtained from /etc/os-release: ID_LIKE.
Alternate attributes f & distro_family.
2022-01-22 18:05:15 -06:00
Erik Flodin 42c74efbac
Add support for multiple local classes
A local class is set with:
$ yadm config local.class cls1

More classes can be added with:
$ yadm config --add local.class cls2
$ yadm config --add local.class cls3

Any of cls1, cls2 and cls3 can be used in an alternate condition.

For templates, the existing variable yadm.class/YADM_CLASS is set to
the last class (i.e. cls3) to remain compatible with how it works
today and with what the following command gives:
$ yadm config local.class

For the default template processor there is no explicit yadm.classes
variable. Instead a yadm.class condition will check against all
classes.

For the other processors, a new template variable YADM_CLASSES will be
set to all classes separated by newline. For jinja2 templates a class
can be checked with: {%- if "cls" in YADM_CLASSES.split("\n") %}

For esh templates the logic is a bit more complex, but it is possible
to do.

Fixes #185.
2021-12-27 21:14:09 +01:00
Tim Byrne 85e05d311a
Merge pull request #203 from jameshclrk/arch-alternative 2021-12-21 16:50:41 -06:00
Tim Byrne d298b42653
Merge pull request #257 from erijo/extension 2020-12-22 10:08:30 -06:00
Tim Byrne 62b109ad2d
Rename yadm_y -> yadm_cmd
-Y is no longer used when running commands
2020-11-22 17:09:44 -06:00
Tim Byrne 8efe2c8fad
Improve tests to use XDG* variables
Instead of overriding YADM_DIR via -Y, set the XDG* environment
variables.
2020-11-22 17:09:44 -06:00
Erik Flodin f22c4d04cc
Add support for the extension "condition"
This special condition doesn't affect the selection process and is only
supported to support syntax highlighting and language detection for alt files
as reported in #239.
2020-10-25 10:41:52 +01:00
Jonathan Daigle f348e154c7
Add support for ESH 2020-05-27 19:38:15 -04:00
James Clark 77d2da4e9b
Support architecture in alternates (#202) 2020-02-22 02:08:53 +00:00
Tim Byrne f8d6d2b0e4
Change tests to expect relative links 2019-11-24 13:15:42 -06:00
Tim Byrne 616baaeac6
Rename default template processor 2019-10-30 17:29:17 -05:00
Tim Byrne f3249e00b5
Ensure base directories for alternates before creation 2019-10-12 18:22:02 -05:00
Tim Byrne 6d5467951a
Properly handle missing "." in alternate conditions 2019-10-12 09:59:03 -05:00
Tim Byrne 4ea3ed9e2a
Allow storing alternates elsewhere (#90)
This change allows alternates to be stored in "$YADM_DIR/alt". The
correct path within the work tree will be symlinked.

Storing alternates within the work tree is still allowed. Both locations
will be considered when choosing an appropriate alternate file.
2019-10-12 09:59:02 -05:00
Tim Byrne 3a192db420
Remove symlinks before processing a template 2019-10-11 07:20:03 -05:00
Tim Byrne 6a3199ceea
Support DISTRO in alternates (#72) 2019-10-06 16:35:47 -05:00
Tim Byrne cfda485b34
Implement future alternate processing 2019-10-02 15:16:02 -05:00
Tim Byrne c29292d02b
Split out processing of alt (past/future) 2019-09-27 08:40:31 -05:00
Tim Byrne 093fc24b1b
Test that links are removed for invalid alternates (#65) 2019-04-05 08:58:59 -05:00
Tim Byrne fb1181c8a9
Add tests for directory alternates
While this feature was added back in version 1.05, tests were never
added for it. These tests have identified bugs in the directory
alternates.
2019-04-05 08:58:22 -05:00
Tim Byrne e7f9616b39
Rewrite testing system (#119)
The new test system is written with py.test. These tests are more
comprehensive, run faster by an order of magnitude, and are far more
maintainable. The tests themselves conform to PEP8.
2019-02-20 07:48:25 -06:00