Skip to content

Commit

Permalink
Slight change to the default lock file location
Browse files Browse the repository at this point in the history
Previously the lock file path defaulted to the config file location but
with a `.lock` extension. It now defaults to `<root>/plugins.lock`
regardless of the config file location.
  • Loading branch information
rossmacarthur committed Sep 9, 2020
1 parent ae447a3 commit 10c64a3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Sheldon accepts the following global command line options.
|`--home <path>`|`HOME`|Set the home directory. (*default:* auto)|
|`--root <path>`|`SHELDON_ROOT`|Set the root directory. (*default:* `<home>/.sheldon`)|
|`--config-file <path>`|`SHELDON_CONFIG_FILE`|Set the config file. (*default:* `<root>/plugins.toml`)|
|`--lock-file <path>`|`SHELDON_LOCK_FILE`|Set the lock file. (*default:* `<config-file>.lock`)|
|`--lock-file <path>`|`SHELDON_LOCK_FILE`|Set the lock file. (*default:* `<root>/plugins.lock`)|
|`--clone-dir <path>`|`SHELDON_CLONE_DIR`|Set the clone directory. (*default:* `<root>/repos`)|
|`--download-dir <path>`|`SHELDON_DOWNLOAD_DIR`|Set the download directory. (*default:* `<root>/downloads`)|

Expand Down
2 changes: 1 addition & 1 deletion docs/src/Command-line-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Sheldon accepts the following global command line options.
| `--home <path>` | `HOME` | Set the home directory. (*default:* auto) |
| `--root <path>` | `SHELDON_ROOT` | Set the root directory. (*default:* `<home>/.sheldon`) |
| `--config-file <path>` | `SHELDON_CONFIG_FILE` | Set the config file. (*default:* `<root>/plugins.toml`) |
| `--lock-file <path>` | `SHELDON_LOCK_FILE` | Set the lock file. (*default:* `<config-file>.lock`) |
| `--lock-file <path>` | `SHELDON_LOCK_FILE` | Set the lock file. (*default:* `<root>/plugins.lock`) |
| `--clone-dir <path>` | `SHELDON_CLONE_DIR` | Set the clone directory. (*default:* `<root>/repos`) |
| `--download-dir <path>` | `SHELDON_DOWNLOAD_DIR` | Set the download directory. (*default:* `<root>/downloads`) |

Expand Down
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl Opt {
};
let root = root.unwrap_or_else(|| home.join(".sheldon"));
let config_file = config_file.unwrap_or_else(|| root.join("plugins.toml"));
let lock_file = lock_file.unwrap_or_else(|| config_file.with_extension("lock"));
let lock_file = lock_file.unwrap_or_else(|| root.join("plugins.lock"));
let clone_dir = clone_dir.unwrap_or_else(|| root.join("repos"));
let download_dir = download_dir.unwrap_or_else(|| root.join("downloads"));

Expand Down
8 changes: 4 additions & 4 deletions tests/cases/override_config_file
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# test.toml

# test.lock
# plugins.lock
version = "<version>"
home = "<root>"
root = "<root>"
config_file = "<root>/test.toml"
lock_file = "<root>/test.lock"
lock_file = "<root>/plugins.lock"
clone_dir = "<root>/repos"
download_dir = "<root>/downloads"
plugins = []
Expand All @@ -29,11 +29,11 @@ each = true

# lock.stderr
[LOADED] ~/test.toml
[LOCKED] ~/test.lock
[LOCKED] ~/plugins.lock

# source.stdout

# source.stderr
[UNLOCKED] ~/test.lock
[UNLOCKED] ~/plugins.lock

# end
2 changes: 1 addition & 1 deletion tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ fn lock_and_source_override_config_file() -> io::Result<()> {
.arg("source")
.run()?;

case.assert_contents("test.lock")
case.assert_contents("plugins.lock")
}

#[test]
Expand Down

0 comments on commit 10c64a3

Please sign in to comment.