Skip to content
This repository has been archived by the owner on May 6, 2023. It is now read-only.

Commit

Permalink
bump version to v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
talal committed Feb 8, 2019
1 parent 52caf7e commit e9dc7c4
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 53 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## v1.1.0 - 2019-02-08
### Added
- `init` command which can be used to create a config file in the current
directory.

### Changed
- Better error handling.

## v1.0.1 - 2018-11-15
### Changed:
### Changed
- filepath.Walk() is used for copying recursively instead of manual recursion.
The functionality is the same as before but the code looks a bit nicer now.
- Command-line flags and arguments are parsed manually using the standard
Expand Down
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,37 @@

Bonclay is a fast and minimal backup tool.

Bonclay uses its configuration spec to backup, restore, or sync the specified files/directories.
Bonclay uses a yaml file that has `source:target` pairs to backup, restore, or sync the specified files/directories.

The following is a demo on how you can use Bonclay to manage your dotfiles:

[![asciicast](https://asciinema.org/a/226247.svg)](https://asciinema.org/a/226247)

Refer to use [user guide](./doc/guide.md) for instructions.

## Installation

### Installer script

The simplest way to install Bonclay on Linux or macOS is to run:

```
$ sh -c "$(curl -sL git.io/getbonclay)"
```

This will put the binary in `/usr/local/bin/bonclay`

### Pre-compiled binaries

Pre-compiled binaries for Linux and macOS are avaiable on the [releases page](https://github.com/talal/bonclay/releases/latest).
Pre-compiled binaries for Linux and macOS are avaiable on the
[releases page](https://github.com/talal/bonclay/releases/latest).

The binaries are static executables.

### Homebrew

```
brew install talal/tap/bonclay
$ brew install talal/tap/bonclay
```

### Building from source
Expand All @@ -34,8 +51,8 @@ $ cd $GOPATH/src/github.com/talal/bonclay
$ make install
```

this will put the binary in `/usr/bin/bonclay` or `/usr/local/bin/bonclay` for macOS.
This will put the binary in `/usr/local/bin/bonclay`

## Usage

Take a look at the [user guide](./doc/guide.md).
Refer to the [user guide](./doc/guide.md).
92 changes: 50 additions & 42 deletions doc/guide.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# User guide

Bonclay requires a configuration file in [YAML format](http://yaml.org). A minimal complete configuration could look like this:
Bonclay requires a configuration file in [YAML format](http://yaml.org). A
minimal complete configuration looks like this:

```yaml
backup:
Expand All @@ -15,80 +16,87 @@ sync:

spec:
~/examplefile: file
~/exampledir: dir
~/dir/another one: another one
../../examplefile: ../file
~/example dir: dir
../example dir/some other dir: ../new dir
```
The configuration file contains:
- Options for different Bonclay operations.
- `spec` section, which contains `source:target` pairs which are used by Bonclay to perform a specific operation. You can either use absolute paths or relative paths in the `spec` section (as shown above).
- `spec` section, which contains `source:target` pairs used by Bonclay to
perform a specific operation. You can either use absolute paths or relative
paths (relative to config file location) in the `spec` section (as shown
above).

You can use multiple configuration files for different tasks.
Since the configuration file is provided as an argument at the command line
therefore you can use different configuration files for different tasks.

## Commands
For convenience, you can use the `init` command to create a configuration file
with sane defaults in the current directory:

Bonclay has four operations:
- Sync
```
$ bonclay init
```

## Operations

Bonclay has three operations:
- Backup
- Restore
- Init
- Sync

### Sync
### Backup

Sync creates symbolic links between `source:target` pairs. It is useful for maintaining multiple copies of the same file without using up storage for those copies.
Backup uses the 'source:target' pairs defined in the `spec` and copies the
sources to the targets. It is useful for backing up specific files/directories
to a custom directory hierarchy.

#### Options

| Option | Default value | Description |
| --- | --- | --- |
| `clean` | false | Remove broken symbolic links in the source's parent directory. |
| `overwrite` | false | Overwrite existing source file/directory. |
| --- | --- | --- |
| `overwrite` | false | Overwrite existing file/directory. |

Default behavior:
- If the source's parent directory doesn't exist then create it.
- If there are any broken symbolic links in the source's parent directory then leave them be, unless `clean: true`.
- If the source is already a symbolic link then remove the existing link and create a new link.
- If the source is an existing file or directory then skip it, unless `overwrite: true`.
- If the destination's parent directory doesn't exist then create it.
- If the destination is an existing file, directory, or symlink then skip it
unless `overwrite: true`.

### Backup
### Restore

Backup uses the 'source:target' pairs defined in the `spec` and copies the sources to the targets. It is useful for backing up specific files/directories to a custom directory hierarchy.
Restore is the reverse of backup. It copies the targets to sources and is
useful for restoring specific files/directories to a custom directory hierarchy
(or back to their original location, if same `spec` was used for backup).

#### Options

| Option | Default value | Description |
| --- | --- | --- |
| `overwrite` | false | Overwrite existing source file/directory. |
| `overwrite` | false | Overwrite existing file/directory. |

Default behavior:
- If the destination's parent directory doesn't exist then create it.
- If the destination is an existing file, directory, or symlink then skip it, unless `overwrite: true`.
- If the destination is an existing file, directory, or symlink then skip it
unless `overwrite: true`.

### Restore
### Sync

Restore is the reverse of backup. It copies the targets to sources and is useful for restoring specific files/directories to a custom directory hierarchy.
Sync creates symbolic links between `source:target` pairs. It is useful for
maintaining multiple copies of the same file/directories without using up
storage for those copies.

#### Options

| Option | Default value | Description |
| --- | --- | --- |
| `overwrite` | false | Overwrite existing source file/directory. |
| `clean` | false | Remove broken symbolic links in the source's parent directory. |
| `overwrite` | false | Overwrite existing file/directory. |

Default behavior:
- If the destination's parent directory doesn't exist then create it.
- If the destination is an existing file, directory, or symlink then skip it, unless `overwrite: true`.

## Example

Take a look at my [dotfiles repo](https://github.com/talal/dotfiles) and the included `bonclay.conf.yaml` file. I use Bonclay to keep my dotfiles in sync across different machines.

In order to use my dotfiles, you would only need to do the following:

```
$ cd /path/to/dotfiles
$ bonclay sync bonclay.conf.yaml
```

This will link the configuration/preference files specified in the configuration spec to the ones in the dotfiles directory.

**Note**: If you do intend to use my dotfiles then you will need to install some additional tools that my dotfiles depend on: `./homebrew/install`
- If the source's parent directory doesn't exist then create it.
- If there are any broken symbolic links in the source's parent directory then
leave them be, unless `clean: true`.
- If the source is already a symbolic link then remove the existing link and
create a new link.
- If the source is an existing file or directory then skip it unless
`overwrite: true`.
9 changes: 5 additions & 4 deletions pkg/commands/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ example spec section.
`

const exampleConfig = `
# For a detailed description on the different options, take a look at the
# user guide: https://github.com/talal/bonclay/blob/master/doc/guide.md
# For a detailed description on the different options and how to configure them,
# refer to the user guide: https://github.com/talal/bonclay/blob/master/doc/guide.md
backup:
overwrite: false
Expand All @@ -34,8 +34,9 @@ sync:
spec:
# ~/examplefile: file
# ~/exampledir: dir
# ~/dir/another one: another one
# ../../examplefile: ../file
# ~/example dir: dir
# ../example dir/some other dir: ../new dir
`

// Init represents the init command.
Expand Down

0 comments on commit e9dc7c4

Please sign in to comment.