diff --git a/Cargo.lock b/Cargo.lock index 353c198..16fb94a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1109,7 +1109,7 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "oseda-cli" -version = "3.2.2" +version = "3.2.3" dependencies = [ "chrono", "clap", diff --git a/Cargo.toml b/Cargo.toml index 94e2cf0..c14bf7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ homepage = "https://oseda.net" repository = "https://github.com/oseda-dev/oseda-cli" readme = "README.md" name = "oseda-cli" -version = "3.2.2" +version = "3.2.3" edition = "2021" [[bin]] diff --git a/src/cmd/deploy.rs b/src/cmd/deploy.rs index 9c2f351..5c62c41 100644 --- a/src/cmd/deploy.rs +++ b/src/cmd/deploy.rs @@ -87,12 +87,14 @@ pub fn deploy(opts: DeployOptions) -> Result<(), Box> { let course_name = get_current_dir_name()?; let new_course_dir = repo_path.join("courses").join(&course_name); - copy_dir_all(env::current_dir()?, &new_course_dir)?; - // bails if config is bad // // force a no-skip-git - let conf = config::read_and_validate_config()?; + let mut conf = config::read_and_validate_config()?; + + config::update_time(&mut conf)?; + + copy_dir_all(env::current_dir()?, &new_course_dir)?; println!("Committing files to remote..."); git(repo_path, &["add", "."])?; @@ -102,8 +104,6 @@ pub fn deploy(opts: DeployOptions) -> Result<(), Box> { )?; git(repo_path, &["push"])?; - config::update_time(conf)?; - println!("Project successfully pushed to remote."); // https://github.com/oseda-dev/oseda-lib/compare/main...ReeseHatfield:oseda-lib:main?expand=1 diff --git a/src/config.rs b/src/config.rs index 999e45d..672cfb3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -261,10 +261,10 @@ fn prompt_for_color() -> Result> { /// # Returns /// * `Ok(())` if the file is successfully updated /// * `Err` if file writing fails -pub fn update_time(mut conf: OsedaConfig) -> Result<(), Box> { +pub fn update_time(conf: &mut OsedaConfig) -> Result<(), Box> { conf.last_updated = get_time(); - write_config(".", &conf)?; + write_config(".", conf)?; Ok(()) }