1
0
Fork 0
mirror of synced 2024-06-15 13:51:08 -04:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Andreas Schmidt 2019-07-21 18:36:10 +02:00
commit 34a1720ecd
No known key found for this signature in database
GPG key ID: FEE0A611BEA6DEA0
5 changed files with 41 additions and 77 deletions

View file

@ -1,16 +1,26 @@
language: python language: python
python:
- "2.7"
- "pypy"
- "3.2"
- "3.3"
- "3.4"
- "3.5"
- "3.6"
- "nightly"
- "pypy3"
sudo: false sudo: false
.mixins:
- &xenial
dist: xenial
jobs:
include:
- python: "2.7"
- python: "pypy"
- python: "3.2"
- python: "3.3"
- python: "3.4"
- python: "3.5"
- python: "3.6"
- <<: *xenial
python: "3.7"
- <<: *xenial
python: "3.8-dev"
- python: "nightly"
- python: "pypy3"
script: script:
- ./test/test_travis - ./test/test_travis

View file

@ -1,7 +1,7 @@
The MIT License (MIT) The MIT License (MIT)
===================== =====================
**Copyright (c) 2014-2018 Anish Athalye (me@anishathalye.com)** **Copyright (c) 2014-2019 Anish Athalye (me@anishathalye.com)**
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in

View file

@ -34,7 +34,7 @@ you're just looking for [some inspiration][inspiration], we've got you covered.
The following will help you get set up using Dotbot in just a few steps. The following will help you get set up using Dotbot in just a few steps.
If you're using Git, you can add Dotbot as a submodule: If you're using **Git**, you can add Dotbot as a submodule:
```bash ```bash
cd ~/.dotfiles # replace with the path to your dotfiles cd ~/.dotfiles # replace with the path to your dotfiles
@ -44,7 +44,7 @@ cp dotbot/tools/git-submodule/install .
touch install.conf.yaml touch install.conf.yaml
``` ```
If you're using Mercurial, you can add Dotbot as a subrepo: If you're using **Mercurial**, you can add Dotbot as a subrepo:
```bash ```bash
cd ~/.dotfiles # replace with the path to your dotfiles cd ~/.dotfiles # replace with the path to your dotfiles
@ -108,43 +108,15 @@ The conventional name for the configuration file is `install.conf.yaml`.
- [git submodule update --init --recursive, Installing submodules] - [git submodule update --init --recursive, Installing submodules]
``` ```
The configuration file can also be written in JSON. Here is the JSON equivalent The configuration file is typically written in YAML, but it can also be written
of the YAML configuration given above. in JSON (which is a subset of YAML). [Here][json-equivalent] is the JSON
[equivalent][json2yaml] of the YAML configuration given above. JSON
The conventional name for this file is `install.conf.json`. configuration files are conventionally named `install.conf.json`.
```json
[
{
"defaults": {
"link": {
"relink": true
}
}
},
{
"clean": ["~"]
},
{
"link": {
"~/.dotfiles": "",
"~/.tmux.conf": "tmux.conf",
"~/.vim": "vim",
"~/.vimrc": "vimrc"
}
},
{
"shell": [
["git submodule update --init --recursive", "Installing submodules"]
]
}
]
```
Configuration Configuration
------------- -------------
Dotbot uses YAML or JSON formatted configuration files to let you specify how Dotbot uses YAML or JSON-formatted configuration files to let you specify how
to set up your dotfiles. Currently, Dotbot knows how to [link](#link) files and to set up your dotfiles. Currently, Dotbot knows how to [link](#link) files and
folders, execute [shell](#shell) commands, and [clean](#clean) directories of folders, execute [shell](#shell) commands, and [clean](#clean) directories of
broken symbolic links. Dotbot also supports user [plugins](#plugins) for custom broken symbolic links. Dotbot also supports user [plugins](#plugins) for custom
@ -161,7 +133,9 @@ Tasks are run in the order in which they are specified. Commands within a task
do not have a defined ordering. do not have a defined ordering.
When writing nested constructs, keep in mind that YAML is whitespace-sensitive. When writing nested constructs, keep in mind that YAML is whitespace-sensitive.
Following the formatting used in the examples is a good idea. Following the formatting used in the examples is a good idea. If a YAML
configuration file is not behaving as you expect, try inspecting the
[equivalent JSON][json2yaml] and check that it is correct.
Also, note that `~` in YAML is the same as `null` in JSON. If you want a single Also, note that `~` in YAML is the same as `null` in JSON. If you want a single
character string containing a tilde, make sure to enclose it in quotes: `'~'` character string containing a tilde, make sure to enclose it in quotes: `'~'`
@ -186,11 +160,11 @@ Available extended configuration parameters:
| Link Option | Explanation | | Link Option | Explanation |
| -- | -- | | -- | -- |
| `path` | The target for the symlink, the same as in the shortcut syntax (default:null, automatic (see below)) | | `path` | The source for the symlink, the same as in the shortcut syntax (default:null, automatic (see below)) |
| `create` | When true, create parent directories to the link as needed. (default:false) | | `create` | When true, create parent directories to the link as needed. (default:false) |
| `relink` | Removes the old target if it's a symlink (default:false) | | `relink` | Removes the old target if it's a symlink (default:false) |
| `force` | Force removes the old target, file or folder, and forces a new link (default:false) | | `force` | Force removes the old target, file or folder, and forces a new link (default:false) |
| `relative` | Use a relative path when creating the symlink (default:false, absolute links) | | `relative` | Use a relative path to the source when creating the symlink (default:false, absolute links) |
| `glob` | Treat a `*` character as a wildcard, and perform link operations on all of those matches (default:false) | | `glob` | Treat a `*` character as a wildcard, and perform link operations on all of those matches (default:false) |
| `if` | Execute this in your `$SHELL` and only link if it is successful. | | `if` | Execute this in your `$SHELL` and only link if it is successful. |
@ -212,7 +186,7 @@ Available extended configuration parameters:
If the source location is omitted or set to `null`, Dotbot will use the If the source location is omitted or set to `null`, Dotbot will use the
basename of the destination, with a leading `.` stripped if present. This makes basename of the destination, with a leading `.` stripped if present. This makes
the following three config files equivalent: the following config files equivalent:
```yaml ```yaml
- link: - link:
@ -244,28 +218,6 @@ the following three config files equivalent:
relink: true relink: true
``` ```
```json
[
{
"link": {
"~/bin/ack": null,
"~/.vim": null,
"~/.vimrc": {
"relink": true
},
"~/.zshrc": {
"force": true
},
"~/.config/": {
"glob": true,
"path": "config/*",
"relink": true
}
}
}
]
```
### Shell ### Shell
Shell commands specify shell commands to be run. Shell commands are run in the Shell commands specify shell commands to be run. Shell commands are run in the
@ -413,7 +365,7 @@ Packaging
License License
------- -------
Copyright (c) 2014-2018 Anish Athalye. Released under the MIT License. See Copyright (c) 2014-2019 Anish Athalye. Released under the MIT License. See
[LICENSE.md][license] for details. [LICENSE.md][license] for details.
[PyPI]: https://pypi.org/project/dotbot/ [PyPI]: https://pypi.org/project/dotbot/
@ -421,6 +373,8 @@ Copyright (c) 2014-2018 Anish Athalye. Released under the MIT License. See
[dotfiles-template]: https://github.com/anishathalye/dotfiles_template [dotfiles-template]: https://github.com/anishathalye/dotfiles_template
[inspiration]: https://github.com/anishathalye/dotbot/wiki/Users [inspiration]: https://github.com/anishathalye/dotbot/wiki/Users
[managing-dotfiles-post]: http://www.anishathalye.com/2014/08/03/managing-your-dotfiles/ [managing-dotfiles-post]: http://www.anishathalye.com/2014/08/03/managing-your-dotfiles/
[json-equivalent]: https://gist.github.com/anishathalye/84bd6ba1dbe936e05141e07ec45f5fd4
[json2yaml]: https://www.json2yaml.com/
[wiki]: https://github.com/anishathalye/dotbot/wiki [wiki]: https://github.com/anishathalye/dotbot/wiki
[contributing]: CONTRIBUTING.md [contributing]: CONTRIBUTING.md
[license]: LICENSE.md [license]: LICENSE.md

View file

@ -7,8 +7,8 @@
# is useful because we don't know the name of the python binary. # is useful because we don't know the name of the python binary.
''':' # begin python string; this line is interpreted by the shell as `:` ''':' # begin python string; this line is interpreted by the shell as `:`
which python3 >/dev/null 2>&1 && exec python3 "$0" "$@"
which python >/dev/null 2>&1 && exec python "$0" "$@" which python >/dev/null 2>&1 && exec python "$0" "$@"
which python3 >/dev/null 2>&1 && exec python3 "$0" "$@"
which python2 >/dev/null 2>&1 && exec python2 "$0" "$@" which python2 >/dev/null 2>&1 && exec python2 "$0" "$@"
>&2 echo "error: cannot find python" >&2 echo "error: cannot find python"
exit 1 exit 1

View file

@ -84,7 +84,7 @@ class Link(dotbot.Plugin):
success &= self._create(destination) success &= self._create(destination)
if not self._exists(os.path.join(self._context.base_directory(), path)): if not self._exists(os.path.join(self._context.base_directory(), path)):
success = False success = False
self._log.warning('Nonexistent target %s -> %s' % self._log.warning('Nonexistent source %s -> %s' %
(destination, path)) (destination, path))
continue continue
if force or relink: if force or relink:
@ -227,10 +227,10 @@ class Link(dotbot.Plugin):
# again, we use absolute_source to check for existence # again, we use absolute_source to check for existence
elif not self._exists(absolute_source): elif not self._exists(absolute_source):
if self._is_link(link_name): if self._is_link(link_name):
self._log.warning('Nonexistent target %s -> %s' % self._log.warning('Nonexistent source %s -> %s' %
(link_name, source)) (link_name, source))
else: else:
self._log.warning('Nonexistent target for %s : %s' % self._log.warning('Nonexistent source for %s : %s' %
(link_name, source)) (link_name, source))
else: else:
self._log.lowinfo('Link exists %s -> %s' % (link_name, source)) self._log.lowinfo('Link exists %s -> %s' % (link_name, source))