| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In mkrc, separate the list of files with newlines instead of spaces.
Change the `$IFS` when iterating to handle this.
We hand the file off to rcup, which encodes the file name by replacing
spaces with the bell character (`\a`).
rcup then sends the file name off to lsrc, which decodes the bell back
into a space.
The test makes sure an `a` character is in the filename, in case some
encoding goes wrong. We use tr(1) instead of sed(1) because tr(1)
handles `\a`.
Shoutout to Sublime Text 3 for forcing this issue.
|
|
|
|
|
|
|
| |
Run the hooks in alphabetical order so that people can more predictably
manage their hooks.
While here, clean up the NEWS.md.in.
|
|
|
|
|
|
|
|
|
|
|
| |
The $USER environment variable is not guaranteed to exist, but $LOGNAME
is defined by POSIX[0] (Environment Variables, section 8.3 Other
Environment Variables). Use that instead.
Thanks to Scott Stevenson for pointing out this solution, and Debian for
raising the problem.
[0]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
|
|
|
|
|
|
|
|
|
|
|
|
| |
Calls `find(1)` with the `-exec` action just like before but instead of `run_hooks()`
letting `find` execute the hook directly it is wrapped in a shell one-liner which
changes to the hook's directory and executes the hook with "./" prepended to its
basename. These changes allow hooks to refer to dotfiles with relative paths.
For instance we can call a Makefile two directories up simply with `make -C ../..`.
Also make sure we are compatible with Solaris' Bourne shell and `find(1)`.
Closes #150. Closes #149.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Solaris 10 lacks readlink(1). Additionally, its different grep(1) and
diff(1) do not take a `-q` flag.
Use a Perl one-liner instead of readlink(1) which is missing on Solaris 10.
Also because /usr/bin/grep and diff(1) don't understand the `-q` option, make
them go quiet by redirecting stdout to `/dev/null` instead.
The Perl dependency only exists in the test suite, so it does not incur
a runtime penalty for end users.
This is to work around the fact that readlink(1) is missing on Solaris.
The tradeoff is: on Solaris, installing third-party software (readlink)
is a pain, whereas on e.g. FreeBSD installing third-party software
(Perl) is simple and common.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Based on issue #82, we now provide `-B` to override the hostname. In
particular:
- `mkrc -B foo` will enable `-o` but with the hostname set up `foo`.
- `lsrc -B foo` will work like normal `lsrc` except it treats `host-foo`
as the host-specific directory.
- `rcup -B foo` will run a normal `rcup` except `host-foo` is the
host-specific directory.
- `rcdn -B foo` is just like normal `rcdn`, but with `host-foo` as the
host-specific directory.
The `HOSTNAME` can also be set in the rcrc(5), and this is overridden by
the aforementioned `-B`.
While making this change: The `test/Makefile.am` used a mix of tabs and
spaces. Since it's a Makefile, replace it all with tabs.
|
|
|
|
| |
This is a thoughtbot project now, so assign copyright to thoughtbot.
|
|
|
|
|
|
|
|
|
| |
This allows, at least, more executables to be picked up.
It doesn't pick up group-executable scripts and ignore xattr files but
it should be better than what was there before.
Closes #80
|
|
|
|
|
| |
This uses a bit of a hack: if `$DEBUG` is set to `:`, then we are not in
debug mode.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The `-v` (verbose) flag for `cp`, `ln`, and `rm` is not standard. It is
simple to implement using shell functions, so introduce `cp_v`, `ln_v`,
and `rm_v`. These shell functions use the existing `$VERBOSE` variable
for printing, which simplifies the code and reduces the number of
variables.
Fixes #61.
|
|
|
|
|
|
| |
It's likely that while shuffling commits for the quoting of "$@" issue,
some lines were kept from both that branch and master resulting in an
invalid state.
|
|
|
|
|
|
|
|
|
| |
* http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_03
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08
Fixes #46.
This does not handle quotes around `$@`. That is taken separately in #53.
|
|
|
|
|
|
|
|
|
|
| |
The code was setting the $hook_file variable to
$dotfiles_dir/hooks/$when-$direction outside of the loop which actually
sets the $dotfiles_dir variable to each of the dotfiles directories
being processed in turn. This would lead to (for example) /hooks/post-up
which is not correct.
The fix is to move that logic into the loop.
|
|
|
|
|
|
|
| |
We had been relying on `hooks/pre-up` and `hooks/post-up` files to
exist. This explicitly checks first.
Fixes #34.
|
|
|
|
|
|
|
|
| |
Instead of using the non-standard `-s` argument to `hostname`, use `sed`
to split out everything after the first period. This fixes lsrc(1) on
Cygwin, among others.
Fixes #28.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Typically a directory structure is copied instead of symlinked, while
files are symlinked. However, some cases require symlinked dirs: git
submodules, vim plugins, and so on.
This introduces a `SYMLINK_DIRS` option for rcrc(5) that takes a
space-separated list of "exclude patterns". Any directory matching these
patterns is symlinked.
This also introduces a `-S` argument for lsrc(1), rcup(1), and rcdn(1).
This argument takes a pattern, for one-off directory symlinking. It can
be repeated.
This also introduces `-S` and `-s` for mkrc(1). `-S` will re-install the
files as symlinks, and `-s` will not.
This does work with `-C`, though perhaps unintuitively - we don't know
what the user means in this case. However, it will not crash.
Bug: `-s` does not work right if `SYMLINK_DIRS` is set. Bug #36
addresses this.
|
|
|
|
|
| |
If the `pre-up` or `post-up` files are actually directories, run the
executable contents of them in an arbitrary order.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As reported in #23, you can trick `rcup` into installing into `.` with
this `CDPATH`:
export CDPATH=/tmp:.
As described [online][1], it is a mistake to export the `CDPATH`
environment variable to begin with. Since it is a one-liner to work
around it, though, it's worth fixing.
The workaround is to unset `CDPATH` at the beginning of the script. This
does not affect the outside environment, it only affects the script and
its functions.
[1]: http://bosker.wordpress.com/2012/02/12/bash-scripters-beware-of-the-cdpath/
|
|
|
|
|
|
|
|
|
| |
* Centralize configuration loading in rcm.sh(.in)
* Check for readability, not just existence
Add RCRC notes to all manpages. Putting the environment variables in a
table lines them up more neatly and definitively, across all output
formats, and also follows the examples used by e.g. BSD ls(1).
|
|
|
|
|
| |
The hooks can be skipped using `-K`, if needed and they can be forced
with the `-k` flag.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These are programs that, if they exist, will run before or after the
syncronization/removal is run. Three use cases caused this:
1. The thoughtbot dotfiles will run a vundle installation set of
commands after intitial synchronization.
2. I changed the location of `.bash_history` to `.bash/history` and
wanted to move `.bash_history` to `.bash/history` after up to preserve
existing history.
3. Moving from an existing old-style custom install script to `rcup`
might require some cleanup; this happened in practice, and required a
simple script.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The suite now honors the `COPY_ALWAYS` option in rcrc(5). This can be
set to a space-separated list of file globs. Any file matching a glob is
copied instead of symlinked. This is handy both for secure programs
(`netrc`, `ssh/id_*`) and for programs that oddly re-write files
(`weechat/*`).
To always copy everything, use the `*` glob.
This is reflected throughout the suite as follows:
* lsrc now has a `-F` option which shows a symbol to indicate whether it
is a symlink (`@`) or a copy (`X`).
* rcdn only removes symlinks unless the file under question matches a
`COPY_ALWAYS` glob, in which case it is removed regardless of whether
it is a symlink.
* rcup will copy instead of symlinking any file that matches any
`COPY_ALWAYS` glob.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some files prefer to be copies instead of symlinks---for example,
OpenSSH ignores symlinks. Add the `-C` option to mkrc(1) and rcup(1) to
handle this.
mkrc -C .ssh
rcup -C ssh
This does raise a synchronization problem that I do not yet know how to
solve; namely, what to do when the rc file changes. Perhaps a `rcsync`
command is in order; perhaps `rcup` should handle this; perhaps `rcsync`
is a better name for `rcup`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lsrc(1), rcup(1), and rcdn(1) commands now take any number of `-e`
flags, used to specify an exclusion pattern. This can also be controlled
via rcrc(5), the `EXCLUDES` variable.
An exclusion pattern specifies a file glob to skip. In the case of
lsrc(1), any file matching the glob is not listed; in rcup(1) it is not
symlinked; and in rcdn(1) it is not removed.
The file glob can be preceded by the name of a dotfiles directory
(separated from the file glob by a colon) to increase the specificity.
Useful for:
rcdn -e rcrc
rcup -d work-dotfiles -e bashrc
rcup -d ~/.dotfiles -d wife-dotfiles -d sys-dotfiles -e wife-dotfiles:tigrc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This program will remove all your rc files that are symlinked. This can
be further controlled by `-d` and `-t`.
For example, you can feel comfortable trying new rc files because you
can quickly remove them again with `-d`.
rcup -d thoughtbot-dotfiles
rcdn -d thoughtbot-dotfiles
Likewise, when you're done with Python just drop it:
rcdn -t python
|
|
|
|
|
|
|
|
| |
To make it easier to manage host-specific rc files, `mkrc` now supports
a `-o` option. This causes the specified file to be added to the host
section named for the current machine.
This option is in conflict with the `-t` option.
|
|
|
|
|
|
| |
Pull the `-V`, `-v`, `-q`, `-t`, and `-d` out into the
`handle_common_flags` and `handle_metadata_flags` functions, shared
between the different programs.
|
|
The `make release` command will build the Debian package, push the
version to a git tag on GitHub, and upload the docs to GitHub pages.
This also adds a `deb` target, along with `build-docs`, `upload-docs`,
`build-tag`, and `push-tag`.
In addition, introduce a `NEWS.md` file.
Both `rcm.sh.in` and `NEWS.md.in` will act as input files. This is to
abstract over the version number.
|