1
0
Fork 0
mirror of synced 2024-11-05 00:28:57 -05:00
Commit graph

250 commits

Author SHA1 Message Date
Anish Athalye
24f88c4584 Merge branch 'eengstrom/259-link-prefix' 2021-06-02 20:21:40 -04:00
Anish Athalye
74822af9f5 Merge branch 'eengstrom/270-recursive-globbing' 2021-06-02 20:11:25 -04:00
Anish Athalye
67a3527f67 Merge branch 'eengstrom/280-fix-pyenv-config' 2021-06-02 19:48:19 -04:00
Eric Engstrom
cb6718ba87 test: fix pyenv configuration in vagrant
- addresses change in `pyenv init -` that no longer adjusts PATH.
- also updated testing README.md for readability.

FIXES: #280
2021-06-02 19:47:57 -04:00
Eric Engstrom
6c044208fa
feat: Add prefix: 'string' option to linking when glob: true.
Allows one to store files in a directory or git-repo without the leading 
`.`, as in:

```
dotconf:
├── README.md
├── bin
│   ├── dotbot
│   ├── look
│   ├── pbfile
│   └── ...
├── dot
│   ├── bashrc
│   ├── gitconfig
│   ├── gitignore
│   ├── gorc
│   ├── login
│   ├── ...
│   ├── zshrc
│   └── zshenv
```

Can take a many-line dotbot.yml listing **each** file in `dotconf/dot`,
reducing it to five lines:

```
- link:
    ~/:
      path: dotconf/dot/*
      glob: true
      prefix: '.'
```

FIXES: #259
2021-05-27 12:07:17 -05:00
Eric Engstrom
ab7cbd42dc
feat: Support recursive globbing with **.
For example, will handle an entire directory tree of files, linking all 
files:

```
- link:
    ~/.config/:
      path: dotconf/config/**
      glob: true
```

NOTE, this feature requires newer versions of `glob()` (Python >= 3.5),
and `dotbot` will throw an error if using an earlier version of python.

For testing purposes, added:
  - ability to skip tests in test harness
  - added testing for older Python(s).

FIXES: #270
2021-05-27 11:58:55 -05:00
Anish Athalye
aa9335089b Migrate changelog from wiki into source tree 2021-04-29 18:24:51 -04:00
Anish Athalye
e0cf5f993f Merge branch 'eengstrom/244-fix-link-glob-patterns' 2021-04-29 18:09:39 -04:00
Anish Athalye
289c724b1c Merge branch 'Justintime50/readme-being-typo' 2021-04-29 08:07:06 -04:00
Justintime50
84a836ea33 Fixes typos in README "being" to "begin" 2021-04-28 16:30:48 -06:00
Eric Engstrom
f56e903cee
Support both [] and ? glob patterns 2021-04-15 23:28:19 -05:00
Anish Athalye
dcb3743115 Release 1.19.0 2021-04-06 10:54:27 -04:00
Anish Athalye
0f5a5f3385 Update dates 2021-03-31 20:11:24 -04:00
Anish Athalye
472223300f Drop CI support for Python 3.4 and add Python 3.9 2021-03-13 06:22:58 -05:00
Anish Athalye
eb7f3fb7b1 Include git hash in version when available 2021-02-27 14:34:52 -05:00
Anish Athalye
5f849ad07f Merge branch 'sitiom/master' 2021-02-25 15:05:02 -05:00
sitiom
6de5cc6c2c Add PowerShell install script 2021-02-25 14:43:49 -05:00
Anish Athalye
f15293b3d5 Rename 'canonicalize-path' into 'canonicalize'
This parallels 'relative' (it's not 'relative-path'). The old
'canonicalize-path' is still supported for backward compatibility.
2021-02-25 08:26:19 -05:00
Anish Athalye
66489f7955 Fix missing endings of heredocs 2021-02-25 08:16:27 -05:00
Anish Athalye
dac7a9bc88 Add --debug flag to test driver
This is easier than the old method of adding `DEBUG=true` to the top of
test files.
2021-02-25 08:14:34 -05:00
Anish Athalye
43b62ed532 Merge branch 'etkeys/feature/cli-force-shell-out-err-true' 2021-02-25 08:02:13 -05:00
E. Keys
c35382c06d Add cli option force shell show stderr/stdout
Passing `--verbose` flag two times will now force shell commands to show
stderr/stdout output regardless of settings in config file.

Resolves #104
2021-02-25 08:00:07 -05:00
Anish Athalye
5f1e33ed67 Merge branch 'etkeys/feature/expose-cli-options-for-plugins' 2021-02-25 07:57:19 -05:00
E. Keys
b18ba4d392 Make parsed CLI options available to plugins 2021-02-25 07:57:12 -05:00
Anish Athalye
22ed23c7d9 Merge branch 'etkeys/feature/glob-with-exclude' 2021-02-25 06:59:22 -05:00
Anish Athalye
de8793de99 Merge branch 'etkeys/bugfix/fix-glob-dropping-leading-dot' 2021-02-25 06:44:32 -05:00
E. Keys
6c6fee697e Improve globbing behavior with leading '.' 2021-02-25 06:44:14 -05:00
Anish Athalye
945c1e5a4e Add mode option to create directive
See <https://github.com/anishathalye/dotbot/issues/260>. Thanks to
@eengstrom for the feature suggestion.
2021-02-25 06:25:17 -05:00
Anish Athalye
4ec846cdad Make tests run on pull requests 2020-12-26 05:01:29 -05:00
Anish Athalye
d55e2af83a Add direct link to tutorials page in the wiki 2020-12-23 18:26:56 -05:00
Anish Athalye
be539e6e24 Remove packaging information from README
This content was not relevant to anyone but the owner of the PyPI
package.
2020-12-23 18:08:48 -05:00
Anish Athalye
a5e1dca91d Release 1.18.0 2020-12-23 18:04:23 -05:00
Anish Athalye
d7629553bd Switch to GitHub Actions 2020-12-18 15:34:15 -05:00
Anish Athalye
cf366bbf66 Fix interaction between --only and defaults
We should treat defaults specially, and even when `--only` is
specified, we should always run defaults.
2020-11-22 16:58:00 -05:00
E. Keys
2ec7a24129 Add exclude parameter for link globbing
- Added `exclude` parameter to _link_. Now, an array of glob patterns
    can be given that will be used to remove items from a glob match.
    This parameter will only have an effect when `glob` is `true`.
- Updated README to add description for `exclude` and add in examples.

Resolves #247
2020-11-22 14:13:11 -05:00
Anish Athalye
5294594f5a Merge branch 'bobwhitelock/add-force-color-option' into master 2020-08-23 09:16:58 -04:00
Bob Whitelock
2432a2ba87 Add --force-color option
This forces Dotbot to produce colored output, regardless of whether it
is outputting to a TTY.

This is useful to support use cases such as piping colored Dotbot output
into another program for formatting (e.g. I want to indent the output as
part of a larger installation script); this was not previously easy to
do as this would cause the output to lose its colored formatting.

This option cannot be provided at the same time as the existing
`--no-color` option, as there's no logical interpretation of what effect
providing both of these should have.

As part of this change I've refactored some existing code determining
whether output should be colored to where options are parsed, as this
made this change simpler and I think it makes sense for all this logic
to be performed in the same place.
2020-08-23 00:02:26 +01:00
Anish Athalye
1d4f4348bb Release 1.17.1 2020-07-24 08:42:12 -04:00
Anish Athalye
98b87c16be Merge branch 'TimPansino/feature/module_run_support' 2020-07-24 08:41:51 -04:00
tpansin
322661dde1 Added support to run with python -m 2020-07-23 08:44:06 -07:00
Anish Athalye
c5e709d433 Make error for empty config a little friendlier
In the setup guide in the README, we have people start out with an empty
file (created using `touch`). Before this patch, Dotbot gave the
following error:

    Configuration file must be a list of tasks

Instead, with this patch, Dotbot says:

    Configuration file is empty, no work to do

This change was prompted by
https://github.com/anishathalye/dotbot/pull/226.
2020-06-25 16:07:23 -04:00
Anish Athalye
043373ea74 Standardize documentation for extended config
This patch adds parameter/explanation tables for the two other commands
that support extended configuration syntaxes, so now we have
identically-formatted tables for link, shell, and clean.

This change was prompted by
https://github.com/anishathalye/dotbot/issues/223.
2020-06-19 20:31:43 -04:00
Anish Athalye
8f136ee73f Remove confusing example
Without an explanation of what's going on here, this example is
unnecessarily confusing. It's a neat example, but probably not worth
explaining this in Dotbot's README.

See https://github.com/anishathalye/dotbot/issues/224.
2020-06-19 20:02:03 -04:00
Anish Athalye
f5e019105e Work around subprocess.call() issue on Windows
On POSIX-like systems, calling `subprocess.call()` with both
`shell=True` and `executable='...'` has the following behavior:

> If `shell=True`, on POSIX the _executable_ argument specifies a
> replacement shell for the default `/bin/sh`.

(via https://docs.python.org/3/library/subprocess.html?highlight=subprocess#popen-constructor)

This seems to have a similar behavior on Windows, but this is
problematic when a POSIX shell is substituted for cmd.exe. This is
because when `shell=True`, the shell is invoked with a '/c' argument,
which is the correct argument for cmd.exe but not for Bash, which
expects a '-c' argument instead. See here:
1def7754b7/Lib/subprocess.py (L1407)

This is problematic when combined with Dotbot's behavior, where the
`executable` argument is set based on `$SHELL`. For example, when
running in Git Bash, the `$SHELL` environment variable is set to Bash,
so any commands run by Dotbot will fail (because it'll invoke Bash with
a '/c' argument).

This behavior of setting the `executable` argument based on `$SHELL` was
introduced in 7593d8c134. This is the
desired behavior. See discussion in
https://github.com/anishathalye/dotbot/issues/97 and
https://github.com/anishathalye/dotbot/pull/100.

Unfortunately, this doesn't work quite right on Windows. This patch
works around the issue by avoiding setting the `executable` argument
when the platform is Windows, which is tested using
`platform.system() == 'Windows'`. This means that shell commands
executed by Dotbot on this platform will always be run using cmd.exe.
Invocations of single programs or simple commands will probably work
just fine in cmd.exe. If Bash-like behavior is desired, the user will
have to write their command as `bash -c '...'`.

This shouldn't have any implications for backwards-compatibility,
because setting the `executable` argument on Windows didn't do the right
thing anyways. Previous workarounds that users had should continue to
work with the new code.

When using Python from CYGWIN, `platform.system()` returns something
like 'CYGWIN_NT-...', so it won't be detected with the check, but this
is the correct behavior, because CYGWIN Python's `subprocess.call()` has
the POSIX-like behavior.

This patch also refactors the code to factor out the
`subprocess.call()`, which was being called in both `link.py` and
`shell.py`, so the workaround can be applied in a single place.

See the following issues/pull requests for a discussion of this bug:
- https://github.com/anishathalye/dotbot/issues/170
- https://github.com/anishathalye/dotbot/pull/177
- https://github.com/anishathalye/dotbot/issues/219

An issue has also been raised in Python's issue tracker:
- https://bugs.python.org/issue40467

Thanks to @shivapoudel for originally reporting the issue, @SuJiKiNen
for debugging it and submitting a pull request, and @mohkale for
suggesting factoring out the code so that other plugins could use it.
2020-05-01 11:52:51 -04:00
Anish Athalye
7ffaa65482 Add --only and --except command-line arguments
Internal to Dotbot, we use the name "skip" instead of "except", because
the latter is a keyword, and using a name like "except_" didn't seem as
nice.
2020-03-26 11:23:07 -04:00
Anish Athalye
5d83f9e797 Upgrade PyYAML to 5.3 2020-01-06 20:11:22 -05:00
Anish Athalye
9281d120dd Release 1.17.0 2020-01-03 16:47:57 -05:00
Anish Athalye
ec8498ffb8 Merge branch 'ypid/add/link_real_path_option' 2020-01-03 16:46:19 -05:00
Anish Athalye
320d5d0123 Add tests for canonicalize-path 2020-01-03 16:45:35 -05:00
Robin Schneider
138fdbc8d7
Add 'canonicalize-path' option to link
Dotbot had a hardcoded behaviour that the BASEDIR was always passed to
os.path.realpath which "returns the canonical path of the specified
filename, eliminating any symbolic links encountered in the path".

This might not always be desirable so this commit makes it configurable.

The use case where `canonicalize-path` comes in handy is the following:
You want to provide dotfiles in the Filesystem Hierarchy Standard under
`/usr/local/share/ypid_dotfiles/`. Now you want to provide
`.config/dotfiles` as a default in `/etc/skel`. When you now
pre-configure `/etc/skel` by running dotbot in it set has HOME, dotfiles
will refer to `/usr/local/share/ypid_dotfiles/` and not
`/etc/skel/.config/dotfiles` which does not look nice.

This is related to but not the same as the `relative` parameter used
with link commands.
2020-01-03 22:35:13 +01:00