diff --git a/src/config.rs b/src/config.rs index 52bdf66..ab40b71 100644 --- a/src/config.rs +++ b/src/config.rs @@ -66,12 +66,18 @@ fn build_cli_parser<'a, 'b>() -> App<'a, 'b> { .long("git-tag") .help("Optional commit the updated version and create a git tag."), ) + .arg( + Arg::with_name("ignore-lockfile") + .long("ignore-lockfile") + .help("Don't update the lockfile") + ) } pub struct Config { pub version_modifier: VersionModifier, pub manifest: PathBuf, pub git_tag: bool, + pub ignore_lockfile: bool, } impl Config { @@ -81,6 +87,7 @@ impl Config { let build_metadata = matches.value_of("build-metadata").map(parse_identifiers); let pre_release = matches.value_of("pre-release").map(parse_identifiers); let git_tag = matches.is_present("git-tag"); + let ignore_lockfile = matches.is_present("ignore-lockfile"); let mut metadata_cmd = MetadataCommand::new(); if let Some(path) = matches.value_of("manifest-path") { metadata_cmd.manifest_path(path); @@ -97,6 +104,7 @@ impl Config { .manifest_path .clone(), git_tag, + ignore_lockfile, } } else { panic!("Workspaces are not supported yet."); diff --git a/src/main.rs b/src/main.rs index ca57ac0..1540c77 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,6 +13,7 @@ use std::fs::{File, OpenOptions}; use std::io::{Read, Write}; use std::path::Path; use toml_edit::Document; +use std::process::Command; use semver::Version; @@ -35,6 +36,13 @@ fn main() { .unwrap(); f.write_all(output.to_string().as_bytes()).unwrap(); + if !&conf.ignore_lockfile { + Command::new("cargo") + .args(&["generate-lockfile", "--offline", "--manifest-path", &conf.manifest.to_string_lossy()]) + .status() + .expect("Failed to generate lockfile"); + } + if use_git { git::git_commit_and_tag(version); }