Copyright © 2017 Samuel Walladge
Experimental dotfiles manager in rust.
This is a project for PRT455 (Software Engineering Practice). The idea is to build a dotfiles manager that is fast, stable, and features the best from a selection of other dotfiles managers and community interest.
Direction for the project taken from initial research, documented in the project plan, and a survey.
GitHub issues are currently used for tracking progress and documenting requirements.
Simply download the archive containing the binary for your platform from the releases page. Extract the archive, move the binary to somewhere on your path, and voila!
shell
$ git clone https://github.com/swalladge/dotfiles-manager
$ cd dotfiles-manager
$ make release
This will download the sources and produce a binary at ./target/release/dotfiles-manager
.
If you have cargo
and the rust toolchain installed, you can install it through that.
$ cargo install dotfiles-manager
For continuous integration, all tests are run on every push with Travis.
Unit tests are run by cargo with cargo test
. These are tests on individual
functions and small functionality within each module, created as standard in
rust. (Rust book reference on testing)
Integration tests are for testing the program as a whole. They are important for this software, since its core functionality is working with files and links; many side effects. These are implemented with custom bash scripts. Run as follows:
``` $ ./integration_tests.sh
$ # or for a single test: $ ./integrationtests.sh testnoforceinstall.sh
$ # or to disable kcov (useful for local testing - faster) $ ./integrationtests.sh --no-kcov $ ./integrationtests.sh --no-kcov testnoforce_install.sh ```
Each test must a bash script in the ./test/integration_tests/
. The main bash
script runner runs each test by sourcing the bash script and calling the
run_test
function. All code should be inside the run_test
function and
locally scoped to avoid clashing with the main script or other tests.
The tests get some variables to use:
exe
| the binary to run for the dotfiles manager (with kcov)exe_sans
| the binary to run for the dotfiles manager (sans kcov)$TEMP_LOCAL
| the local directory to do stuff in - make files, etc - reset after each test$BASE_DIR
| root directory of projectBasically, for anything new, there should be unit tests that cover any functions that don't have IO side effects, and integration tests for any functionality that interacts with std{in,out,err} or files/link/directories.
Code coverage reports are generated with kcov
and uploaded to the Coveralls
project.
They can be generated and viewed locally with make coverage
.
For convenience, a Makefile
is included with some shortcut commands:
clean
: cleans the build directorybuild
: builds the softwarecoverage
: generates the code coverage report (time consuming)unit-test
: runs the unit testsintegration-test
: runs the integration teststest
: runs all testscloc
: shows a report on lines of code (requires the cloc
program installed)``` dotfiles-manager 0.0.1 Samuel Walladge samuel@swalladge.id.au Manages dotfiles
USAGE: dotfiles-manager [FLAGS] [OPTIONS] [SUBCOMMAND]
FLAGS: -f, --force Force creating/removing directories and symlinks, overwriting any that exist. -h, --help Prints help information -y, --yes Assume yes answer to all prompts - non-interactive mode, useful for scripts. -n, --no Do not actually make any filesystem changes or run hooks -V, --version Prints version information -v, --verbose Be verbose
OPTIONS: -d, --dir
SUBCOMMANDS: add add a file to package help Prints this message or the help of the given subcommand(s) install install tags/packages remove remove tags/packages ```
dotfiles-manager - experimental dotfiles manager in rust
Copyright (C) 2017 Samuel Walladge
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.