Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to spec 0.9 and libcnb 0.13.0 #157

Merged
merged 4 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 86 additions & 90 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions buildpacks/ruby/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ commons = { path = "../../commons" }
flate2 = "1"
fs-err = "2"
indoc = "2"
libcnb = "0.11"
libcnb = "0.13"
libherokubuildpack = "0.13"
rand = "0.8"
regex = "1"
Expand All @@ -23,5 +23,5 @@ ureq = "2"
url = "2"

[dev-dependencies]
libcnb-test = "0.11"
libcnb-test = "0.13"
toml = "0.7"
2 changes: 1 addition & 1 deletion buildpacks/ruby/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.8"
api = "0.9"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this needs a CHANGELOG.md entry, since it affects the tool versions that work with the buildpack (old Pack CLI won't work with the buildpack etc)


[buildpack]
id = "heroku/ruby"
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/layers/bundle_download_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl Layer for BundleDownloadLayer {

cmd.output_and_write_streams(std::io::stdout(), std::io::stderr())
.map_err(|error| {
fun_run::annotate_which_problem(error, cmd, self.env.get("PATH"))
fun_run::annotate_which_problem(error, cmd, self.env.get("PATH").cloned())
})
.map_err(|error| fun_run::on_system_error(name.clone(), error))
.and_then(|output| fun_run::nonzero_streamed(name.clone(), output))
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/layers/bundle_install_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ fn bundle_install(env: &Env) -> Result<(), CmdError> {
user::log_info(format!("Running $ {name}"));

cmd.output_and_write_streams(std::io::stdout(), std::io::stderr())
.map_err(|error| fun_run::annotate_which_problem(error, cmd, path_env))
.map_err(|error| fun_run::annotate_which_problem(error, cmd, path_env.cloned()))
.map_err(|error| fun_run::on_system_error(name.clone(), error))
.and_then(|output| fun_run::nonzero_streamed(name.clone(), output))
})?;
Expand Down
27 changes: 21 additions & 6 deletions buildpacks/ruby/src/steps/get_default_process.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use std::path::Path;

use commons::gem_list::GemList;
use libcnb::build::BuildContext;
use libcnb::data::launch::Process;
use libcnb::data::launch::ProcessBuilder;
use libcnb::data::process_type;
use libherokubuildpack::log as user;
use std::path::Path;

use crate::RubyBuildpack;

Expand Down Expand Up @@ -65,15 +64,31 @@ fn detect_web(gem_list: &GemList, app_path: &Path) -> WebProcess {
}

fn default_rack() -> Process {
ProcessBuilder::new(process_type!("web"), "bundle")
.args(["exec", "rackup", "--port", "$PORT", "--host", "0.0.0.0"])
ProcessBuilder::new(process_type!("web"), ["bash"])
.args([
"-c",
&[
"bundle exec rackup",
"--port \"$PORT\"",
"--host \"0.0.0.0\"",
]
.join(" "),
])
.default(true)
.build()
}

fn default_rails() -> Process {
ProcessBuilder::new(process_type!("web"), "bin/rails")
.args(["server", "--port", "$PORT", "--environment", "$RAILS_ENV"])
ProcessBuilder::new(process_type!("web"), ["bash"])
.args([
"-c",
&[
"bin/rails server",
"--port \"$PORT\"",
"--environment \"$RAILS_ENV\"",
]
.join(" "),
])
.default(true)
.build()
}
8 changes: 6 additions & 2 deletions buildpacks/ruby/src/steps/rake_assets_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ fn run_rake_assets_precompile(env: &Env) -> Result<(), CmdError> {
user::log_info(format!("Running $ {name}"));

cmd.output_and_write_streams(std::io::stdout(), std::io::stderr())
.map_err(|error| fun_run::annotate_which_problem(error, cmd, env.get("PATH")))
.map_err(|error| {
fun_run::annotate_which_problem(error, cmd, env.get("PATH").cloned())
})
.map_err(|error| fun_run::on_system_error(name.clone(), error))
.and_then(|output| fun_run::nonzero_streamed(name.clone(), output))
})?;
Expand All @@ -95,7 +97,9 @@ fn run_rake_assets_precompile_with_clean(env: &Env) -> Result<(), CmdError> {
user::log_info(format!("Running $ {name}"));

cmd.output_and_write_streams(std::io::stdout(), std::io::stderr())
.map_err(|error| fun_run::annotate_which_problem(error, cmd, env.get("PATH")))
.map_err(|error| {
fun_run::annotate_which_problem(error, cmd, env.get("PATH").cloned())
})
.map_err(|error| fun_run::on_system_error(name.clone(), error))
.and_then(|output| fun_run::nonzero_streamed(name.clone(), output))
})?;
Expand Down
2 changes: 1 addition & 1 deletion commons/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fs_extra = "1"
fs-err = "2"
glob = "0.3"
lazy_static = "1"
libcnb = "0.11"
libcnb = "0.13"
regex = "1"
serde = "1"
sha2 = "0.10"
Expand Down