Skip to content

Commit 1845483

Browse files
committed
Update default root directory and clone directory
- The root directory now defaults to `{home}/.sheldon`. - The clone directory now defaults to `{root}/repos`.
1 parent 75a39b3 commit 1845483

16 files changed

Lines changed: 68 additions & 68 deletions

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ cargo install sheldon --force
106106
## Getting started
107107

108108
The config file uses the [TOML] file format. Create a configuration file at
109-
`~/.zsh/plugins.toml` and add details for your first plugin by adding a unique
110-
key to the `plugins` table. In the example configuration file below we add a new
111-
Github type plugin with a unique name `oh-my-zsh`.
109+
`~/.sheldon/plugins.toml` and add details for your first plugin by adding a
110+
unique key to the `plugins` table. In the example configuration file below we
111+
add a new Github type plugin with a unique name `oh-my-zsh`.
112112

113113
```toml
114-
# ~/.zsh/plugins.toml
114+
# ~/.sheldon/plugins.toml
115115

116116
# ┌─ Unique name for the plugin
117117
# ┌───┴───┐
@@ -188,10 +188,10 @@ The output of this command is highly configurable. You can define your own
188188
| Option | Environment variable | Description |
189189
| ----------------------- | ---------------------- | ----------------------------------------------------------- |
190190
| `--home <path>` | `HOME` | Set the home directory. |
191-
| `--root <path>` | `SHELDON_ROOT` | Set the root directory. (*default:* `<home>/.zsh`) |
191+
| `--root <path>` | `SHELDON_ROOT` | Set the root directory. (*default:* `<home>/.sheldon`) |
192192
| `--config-file <path>` | `SHELDON_CONFIG_FILE` | Set the config file. (*default:* `<root>/plugins.toml`) |
193193
| `--lock-file <path>` | `SHELDON_LOCK_FILE` | Set the lock file. (*default:* `<config-file>.lock`) |
194-
| `--clone-dir <path>` | `SHELDON_CLONE_DIR` | Set the clone directory. (*default:* `<root>/repositories`) |
194+
| `--clone-dir <path>` | `SHELDON_CLONE_DIR` | Set the clone directory. (*default:* `<root>/repos`) |
195195
| `--download-dir <path>` | `SHELDON_DOWNLOAD_DIR` | Set the download directory. (*default:* `<root>/downloads`) |
196196

197197
**Note:** in rare circumstances **sheldon** will not be able to automatically
@@ -299,7 +299,7 @@ current user's home directory.
299299

300300
```toml
301301
[plugins.pure]
302-
local = "~/Downloads/repositories/pure"
302+
local = "~/Downloads/repos/pure"
303303
```
304304

305305
## Configuration: plugin options
@@ -409,12 +409,13 @@ You can use the following global information in templates
409409

410410
### Example: symlinking files
411411

412-
Lets say we would like a template to symlink files into the `~/.zsh/functions`
413-
directory. We could create a new template with name **function**, like this
412+
Lets say we would like a template to symlink files into the
413+
`~/.sheldon/functions` directory. We could create a new template with name
414+
**function**, like this
414415

415416
```toml
416417
[templates]
417-
function = { value = 'ln -sf "{{ file }}" "~/.zsh/functions/{{ name }}"', each = true }
418+
function = { value = 'ln -sf "{{ file }}" "~/.sheldon/functions/{{ name }}"', each = true }
418419
```
419420

420421
It can then be applied to the plugin like this

src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,10 @@ impl Opt {
293293
process::exit(1);
294294
}
295295
};
296-
let root = root.unwrap_or_else(|| home.join(".zsh"));
296+
let root = root.unwrap_or_else(|| home.join(".sheldon"));
297297
let config_file = config_file.unwrap_or_else(|| root.join("plugins.toml"));
298298
let lock_file = lock_file.unwrap_or_else(|| config_file.with_extension("lock"));
299-
let clone_dir = clone_dir.unwrap_or_else(|| root.join("repositories"));
299+
let clone_dir = clone_dir.unwrap_or_else(|| root.join("repos"));
300300
let download_dir = download_dir.unwrap_or_else(|| root.join("downloads"));
301301

302302
let settings = Settings {

src/lock.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ mod tests {
784784
home: "/".into(),
785785
config_file: root.join("config.toml"),
786786
lock_file: root.join("config.lock"),
787-
clone_dir: root.join("repositories"),
787+
clone_dir: root.join("repos"),
788788
download_dir: root.join("downloads"),
789789
root: root.to_path_buf(), // must come after the joins above
790790
},
@@ -1044,7 +1044,7 @@ mod tests {
10441044

10451045
assert_eq!(
10461046
locked.dir,
1047-
dir.join("repositories/github.com/rossmacarthur/sheldon-test")
1047+
dir.join("repos/github.com/rossmacarthur/sheldon-test")
10481048
);
10491049
assert_eq!(locked.file, None)
10501050
}
@@ -1087,7 +1087,7 @@ mod tests {
10871087
apply: None,
10881088
};
10891089
let locked_source = plugin.source.clone().lock(&ctx).unwrap();
1090-
let clone_dir = dir.join("repositories/github.com/rossmacarthur/sheldon-test");
1090+
let clone_dir = dir.join("repos/github.com/rossmacarthur/sheldon-test");
10911091

10921092
let locked = plugin
10931093
.lock(&ctx, locked_source, &[], &["hello".into()])
@@ -1121,7 +1121,7 @@ mod tests {
11211121
apply: None,
11221122
};
11231123
let locked_source = plugin.source.clone().lock(&ctx).unwrap();
1124-
let clone_dir = dir.join("repositories/github.com/rossmacarthur/sheldon-test");
1124+
let clone_dir = dir.join("repos/github.com/rossmacarthur/sheldon-test");
11251125

11261126
let locked = plugin
11271127
.lock(
@@ -1200,7 +1200,7 @@ mod tests {
12001200
let root = temp1.path();
12011201
let config_file = manifest_dir.join("docs/plugins.example.toml");
12021202
let lock_file = root.join("plugins.lock");
1203-
let clone_dir = root.join("repositories");
1203+
let clone_dir = root.join("repos");
12041204
let download_dir = root.join("downloads");
12051205
let ctx = Context {
12061206
settings: Settings {
@@ -1240,16 +1240,16 @@ mod tests {
12401240
vec![
12411241
LockedPlugin::External(LockedExternalPlugin {
12421242
name: "async".to_string(),
1243-
source_dir: root.join("repositories/github.com/mafredri/zsh-async"),
1243+
source_dir: root.join("repos/github.com/mafredri/zsh-async"),
12441244
plugin_dir: None,
1245-
files: vec![root.join("repositories/github.com/mafredri/zsh-async/async.zsh")],
1245+
files: vec![root.join("repos/github.com/mafredri/zsh-async/async.zsh")],
12461246
apply: vec_into!["function"]
12471247
}),
12481248
LockedPlugin::External(LockedExternalPlugin {
12491249
name: "pure".to_string(),
1250-
source_dir: root.join("repositories/github.com/sindresorhus/pure"),
1250+
source_dir: root.join("repos/github.com/sindresorhus/pure"),
12511251
plugin_dir: None,
1252-
files: vec![root.join("repositories/github.com/sindresorhus/pure/pure.zsh")],
1252+
files: vec![root.join("repos/github.com/sindresorhus/pure/pure.zsh")],
12531253
apply: vec_into!["prompt"]
12541254
}),
12551255
LockedPlugin::External(LockedExternalPlugin {
@@ -1275,11 +1275,10 @@ ip_netns_prompt_info() {
12751275
}),
12761276
LockedPlugin::External(LockedExternalPlugin {
12771277
name: "docker-destroy-all".to_string(),
1278-
source_dir: root.join("repositories/gist.github.com/79ee61f7c140c63d2786"),
1278+
source_dir: root.join("repos/gist.github.com/79ee61f7c140c63d2786"),
12791279
plugin_dir: None,
1280-
files: vec![root.join(
1281-
"repositories/gist.github.com/79ee61f7c140c63d2786/get_last_pane_path.sh"
1282-
)],
1280+
files: vec![root
1281+
.join("repos/gist.github.com/79ee61f7c140c63d2786/get_last_pane_path.sh")],
12831282
apply: vec_into!["PATH"]
12841283
})
12851284
]
@@ -1356,7 +1355,7 @@ home = "<root>"
13561355
root = "<root>"
13571356
config_file = "<root>/plugins.toml"
13581357
lock_file = "<root>/plugins.lock"
1359-
clone_dir = "<root>/repositories"
1358+
clone_dir = "<root>/repos"
13601359
download_dir = "<root>/downloads"
13611360
plugins = []
13621361

tests/cases/clean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ home = "<root>"
66
root = "<root>"
77
config_file = "<root>/plugins.toml"
88
lock_file = "<root>/plugins.lock"
9-
clone_dir = "<root>/repositories"
9+
clone_dir = "<root>/repos"
1010
download_dir = "<root>/downloads"
1111
plugins = []
1212

@@ -16,7 +16,7 @@ plugins = []
1616

1717
# lock.stderr
1818
[LOADED] ~/plugins.toml
19-
[REMOVED] ~/repositories/test.com
19+
[REMOVED] ~/repos/test.com
2020
[LOCKED] ~/plugins.lock
2121

2222
# source.stdout

tests/cases/clean_permission_denied

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ home = "<root>"
66
root = "<root>"
77
config_file = "<root>/plugins.toml"
88
lock_file = "<root>/plugins.lock"
9-
clone_dir = "<root>/repositories"
9+
clone_dir = "<root>/repos"
1010
download_dir = "<root>/downloads"
1111
plugins = []
1212

@@ -18,7 +18,7 @@ plugins = []
1818
[LOADED] ~/plugins.toml
1919
[LOCKED] ~/plugins.lock
2020

21-
[WARNING] failed to remove directory `~/repositories/test.com`
21+
[WARNING] failed to remove directory `~/repos/test.com`
2222
due to: Permission denied (os error 13)
2323

2424
# source.stdout

tests/cases/empty

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ home = "<root>"
66
root = "<root>"
77
config_file = "<root>/plugins.toml"
88
lock_file = "<root>/plugins.lock"
9-
clone_dir = "<root>/repositories"
9+
clone_dir = "<root>/repos"
1010
download_dir = "<root>/downloads"
1111
plugins = []
1212

tests/cases/github_bad_url

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ github = "rossmacarthur/sheldon-bad-url"
1616
due to: remote authentication required but none available
1717

1818
# source.stdout
19-
source "<root>/repositories/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"
19+
source "<root>/repos/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"
2020

2121
# source.stderr
2222
[LOADED] ~/plugins.toml

tests/cases/github_branch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ home = "<root>"
99
root = "<root>"
1010
config_file = "<root>/plugins.toml"
1111
lock_file = "<root>/plugins.lock"
12-
clone_dir = "<root>/repositories"
12+
clone_dir = "<root>/repos"
1313
download_dir = "<root>/downloads"
1414

1515
[[plugins]]
1616
name = "test"
17-
source_dir = "<root>/repositories/github.com/rossmacarthur/sheldon-test"
18-
files = ["<root>/repositories/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"]
17+
source_dir = "<root>/repos/github.com/rossmacarthur/sheldon-test"
18+
files = ["<root>/repos/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"]
1919
apply = ["source"]
2020

2121
[templates]
@@ -28,7 +28,7 @@ apply = ["source"]
2828
[LOCKED] ~/plugins.lock
2929

3030
# source.stdout
31-
source "<root>/repositories/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"
31+
source "<root>/repos/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"
3232

3333
# source.stderr
3434
[UNLOCKED] ~/plugins.lock

tests/cases/github_git

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ home = "<root>"
99
root = "<root>"
1010
config_file = "<root>/plugins.toml"
1111
lock_file = "<root>/plugins.lock"
12-
clone_dir = "<root>/repositories"
12+
clone_dir = "<root>/repos"
1313
download_dir = "<root>/downloads"
1414

1515
[[plugins]]
1616
name = "test"
17-
source_dir = "<root>/repositories/github.com/rossmacarthur/sheldon-test"
18-
files = ["<root>/repositories/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"]
17+
source_dir = "<root>/repos/github.com/rossmacarthur/sheldon-test"
18+
files = ["<root>/repos/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"]
1919
apply = ["source"]
2020

2121
[templates]
@@ -28,7 +28,7 @@ apply = ["source"]
2828
[LOCKED] ~/plugins.lock
2929

3030
# source.stdout
31-
source "<root>/repositories/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"
31+
source "<root>/repos/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"
3232

3333
# source.stderr
3434
[UNLOCKED] ~/plugins.lock

tests/cases/github_https

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ home = "<root>"
88
root = "<root>"
99
config_file = "<root>/plugins.toml"
1010
lock_file = "<root>/plugins.lock"
11-
clone_dir = "<root>/repositories"
11+
clone_dir = "<root>/repos"
1212
download_dir = "<root>/downloads"
1313

1414
[[plugins]]
1515
name = "test"
16-
source_dir = "<root>/repositories/github.com/rossmacarthur/sheldon-test"
17-
files = ["<root>/repositories/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"]
16+
source_dir = "<root>/repos/github.com/rossmacarthur/sheldon-test"
17+
files = ["<root>/repos/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"]
1818
apply = ["source"]
1919

2020
[templates]
@@ -27,7 +27,7 @@ apply = ["source"]
2727
[LOCKED] ~/plugins.lock
2828

2929
# source.stdout
30-
source "<root>/repositories/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"
30+
source "<root>/repos/github.com/rossmacarthur/sheldon-test/test.plugin.zsh"
3131

3232
# source.stderr
3333
[UNLOCKED] ~/plugins.lock

0 commit comments

Comments
 (0)