Skip to content

Commit

Permalink
Update libcnb to 0.10.0 (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
Malax authored Aug 31, 2022
1 parent afb8163 commit f8211c7
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 29 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Unreleased

- Upgrade `libcnb` and `libherokubuildpack` to `0.10.0`. ([#98](https://github.com/heroku/procfile-cnb/pull/98))
- Buildpack now implements buildpack API version `0.8` and so requires lifecycle version `0.14.x` or newer. ([#98](https://github.com/heroku/procfile-cnb/pull/98))

## 1.0.2

- Strip buildpack binary for reduced builder image size (thanks to [`libcnb-cargo` v0.5.0](https://github.com/heroku/libcnb.rs/releases/tag/libcnb-cargo%2Fv0.5.0)).
Expand Down
48 changes: 36 additions & 12 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ rust-version = "1.61"

[dependencies]
indoc = "1.0.7"
libcnb = "0.9.0"
libherokubuildpack = "0.9.0"
libcnb = "0.10.0"
libherokubuildpack = "0.10.0"
linked-hash-map = "0.5.6"
regex = "1.6.0"

[dev-dependencies]
libcnb-test = "0.6.0"
libcnb-test = "0.10.0"
4 changes: 2 additions & 2 deletions buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.6"
api = "0.8"

[buildpack]
id = "heroku/procfile"
Expand All @@ -12,7 +12,7 @@ keywords = ["procfile", "processes"]
id = "*"

# Explicit stack identifiers are required for `pack` versions `0.24.0`
# and older. `heroku-*` stack identifiers may be removed once the buildpack
# and older. `heroku-*` stack identifiers may be removed once the buildpack
# api is upgraded to something greater than "0.6".
[[stacks]]
id = "heroku-18"
Expand Down
38 changes: 26 additions & 12 deletions src/launch.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
use crate::Procfile;
use libcnb::data::launch::{Launch, Process, ProcessType};
use libcnb::data::launch::{Launch, Process, ProcessType, WorkingDirectory};
use std::str::FromStr;

impl TryFrom<Procfile> for Launch {
type Error = ProcfileConversionError;

fn try_from(value: Procfile) -> Result<Self, Self::Error> {
let mut launch = Launch::new();
let mut launch = Launch {
labels: vec![],
processes: vec![],
slices: vec![],
};

for (key, value) in value.processes {
launch.processes.push(Process {
Expand All @@ -16,6 +20,7 @@ impl TryFrom<Procfile> for Launch {
args: Vec::<String>::new(),
direct: false,
default: key == "web",
working_directory: WorkingDirectory::App,
});
}

Expand All @@ -37,7 +42,7 @@ pub enum ProcfileConversionError {
#[cfg(test)]
mod test {
use crate::Procfile;
use libcnb::data::launch::{Launch, Process};
use libcnb::data::launch::{Launch, Process, WorkingDirectory};
use libcnb::data::process_type;

#[test]
Expand All @@ -54,7 +59,8 @@ mod test {
command: String::from("web_command"),
args: vec![],
direct: false,
default: true
default: true,
working_directory: WorkingDirectory::App,
}]
);
}
Expand All @@ -73,7 +79,8 @@ mod test {
command: String::from("xxx_command"),
args: vec![],
direct: false,
default: true
default: true,
working_directory: WorkingDirectory::App,
}]
);
}
Expand All @@ -94,14 +101,16 @@ mod test {
command: String::from("web_command"),
args: vec![],
direct: false,
default: true
default: true,
working_directory: WorkingDirectory::App,
},
Process {
r#type: process_type!("foo"),
command: String::from("foo_command"),
args: vec![],
direct: false,
default: false
default: false,
working_directory: WorkingDirectory::App,
}
]
);
Expand All @@ -123,14 +132,16 @@ mod test {
command: String::from("foo_command"),
args: vec![],
direct: false,
default: false
default: false,
working_directory: WorkingDirectory::App,
},
Process {
r#type: process_type!("bar"),
command: String::from("bar_command"),
args: vec![],
direct: false,
default: false
default: false,
working_directory: WorkingDirectory::App,
}
]
);
Expand Down Expand Up @@ -161,21 +172,24 @@ mod test {
command: String::from("aaa_command"),
args: vec![],
direct: false,
default: false
default: false,
working_directory: WorkingDirectory::App,
},
Process {
r#type: process_type!("ccc"),
command: String::from("ccc_command"),
args: vec![],
direct: false,
default: false
default: false,
working_directory: WorkingDirectory::App,
},
Process {
r#type: process_type!("bbb"),
command: String::from("bbb_command"),
args: vec![],
direct: false,
default: false
default: false,
working_directory: WorkingDirectory::App,
},
]
);
Expand Down

0 comments on commit f8211c7

Please sign in to comment.