Add features section
This commit is contained in:
parent
073ad4ca4a
commit
5c503eff4b
4 changed files with 24 additions and 21 deletions
|
|
@ -17,3 +17,9 @@ clap = { version = "4.4.4", features = ["derive"] }
|
||||||
serde = { version = "1.0.188", features = ["derive"] }
|
serde = { version = "1.0.188", features = ["derive"] }
|
||||||
serde_yaml = "0.9.25"
|
serde_yaml = "0.9.25"
|
||||||
tera = "1.19.1"
|
tera = "1.19.1"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = []
|
||||||
|
nightly = ["init", "build"]
|
||||||
|
init = []
|
||||||
|
build = []
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use ublue_rs::{self, CommandArgs, UblueArgs};
|
use ublue_rs::{self, CommandArgs, UblueArgs};
|
||||||
|
|
@ -25,10 +23,10 @@ fn main() -> Result<()> {
|
||||||
CommandArgs::Init { dir } => {
|
CommandArgs::Init { dir } => {
|
||||||
let base_dir = match dir {
|
let base_dir = match dir {
|
||||||
Some(dir) => dir,
|
Some(dir) => dir,
|
||||||
None => PathBuf::from("./"),
|
None => std::path::PathBuf::from("./"),
|
||||||
};
|
};
|
||||||
|
|
||||||
ublue_rs::initialize_directory(base_dir);
|
ublue_rs::init::initialize_directory(base_dir);
|
||||||
}
|
}
|
||||||
#[cfg(build)]
|
#[cfg(build)]
|
||||||
CommandArgs::Build { containerfile: _ } => {
|
CommandArgs::Build { containerfile: _ } => {
|
||||||
|
|
|
||||||
16
src/init.rs
16
src/init.rs
|
|
@ -1,3 +1,19 @@
|
||||||
const GITLAB_CI_FILE: &'static str = include_str!("../templates/init/gitlab-ci.yml");
|
const GITLAB_CI_FILE: &'static str = include_str!("../templates/init/gitlab-ci.yml");
|
||||||
const RECIPE_FILE: &'static str = include_str!("../templates/init/recipe.yml");
|
const RECIPE_FILE: &'static str = include_str!("../templates/init/recipe.yml");
|
||||||
const LICENSE_FILE: &'static str = include_str!("../LICENSE");
|
const LICENSE_FILE: &'static str = include_str!("../LICENSE");
|
||||||
|
|
||||||
|
pub fn initialize_directory(base_dir: PathBuf) {
|
||||||
|
let recipe_path = base_dir.join("recipe.yml");
|
||||||
|
|
||||||
|
let gitlab_ci_path = base_dir.join(".gitlab-ci.yml");
|
||||||
|
|
||||||
|
let readme_path = base_dir.join("README.md");
|
||||||
|
|
||||||
|
let license_path = base_dir.join("LICENSE");
|
||||||
|
|
||||||
|
let scripts_dir = base_dir.join("scripts/");
|
||||||
|
|
||||||
|
let pre_scripts_dir = scripts_dir.join("pre/");
|
||||||
|
|
||||||
|
let post_scripts_dir = scripts_dir.join("post/");
|
||||||
|
}
|
||||||
|
|
|
||||||
17
src/lib.rs
17
src/lib.rs
|
|
@ -118,20 +118,3 @@ pub fn setup_tera(recipe: String, containerfile: Option<PathBuf>) -> Result<(Ter
|
||||||
|
|
||||||
Ok((tera, context))
|
Ok((tera, context))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(init)]
|
|
||||||
pub fn initialize_directory(base_dir: PathBuf) {
|
|
||||||
let recipe_path = base_dir.join("recipe.yml");
|
|
||||||
|
|
||||||
let gitlab_ci_path = base_dir.join(".gitlab-ci.yml");
|
|
||||||
|
|
||||||
let readme_path = base_dir.join("README.md");
|
|
||||||
|
|
||||||
let license_path = base_dir.join("LICENSE");
|
|
||||||
|
|
||||||
let scripts_dir = base_dir.join("scripts/");
|
|
||||||
|
|
||||||
let pre_scripts_dir = scripts_dir.join("pre/");
|
|
||||||
|
|
||||||
let post_scripts_dir = scripts_dir.join("post/");
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue