Skip to content
This repository was archived by the owner on Jan 22, 2023. It is now read-only.

Commit a2e0d36

Browse files
committed
refactor: Rename projeoct from 'dotty' to 'dotfox'
1 parent 37b88be commit a2e0d36

File tree

11 files changed

+66
-51
lines changed

11 files changed

+66
-51
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dist/
2-
dotty
2+
dotfox
33
nimbledeps/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Dotty
1+
# DotFox
22

33
🌎 Simple dotfile manager
44

completions/dotty.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# shellcheck shell=bash
22

33
# based on https://tylerthrailkill.com/2019-01-19/writing-bash-completion-script-with-subcommands/
4-
_dotty() {
4+
_dotfox() {
55
local i=1 cmd
66

77
# iterate over COMP_WORDS (ending at currently completed word)
@@ -20,22 +20,22 @@ _dotty() {
2020
(( i++ ))
2121
done
2222

23-
# check if we're completing 'dotty'
23+
# check if we're completing 'dotfox'
2424
if [[ "$i" -eq "$COMP_CWORD" ]]; then
2525
local cur="${COMP_WORDS[COMP_CWORD]}"
2626
# shellcheck disable=SC2207
27-
COMPREPLY=($(compgen -W "status reconcile rootStatus rootReconcile --version --help" -- "$cur"))
27+
COMPREPLY=($(compgen -W "status deploy rootStatus rootDeploy --version --help" -- "$cur"))
2828
return
2929
fi
3030

31-
# if we're not completing 'dotty', then we're completing a subcommand
31+
# if we're not completing 'dotfox', then we're completing a subcommand
3232
case "$cmd" in
3333
status)
3434
COMPREPLY=() ;;
35-
reconcile)
35+
deploy)
3636
COMPREPLY=() ;;
3737
*)
3838
;;
3939
esac
4040

41-
} && complete -F _dotty dotty
41+
} && complete -F _dotfox dotfox

docs/getting-started.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
TODO (THIS IS OUT OF DATE)
44

5-
When setting up Dotty, you need two things: a dot directory (`dotDir`) and a destination directory (`destDir`). `dotDir` is a directory that your dotfiles tracked with your VCS of choice, such as `~/.dotfiles`. `destDir` is the location to deploy your dotfiles to, such as `~/`.
5+
When setting up DotFox, you need two things: a dot directory (`dotDir`) and a destination directory (`destDir`). `dotDir` is a directory that your dotfiles tracked with your VCS of choice, such as `~/.dotfiles`. `destDir` is the location to deploy your dotfiles to, such as `~/`.
66

7-
Specify these two things in `~/.config/dotty/config.toml` (or with using the config directory of your choice with `XDG_CONFIG_HOME`)
7+
Specify these two things in `~/.config/dotfox/config.toml` (or with using the config directory of your choice with `XDG_CONFIG_HOME`)
88

99
```toml
1010
[config]
1111
dotDir = "~/.dotfiles"
1212
destDir = "~"
1313
```
1414

15-
Now, specify the dotfiles you wish to automatically deploy. These dotfiles will have symlinks created in the `destDir`, pointing to their respective file or directory in `dotDir`. Specify the dotfiles using a shell script located at `~/.config/dotty/deployments/default.sh`
15+
Now, specify the dotfiles you wish to automatically deploy. These dotfiles will have symlinks created in the `destDir`, pointing to their respective file or directory in `dotDir`. Specify the dotfiles using a shell script located at `~/.config/dotfox/deployments/default.sh`
1616

1717
```bash
1818
#!/usr/bin/env bash
@@ -31,7 +31,7 @@ for dotfile in "${dotfiles[@]}"; do
3131
done
3232
```
3333

34-
Dotty will execute this script, and use every line of standad output as a separate dotfile to track. Standard output would look like the following in this case
34+
DotFox will execute this script, and use every line of standad output as a separate dotfile to track. Standard output would look like the following in this case
3535

3636
```txt
3737
/home/edwin/.bashrc
@@ -40,10 +40,10 @@ Dotty will execute this script, and use every line of standad output as a separa
4040

4141
Note that with every line, there is always a prefix of the `destDir` (`/home/edwin` i.e. `~/`)
4242

43-
Now, let's try running Dotty
43+
Now, let's try running DotFox
4444

4545
```sh
46-
$ dotty status
46+
$ dotfox status
4747
[ERR_NULL_NULL] /home/edwin/.bashrc
4848
-> (not fixable)
4949
-> Is there a file or directory at /home/edwin/.dotfiles/.bashrc?
@@ -63,7 +63,7 @@ echo 'clear' > ~/.dotfiles/.bash_logout
6363
Now, let's try running again
6464

6565
```sh
66-
$ dotty status
66+
$ dotfox status
6767
[ERR_NULL_FILE] /home/edwin/.bashrc
6868
-> (fixable)
6969
[ERR_NULL_FILE] /home/edwin/.bash_logout
@@ -73,12 +73,12 @@ Done.
7373

7474
As you can see, the `ERR_NULL_NULL` status codes changed to `ERR_NULL_FILE`. The last `NULL` changed to a file because we placed the correct files in the `dotDir` (destination directory)
7575

76-
Now that the dotfiles are automatically fixable, let's run `dotty reconcile`
76+
Now that the dotfiles are automatically fixable, let's run `dotfox deploy`
7777

7878
```sh
79-
$ dotty reconcile
79+
$ dotfox deploy
8080
Done.
81-
$ dotty status
81+
$ dotfox status
8282
[OK] /home/edwin/.bashrc
8383
[OK] /home/edwin/.bash_logout
8484
Done.

docs/installation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
## From Source
44

55
```sh
6-
git clone https://github.com/eankeen/dotty
7-
cd ./dotty
6+
git clone https://github.com/eankeen/dotfox
7+
cd ./dotfox
88
nimble build
9-
./dotty --help
9+
./dotfox --help
1010
```
1111

12-
## From Distribution
12+
## From Distribution

docs/reference.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ The symlink correctly points to the target file or directory
1818

1919
#### `OK/`
2020

21-
The symlink correctly points to the target file or directory, with the caveat that the target name has an extraneous suffix slash. On `dotty reconcile`, this will automatically be normalized
21+
The symlink correctly points to the target file or directory, with the caveat that the target name has an extraneous suffix slash. On `dotfox deploy`, this will automatically be normalized
2222

2323
#### `ERR`
2424

25-
A conflict exists. Dotty will attempt to automatically fix the problem. However, if dotty is unable to, you will need to fix it yourself
25+
A conflict exists. DotFox will attempt to automatically fix the problem. However, if dotfox is unable to, you will need to fix it yourself
2626

2727
### `destDirCode`
2828

@@ -34,15 +34,15 @@ The particular dotfile has a corresponding symlink in the destination directory
3434

3535
#### `FILE`
3636

37-
The particular dotfile has a corresponding file in the destination directory. Dotty will try to automatically replace this with a symlink pointing to said target dotfile on reconcile
37+
The particular dotfile has a corresponding file in the destination directory. DotFox will try to automatically replace this with a symlink pointing to said target dotfile on deploy
3838

3939
#### `DIR`
4040

41-
The particular dotfile has a corresponding directory in the destination directory. Dotty will try to automatically replace this with a symlink pointing to said target dotfile on reconcile
41+
The particular dotfile has a corresponding directory in the destination directory. DotFox will try to automatically replace this with a symlink pointing to said target dotfile on deploy
4242

4343
#### `NULL`
4444

45-
The particular dotfile has no corresponding file or directory in the destination directory. Dotty will try to automatically replace this with a symlink pointing to said target dotfile on reconcile
45+
The particular dotfile has no corresponding file or directory in the destination directory. DotFox will try to automatically replace this with a symlink pointing to said target dotfile on deploy
4646

4747
### `dotDirCode`
4848

docs/troubleshooting.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Troubleshooting
2+
3+
### 1. Deploy doesn't seem to do anything
4+
5+
It is possible that your Bash script tells dotfox to do multiple things to the same file / underlying symlink

dotty.nimble

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author = "Edwin Kofler"
55
description = "Dotfile Manager"
66
license = "Apache-2.0"
77
srcDir = "src"
8-
bin = @["dotty"]
8+
bin = @["dotfox"]
99

1010
# Dependencies
1111

src/do.nim

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ proc doAbstract(
2727
runNullNull: proc(dotfile: string, srcFile: string)
2828
) =
2929
for i, files in dotfiles:
30-
let srcFile = files[0]
31-
let destFile = files[1]
30+
let srcFile = rts(files[0])
31+
let destFile = rts(files[1])
3232

3333
try:
3434
createDir(parentDir(destFile))
@@ -73,7 +73,9 @@ proc doAbstract(
7373

7474
proc doStatus*(dotDir: string, homeDir: string, options: Options, dotfiles: seq[array[2, string]]) =
7575
proc runSymlinkSymlink(file: string, srcFile: string, options: Options): void =
76-
# This is possible if dotty does it's thing correctly, but
76+
# TODO: check if the symlink points to a valid target
77+
78+
# This is possible if dotfox does it's thing correctly, but
7779
# the user replaces the file/directory in dotDir with a symlink
7880
# to something else. It is an error, even if the symlink resolves
7981
# properly, and it should not be possible in normal circumstances
@@ -90,8 +92,7 @@ proc doStatus*(dotDir: string, homeDir: string, options: Options, dotfiles: seq[
9092
printStatus("OK", file)
9193
else:
9294
printStatus("ERR_SYM_FILE", file)
93-
# Possibly fixable, see reasoning in runSymlinkDir()
94-
printHint("(possibly fixable)")
95+
printHint("(fixable)")
9596

9697
proc runSymlinkDir(file: string, srcFile: string, options: Options): void =
9798
if symlinkResolvedProperly(file, srcFile):
@@ -103,6 +104,7 @@ proc doStatus*(dotDir: string, homeDir: string, options: Options, dotfiles: seq[
103104
printStatus("OK", file)
104105
else:
105106
printStatus("ERR_SYM_DIR", file)
107+
printHint("(fixable)")
106108

107109
proc runSymlinkNull(file: string, srcFile: string): void =
108110
printStatus("ERR_SYM_NULL", file)
@@ -177,7 +179,7 @@ proc doStatus*(dotDir: string, homeDir: string, options: Options, dotfiles: seq[
177179
runNullNull
178180
)
179181

180-
proc doReconcile*(dotDir: string, homeDir: string, options: Options,
182+
proc doDeploy*(dotDir: string, homeDir: string, options: Options,
181183
dotfiles: seq[array[2, string]]) =
182184
proc runSymlinkSymlink(file: string, srcFile: string, options: Options): void =
183185
discard # not fixable
@@ -190,6 +192,9 @@ proc doReconcile*(dotDir: string, homeDir: string, options: Options,
190192
let temp = expandSymlink(file)
191193
removeFile(file)
192194
createSymlink(rts(temp), file)
195+
else:
196+
removeFile(file)
197+
createSymlink(srcFile, file)
193198

194199
proc runSymlinkDir(file: string, srcFile: string, options: Options) =
195200
if symlinkResolvedProperly(file, srcFile):
@@ -198,6 +203,9 @@ proc doReconcile*(dotDir: string, homeDir: string, options: Options,
198203
let temp = expandSymlink(file)
199204
removeFile(file)
200205
createSymlink(rts(temp), file)
206+
else:
207+
removeFile(file)
208+
createSymlink(srcFile, file)
201209

202210
proc runSymlinkNull(file: string, srcFile: string) =
203211
discard # not fixable

src/dotty.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ for kind, key, val in p.getopt():
3636

3737

3838
if options.configDir == "":
39-
options.configDir = joinPath(getConfigDir(), "dotty")
39+
options.configDir = joinPath(getConfigDir(), "dotfox")
4040

4141
if not isAbsolute(options.configDir):
4242
die fmt"Directory '{options.configDir}' is not an absolute path"
@@ -66,8 +66,8 @@ if options.action == "":
6666
case options.action:
6767
of "status":
6868
doStatus(dotDir, homeDir, options, getDotfileList(options))
69-
of "reconcile":
70-
doReconcile(dotDir, homeDir, options, getDotfileList(options))
69+
of "deploy":
70+
doDeploy(dotDir, homeDir, options, getDotfileList(options))
7171
of "debug":
7272
doDebug(dotDir, homeDir, options, getDotfileList(options))
7373
else:

0 commit comments

Comments
 (0)