aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Goldstein <cardoe@cardoe.com>2019-12-26 12:26:38 -0600
committerDoug Goldstein <cardoe@cardoe.com>2020-01-26 09:20:19 -0600
commit2649758e5431c75109f7e8564587a0f7a965b20f (patch)
tree217044458e8feb30f3628287edb696e86508cea2 /src/main.rs
parentadd package name and version to metadata struct (diff)
downloadcargo-ebuild-2649758e5431c75109f7e8564587a0f7a965b20f.tar.gz
cargo-ebuild-2649758e5431c75109f7e8564587a0f7a965b20f.tar.bz2
cargo-ebuild-2649758e5431c75109f7e8564587a0f7a965b20f.zip
split metadata gathering and ebuild writing functions
Split the metadata gathering into its own function, separate from the ebuild writing function.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index e0d550b..bc3c520 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -12,7 +12,7 @@ extern crate cargo_ebuild;
extern crate structopt;
use anyhow::Result;
-use cargo_ebuild::run;
+use cargo_ebuild::{gen_ebuild_data, write_ebuild};
use std::path::PathBuf;
use structopt::clap::AppSettings;
use structopt::StructOpt;
@@ -48,6 +48,14 @@ enum Opt {
fn main() -> Result<()> {
let Opt::Ebuild(opt) = Opt::from_args();
- // run the actual code
- run(opt.verbose as u32, opt.quiet, opt.manifest_path)
+ // compute the data from the package that the build needs
+ let ebuild_data = gen_ebuild_data(opt.verbose as u32, opt.quiet, opt.manifest_path)?;
+
+ let ebuild_path = format!("{}-{}.ebuild", ebuild_data.name, ebuild_data.version);
+
+ write_ebuild(ebuild_data, &ebuild_path)?;
+
+ println!("Wrote: {}", ebuild_path);
+
+ Ok(())
}