Skip to content

Commit

Permalink
Bump patch version and fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperCuber committed Aug 23, 2021
1 parent af54169 commit 04a2e17
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dotter"
version = "0.12.5"
version = "0.12.6"
authors = ["SuperCuber <amit.gold01@gmail.com>"]
description = "A dotfile manager and templater written in rust"
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ All the files will be deployed to their target locations.
Check out `dotter -h` for the command-line flags that Dotter supports:

```
Dotter 0.12.5
Dotter 0.12.6
A small dotfile manager
USAGE:
Expand Down
48 changes: 24 additions & 24 deletions src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,14 @@ pub fn create_symlink(
SymlinkComparison::OnlySourceExists => {
debug!("Performing creation");
fs.create_dir_all(
&target
target
.target
.parent()
.context("get parent of target file")?,
&target.owner,
)
.context("create parent for target file")?;
fs.make_symlink(&target.target, &source, &target.owner)
fs.make_symlink(&target.target, source, &target.owner)
.context("create target symlink")?;
Ok(true)
}
Expand All @@ -285,7 +285,7 @@ pub fn create_symlink(
);
fs.remove_file(&target.target)
.context("remove symlink target while forcing")?;
fs.make_symlink(&target.target, &source, &target.owner)
fs.make_symlink(&target.target, source, &target.owner)
.context("create target symlink")?;
Ok(true)
}
Expand Down Expand Up @@ -317,22 +317,22 @@ pub fn create_template(
);

let comparison = fs
.compare_template(&target.target, &cache)
.compare_template(&target.target, cache)
.context("detect templated file's current state")?;
debug!("Current state: {}", comparison);

match comparison {
TemplateComparison::BothMissing => {
debug!("Performing creation");
fs.create_dir_all(
&target
target
.target
.parent()
.context("get parent of target file")?,
&target.owner,
)
.context("create parent for target file")?;
perform_template_deploy(source, &cache, target, fs, handlebars, variables)
perform_template_deploy(source, cache, target, fs, handlebars, variables)
.context("perform template cache")?;
Ok(true)
}
Expand All @@ -342,14 +342,14 @@ pub fn create_template(
source, target.target
);
fs.create_dir_all(
&target
target
.target
.parent()
.context("get parent of target file")?,
&target.owner,
)
.context("create parent for target file")?;
perform_template_deploy(source, &cache, target, fs, handlebars, variables)
perform_template_deploy(source, cache, target, fs, handlebars, variables)
.context("perform template cache")?;
Ok(true)
}
Expand All @@ -365,14 +365,14 @@ pub fn create_template(
fs.remove_file(&target.target)
.context("remove existing file while forcing")?;
fs.create_dir_all(
&target
target
.target
.parent()
.context("get parent of target file")?,
&target.owner,
)
.context("create parent for target file")?;
perform_template_deploy(source, &cache, target, fs, handlebars, variables)
perform_template_deploy(source, cache, target, fs, handlebars, variables)
.context("perform template cache")?;
Ok(true)
}
Expand Down Expand Up @@ -400,7 +400,7 @@ pub fn update_symlink(
debug!("Updating symlink {:?} -> {:?}...", source, target.target);

let comparison = fs
.compare_symlink(&source, &target.target)
.compare_symlink(source, &target.target)
.context("detect symlink's current state")?;
debug!("Current state: {}", comparison);

Expand All @@ -425,7 +425,7 @@ pub fn update_symlink(
);
fs.remove_file(&target.target)
.context("remove symlink target while forcing")?;
fs.make_symlink(&target.target, &source, &target.owner)
fs.make_symlink(&target.target, source, &target.owner)
.context("create target symlink")?;
Ok(true)
}
Expand All @@ -442,14 +442,14 @@ pub fn update_symlink(
source, target.target, comparison
);
fs.create_dir_all(
&target
target
.target
.parent()
.context("get parent of target file")?,
&target.owner,
)
.context("create parent for target file")?;
fs.make_symlink(&target.target, &source, &target.owner)
fs.make_symlink(&target.target, source, &target.owner)
.context("create target symlink")?;
Ok(true)
}
Expand All @@ -470,7 +470,7 @@ pub fn update_template(
) -> Result<bool> {
debug!("Updating template {:?} -> {:?}...", source, target.target);
let comparison = fs
.compare_template(&target.target, &cache)
.compare_template(&target.target, cache)
.context("detect templated file's current state")?;
debug!("Current state: {}", comparison);

Expand All @@ -486,7 +486,7 @@ pub fn update_template(
);
fs.set_owner(&target.target, &target.owner)
.context("set target file owner")?;
perform_template_deploy(source, &cache, target, fs, handlebars, variables)
perform_template_deploy(source, cache, target, fs, handlebars, variables)
.context("perform template cache")?;
Ok(true)
}
Expand All @@ -496,14 +496,14 @@ pub fn update_template(
source, target.target
);
fs.create_dir_all(
&target
target
.target
.parent()
.context("get parent of target file")?,
&target.owner,
)
.context("create parent for target file")?;
perform_template_deploy(source, &cache, target, fs, handlebars, variables)
perform_template_deploy(source, cache, target, fs, handlebars, variables)
.context("perform template cache")?;
Ok(true)
}
Expand All @@ -529,7 +529,7 @@ pub fn update_template(
);
fs.remove_file(&target.target)
.context("remove target while forcing")?;
perform_template_deploy(source, &cache, target, fs, handlebars, variables)
perform_template_deploy(source, cache, target, fs, handlebars, variables)
.context("perform template cache")?;
Ok(true)
}
Expand All @@ -552,23 +552,23 @@ pub(crate) fn perform_template_deploy(
variables: &Variables,
) -> Result<()> {
let file_contents = fs
.read_to_string(&source)
.read_to_string(source)
.context("read template source file")?;
let file_contents = target.apply_actions(file_contents);
let rendered = handlebars
.render_template(&file_contents, variables)
.context("render template")?;

// Cache
fs.create_dir_all(&cache.parent().context("get parent of cache file")?, &None)
fs.create_dir_all(cache.parent().context("get parent of cache file")?, &None)
.context("create parent for cache file")?;
fs.write(&cache, rendered)
fs.write(cache, rendered)
.context("write rendered template to cache")?;

// Target
fs.copy_file(&cache, &target.target, &target.owner)
fs.copy_file(cache, &target.target, &target.owner)
.context("copy template from cache to target")?;
fs.copy_permissions(&source, &target.target, &target.owner)
fs.copy_permissions(source, &target.target, &target.owner)
.context("copy permissions from source to target")?;

Ok(())
Expand Down
6 changes: 3 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ fn merge_configuration_files(
// Patch each package with included.toml's
for included_path in &local.includes {
|| -> Result<()> {
let mut included: IncludedConfig = filesystem::load_file(&included_path)
let mut included: IncludedConfig = filesystem::load_file(included_path)
.and_then(|c| c.ok_or_else(|| anyhow::anyhow!("file not found")))
.context("load file")?;

Expand Down Expand Up @@ -361,9 +361,9 @@ fn merge_configuration_files(
impl FileTarget {
pub fn path(&self) -> &Path {
match self {
FileTarget::Automatic(path) => &path,
FileTarget::Automatic(path) => path,
FileTarget::Symbolic(SymbolicTarget { target, .. })
| FileTarget::ComplexTemplate(TemplateTarget { target, .. }) => &target,
| FileTarget::ComplexTemplate(TemplateTarget { target, .. }) => target,
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Proceeding by copying instead of symlinking."
&desired_symlinks,
&desired_templates,
&mut cache,
&opt,
opt,
);

// === Post-deploy ===
Expand Down Expand Up @@ -286,7 +286,7 @@ fn run_deploy<A: ActionRunner>(
existing_symlinks.difference(&desired_symlinks.keys().cloned().collect())
{
execute_action(
runner.delete_symlink(&source, &target),
runner.delete_symlink(source, target),
|| resulting_cache.symlinks.remove(source),
|| format!("delete symlink {:?} -> {:?}", source, target),
&mut suggest_force,
Expand All @@ -298,7 +298,7 @@ fn run_deploy<A: ActionRunner>(
existing_templates.difference(&desired_templates.keys().cloned().collect())
{
execute_action(
runner.delete_template(&source, &opt.cache_directory.join(&source), &target),
runner.delete_template(source, &opt.cache_directory.join(&source), target),
|| resulting_cache.templates.remove(source),
|| format!("delete template {:?} -> {:?}", source, target),
&mut suggest_force,
Expand All @@ -316,7 +316,7 @@ fn run_deploy<A: ActionRunner>(
.get(&(source.into(), target_path.into()))
.unwrap();
execute_action(
runner.create_symlink(&source, &target),
runner.create_symlink(source, target),
|| {
resulting_cache
.symlinks
Expand All @@ -338,7 +338,7 @@ fn run_deploy<A: ActionRunner>(
.get(&(source.into(), target_path.into()))
.unwrap();
execute_action(
runner.create_template(&source, &opt.cache_directory.join(&source), &target),
runner.create_template(source, &opt.cache_directory.join(&source), target),
|| {
resulting_cache
.templates
Expand All @@ -357,7 +357,7 @@ fn run_deploy<A: ActionRunner>(
.get(&(source.into(), target_path.into()))
.unwrap();
execute_action(
runner.update_symlink(&source, &target),
runner.update_symlink(source, target),
|| (),
|| format!("update symlink {:?} -> {:?}", source, target_path),
&mut suggest_force,
Expand All @@ -372,7 +372,7 @@ fn run_deploy<A: ActionRunner>(
.get(&(source.into(), target_path.into()))
.unwrap();
execute_action(
runner.update_template(&source, &opt.cache_directory.join(&source), &target),
runner.update_template(source, &opt.cache_directory.join(&source), target),
|| (),
|| format!("update template {:?} -> {:?}", source, target_path),
&mut suggest_force,
Expand Down
2 changes: 1 addition & 1 deletion src/difference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn print_template_diff(
diff_context_lines: usize,
) {
if log_enabled!(log::Level::Info) {
match generate_diff(source, target, handlebars, &variables) {
match generate_diff(source, target, handlebars, variables) {
Ok(diff) => {
if diff_nonempty(&diff) {
info!(
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ pub fn symlinks_enabled(_test_file_path: &Path) -> Result<bool> {

#[cfg(windows)]
pub fn platform_dunce(path: &Path) -> PathBuf {
dunce::simplified(&path).into()
dunce::simplified(path).into()
}

#[cfg(unix)]
Expand Down
2 changes: 1 addition & 1 deletion src/handlebars_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ fn register_rust_helpers(handlebars: &mut Handlebars<'_>) {
fn register_script_helpers(handlebars: &mut Handlebars<'_>, helpers: &Helpers) {
debug!("Registering script helpers...");
for (helper_name, helper_path) in helpers {
if let Err(e) = handlebars.register_script_helper_file(&helper_name, &helper_path) {
if let Err(e) = handlebars.register_script_helper_file(helper_name, &helper_path) {
warn!(
"Coudln't register helper script {} at path {:?} because {}",
helper_name, helper_path, e
Expand Down

0 comments on commit 04a2e17

Please sign in to comment.