Add variables and template mirror url
This commit is contained in:
@ -18,12 +18,19 @@ impl Target for Git {
|
||||
chart_local: ChartLocal,
|
||||
dry_run: bool,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let cmd = format!("git clone {} {}", self.url, self.git_dir);
|
||||
let mut reg = super::register_handlebars();
|
||||
// Prepare the URL
|
||||
reg.register_template_string("url", self.url.clone())?;
|
||||
let url = reg.render("url", &chart_local)?;
|
||||
//Prepare the git dir
|
||||
reg.register_template_string("git_dir", self.git_dir.clone())?;
|
||||
let git_dir = reg.render("git_dir", &chart_local)?;
|
||||
|
||||
let cmd = format!("git clone {} {}", url, git_dir);
|
||||
cli_exec_from_dir(cmd, workdir_path.clone())?;
|
||||
let git_repo_path = format!("{}/{}", workdir_path, self.git_dir);
|
||||
let git_repo_path = format!("{}/{}", workdir_path, git_dir);
|
||||
|
||||
// Prepare branch
|
||||
let mut reg = super::register_handlebars();
|
||||
reg.register_template_string("branch", self.branch.clone())?;
|
||||
let branch = reg.render("branch", &chart_local)?;
|
||||
let cmd = format!("git checkout {}", branch);
|
||||
|
@ -21,7 +21,10 @@ pub(crate) fn mirror_from_mirror_obj(
|
||||
) -> Result<Box<dyn Target>, Box<dyn std::error::Error>> {
|
||||
if let Some(git) = mirror.git {
|
||||
return Ok(Box::from(git::Git {
|
||||
git_dir: mirror.name.clone(),
|
||||
git_dir: match git.git_dir {
|
||||
Some(dir) => dir,
|
||||
None => mirror.name,
|
||||
},
|
||||
url: git.url,
|
||||
path: match git.path {
|
||||
Some(path) => path,
|
||||
|
Reference in New Issue
Block a user