Skip to content

Commit

Permalink
feat!: rename hooks to pre_bump_hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
tranzystorekk authored and oknozor committed Oct 11, 2020
1 parent a56b1e2 commit 7015c51
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ You can run pre bump commands with the `%version` alias to reference the newly c

```toml
# cog.toml
hooks = [
pre_bump_hooks = [
"cargo build --release",
"cargo bump %version",
]
Expand Down
2 changes: 1 addition & 1 deletion cog.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ changelog_path = "CHANGELOG.md"
# A list of command to run before creating a version.
# All change generated by those commands will be committed with the generated version commit.
# `%version` will be interpretted as your target version
hooks = [
pre_bump_hooks = [
"cargo build --release",
"cargo bump %version",
]
Expand Down
6 changes: 3 additions & 3 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(crate) struct Settings {
pub changelog_path: Option<PathBuf>,
pub github: Option<String>,
#[serde(default)]
pub hooks: Vec<String>,
pub pre_bump_hooks: Vec<String>,
#[serde(default)]
pub post_bump_hooks: Vec<String>,
#[serde(default)]
Expand All @@ -40,7 +40,7 @@ impl Default for Settings {
Settings {
changelog_path: Some(PathBuf::from("CHANGELOG.md")),
commit_types: Default::default(),
hooks: vec![],
pre_bump_hooks: vec![],
post_bump_hooks: vec![],
authors: vec![],
github: None,
Expand Down Expand Up @@ -139,7 +139,7 @@ impl Settings {

pub fn get_hooks(&self, hook_type: HookType) -> &Vec<String> {
match hook_type {
HookType::PreBump => &self.hooks,
HookType::PreBump => &self.pre_bump_hooks,
HookType::PostBump => &self.post_bump_hooks,
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/cog_bump_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fn bump_with_hook() -> Result<()> {
let temp_dir = TempDir::default();
std::env::set_current_dir(&temp_dir)?;

std::fs::write("cog.toml", r#"hooks = ["touch %version"]"#)?;
std::fs::write("cog.toml", r#"pre_bump_hooks = ["touch %version"]"#)?;

helper::git_init(".")?;
helper::git_commit("chore: init")?;
Expand Down

0 comments on commit 7015c51

Please sign in to comment.