Skip to content

Commit

Permalink
chore: upgrade all dependencies (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Dec 19, 2021
1 parent 52d4fe5 commit a3caf39
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 72 deletions.
76 changes: 23 additions & 53 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions cargo-smart-release/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ clap = { version = "=3.0.0-rc.7", features = ["derive", "cargo"] }
env_logger = { version = "0.9.0", default-features = false, features = ["humantime", "termcolor", "atty"] }
cargo_metadata = "0.14.0"
log = "0.4.14"
toml_edit = "0.2.1"
toml_edit = "0.12.0"
semver = "1.0.4"
crates-index = "0.17.0"
cargo_toml = "0.9.2"
crates-index = "0.18.1"
cargo_toml = "0.10.2"
nom = { version = "7", default-features = false, features = ["std"]}
git-conventional = "0.10.3"
git-conventional = "0.11.1"
time = "0.3.2"
pulldown-cmark = "0.8.0"
bitflags = "1.3.2"
Expand Down
2 changes: 1 addition & 1 deletion cargo-smart-release/src/command/release/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ fn set_version_and_update_package_dependency(
}
}
}
let new_manifest = doc.to_string_in_original_order();
let new_manifest = doc.to_string();
out.write_all(new_manifest.as_bytes())?;

Ok(manifest != new_manifest)
Expand Down
17 changes: 6 additions & 11 deletions cargo-smart-release/src/command/release/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,14 @@ pub fn release(opts: Options, crates: Vec<String>, bump: BumpSpec, bump_dependen
if opts.update_crates_index {
log::info!(
"Updating crates-io index at '{}'",
ctx.base.crates_index.path().display()
ctx.base.crates_index.borrow().path().display()
);
ctx.base.crates_index.update()?;
ctx.base.crates_index.borrow_mut().update()?;
} else if opts.bump_when_needed {
log::warn!(
"Consider running with --update-crates-index to assure bumping on demand uses the latest information"
);
}
if !ctx.base.crates_index.exists() {
log::warn!("Crates.io index doesn't exist. Consider using --update-crates-index to help determining if release versions are published already");
}

release_depth_first(ctx, opts)?;
Ok(())
Expand Down Expand Up @@ -122,12 +119,10 @@ fn assure_crates_index_is_uptodate<'meta>(
.and_then(|lr| (lr >= &b.desired_release).then(|| d))
})
{
let index = crates_index::Index::new_cargo_default();
if index.exists() {
log::warn!("Crate '{}' computed version not greater than the current package version. Updating crates index to assure correct results.", dep.package.name);
index.update()?;
return crate::traverse::dependencies(ctx, opts);
}
let mut index = crates_index::Index::new_cargo_default()?;
log::warn!("Crate '{}' computed version not greater than the current package version. Updating crates index to assure correct results.", dep.package.name);
index.update()?;
return crate::traverse::dependencies(ctx, opts);
}
Ok(crates)
}
Expand Down
5 changes: 3 additions & 2 deletions cargo-smart-release/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use cargo_metadata::{
};
use crates_index::Index;
use git_repository as git;
use std::cell::RefCell;

use crate::version::BumpSpec;

Expand All @@ -12,7 +13,7 @@ pub struct Context {
pub meta: Metadata,
pub repo: git::easy::Handle,
pub crate_names: Vec<String>,
pub crates_index: Index,
pub crates_index: RefCell<Index>,
pub history: Option<crate::commit::History>,
pub bump: BumpSpec,
pub bump_dependencies: BumpSpec,
Expand All @@ -28,7 +29,7 @@ impl Context {
let meta = cargo_metadata::MetadataCommand::new().exec()?;
let root = meta.workspace_root.clone();
let repo = git::discover(&root)?.to_easy().apply_environment();
let crates_index = Index::new_cargo_default();
let crates_index = RefCell::new(Index::new_cargo_default()?);
let history = (force_history_segmentation
|| matches!(bump, BumpSpec::Auto)
|| matches!(bump_dependencies, BumpSpec::Auto))
Expand Down
2 changes: 1 addition & 1 deletion cargo-smart-release/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub(crate) fn bump_package_with_spec(
}
};
let desired_release = v;
let (latest_release, next_release) = match ctx.crates_index.crate_(&package.name) {
let (latest_release, next_release) = match ctx.crates_index.borrow().crate_(&package.name) {
Some(published_crate) => {
let latest_release = semver::Version::parse(published_crate.latest_version().version())
.expect("valid version in crate index");
Expand Down

0 comments on commit a3caf39

Please sign in to comment.