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

Move fun_run to its own crate #232

Merged
merged 2 commits into from
Nov 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
16 changes: 14 additions & 2 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions buildpacks/ruby/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- The `fun_run` commons library was moved to it's own crate ([#232](https://github.com/heroku/buildpacks-ruby/pull/232))

## [2.1.2] - 2023-10-31

### Fixed
Expand Down
1 change: 1 addition & 0 deletions buildpacks/ruby/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ thiserror = "1"
ureq = "2"
url = "2"
clap = { version = "4", features = ["derive"] }
fun_run = { version = "0.1", features = ["which_problem"] }

[dev-dependencies]
libcnb-test = "=0.15.0"
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/bin/agentmon_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ where
let mut cmd = Command::new(path);
cmd.args(args);

eprintln!("Running: {}", commons::fun_run::display(&mut cmd));
eprintln!("Running: {}", fun_run::display(&mut cmd));

cmd.status()
}
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/bin/launch_daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fn main() {
command.status().unwrap_or_else(|error| {
eprintln!(
"Command failed {}. Details: {error}",
commons::fun_run::display(&mut command)
fun_run::display(&mut command)
);
exit(1)
});
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/gem_list.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use commons::fun_run::{CmdError, CommandWithName};
use commons::gem_version::GemVersion;
use commons::output::{
fmt,
section_log::{log_step_timed, SectionLogger},
};
use core::str::FromStr;
use fun_run::{CmdError, CommandWithName};
use regex::Regex;
use std::collections::HashMap;
use std::ffi::OsStr;
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 @@ -5,8 +5,8 @@ use commons::output::{

use crate::RubyBuildpack;
use crate::RubyBuildpackError;
use commons::fun_run::{self, CommandWithName};
use commons::gemfile_lock::ResolvedBundlerVersion;
use fun_run::{self, CommandWithName};
use libcnb::build::BuildContext;
use libcnb::data::layer_content_metadata::LayerTypes;
use libcnb::layer::{ExistingLayerStrategy, Layer, LayerData, LayerResult, LayerResultBuilder};
Expand Down
8 changes: 3 additions & 5 deletions buildpacks/ruby/src/layers/bundle_install_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ use commons::output::{
};

use crate::{BundleWithout, RubyBuildpack, RubyBuildpackError};
use commons::fun_run::CommandWithName;
use commons::{
display::SentenceList,
fun_run::{self, CmdError},
gemfile_lock::ResolvedRubyVersion,
metadata_digest::MetadataDigest,
display::SentenceList, gemfile_lock::ResolvedRubyVersion, metadata_digest::MetadataDigest,
};
use fun_run::CommandWithName;
use fun_run::{self, CmdError};
use libcnb::{
build::BuildContext,
data::{buildpack::StackId, layer_content_metadata::LayerTypes},
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#![warn(clippy::pedantic)]
#![allow(clippy::module_name_repetitions)]
use commons::cache::CacheError;
use commons::fun_run::CmdError;
use commons::gemfile_lock::GemfileLock;
use commons::metadata_digest::MetadataDigest;
use commons::output::warn_later::WarnGuard;
#[allow(clippy::wildcard_imports)]
use commons::output::{build_log::*, fmt};
use core::str::FromStr;
use fun_run::CmdError;
use layers::{
bundle_download_layer::{BundleDownloadLayer, BundleDownloadLayerMetadata},
bundle_install_layer::{BundleInstallLayer, BundleInstallLayerMetadata},
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/rake_task_detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use commons::output::{
section_log::{log_step_timed, SectionLogger},
};

use commons::fun_run::{CmdError, CommandWithName};
use core::str::FromStr;
use fun_run::{CmdError, CommandWithName};
use std::{ffi::OsStr, process::Command};

/// Run `rake -P` and parse output to show what rake tasks an application has
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/steps/rake_assets_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use crate::rake_task_detect::RakeDetect;
use crate::RubyBuildpack;
use crate::RubyBuildpackError;
use commons::cache::{mib, AppCacheCollection, CacheConfig, KeepPath};
use commons::fun_run::{self, CmdError, CommandWithName};
use commons::output::{
fmt::{self, HELP},
section_log::{log_step, log_step_stream, SectionLogger},
};
use fun_run::{self, CmdError, CommandWithName};
use libcnb::build::BuildContext;
use libcnb::Env;
use std::process::Command;
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/user_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use commons::output::{
};

use crate::RubyBuildpackError;
use commons::fun_run::{CmdError, CommandWithName};
use fun_run::{CmdError, CommandWithName};
use indoc::formatdoc;

pub(crate) fn on_error(err: libcnb::Error<RubyBuildpackError>) {
Expand Down
7 changes: 7 additions & 0 deletions commons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog for commons features

## 1.0.0

### Changed

- Move `fun_run` commons library to it's own crate (https://github.com/heroku/buildpacks-ruby/pull/232/files)
4 changes: 2 additions & 2 deletions commons/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "commons"
version = "0.1.0"
version = "1.0.0"
edition = "2021"
publish = false

Expand All @@ -26,9 +26,9 @@ sha2 = "0.10"
tempfile = "3"
thiserror = "1"
walkdir = "2"
which_problem = "0.1"
ascii_table = { version = "4", features = ["color_codes"] }
const_format = "0.2"
fun_run = "0.1"

[dev-dependencies]
indoc = "2"
Expand Down
2 changes: 1 addition & 1 deletion commons/bin/print_style_guide.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use ascii_table::AsciiTable;
use commons::fun_run::CommandWithName;
use commons::output::fmt::{self, DEBUG_INFO, HELP};
use commons::output::{
build_log::*,
section_log::{log_step, log_step_stream, log_step_timed},
};
use fun_run::CommandWithName;
use indoc::formatdoc;
use std::io::stdout;
use std::process::Command;
Expand Down
57 changes: 0 additions & 57 deletions commons/src/err.rs

This file was deleted.

Loading