use super::*;
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct HomebrewInstallerLayer {
#[serde(flatten)]
pub common: CommonInstallerLayer,
pub tap: Option<String>,
pub formula: Option<String>,
}
#[derive(Debug, Default, Clone)]
pub struct HomebrewInstallerConfig {
pub common: CommonInstallerConfig,
pub tap: Option<String>,
pub formula: Option<String>,
}
impl HomebrewInstallerConfig {
pub fn defaults_for_package(
_workspaces: &WorkspaceGraph,
_pkg_idx: PackageIdx,
common: &CommonInstallerConfig,
) -> Self {
Self {
common: common.clone(),
tap: None,
formula: None,
}
}
}
impl ApplyLayer for HomebrewInstallerConfig {
type Layer = HomebrewInstallerLayer;
fn apply_layer(
&mut self,
Self::Layer {
common,
tap,
formula,
}: Self::Layer,
) {
self.common.apply_layer(common);
self.tap.apply_opt(tap);
self.formula.apply_opt(formula);
}
}
impl ApplyLayer for HomebrewInstallerLayer {
type Layer = HomebrewInstallerLayer;
fn apply_layer(
&mut self,
Self::Layer {
common,
tap,
formula,
}: Self::Layer,
) {
self.common.apply_layer(common);
self.tap.apply_opt(tap);
self.formula.apply_opt(formula);
}
}
impl std::ops::Deref for HomebrewInstallerConfig {
type Target = CommonInstallerConfig;
fn deref(&self) -> &Self::Target {
&self.common
}
}