1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
//This file is part of tmplgen
//
//tmplgen is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//tmplgen is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with tmplgen. If not, see <http://www.gnu.org/licenses/>.
//! libtmplgen can be used for querying different language-specific package managers and generating
//! Void Linux build templates for them. Currently the following providers are supported:
//!
//! * [crates.io](https://crates.io)
//! * [metacpan.org](https://metacpan.org)
//! * [rubygems.org](https://rubygems.org)
//!
//! # Usage
//!
//! The following will write a template for `tmplgen` in $XBPS_DISTDIR/srcpkgs/tmplgen/template
//!
//! ```
//! use libtmplgen::*;
//! use std::fs::File;
//! use std::io::prelude::*;
//!
//! let template = TmplBuilder::new("tmplgen").get_type().unwrap().get_info().unwrap().generate().unwrap();
//!
//! let mut file = File::create("./template").unwrap();
//! file.write_all(template.inner.as_bytes()).unwrap();
//! ```
//!
//! *Wait. What?*
//! Here's a step-by-step example:
//! ```
//! use libtmplgen::*;
//! use std::fs::File;
//! use std::io::prelude::*;
//!
//! // Creates a new TmplBuilder for the pkg "tmplgen"
//! let mut tmpl_builder = TmplBuilder::new("tmplgen");
//! // Get the PkgType of this crate
//! tmpl_builder.get_type().unwrap();
//! // Get a PkgInfo struct of this crate
//! tmpl_builder.get_info().unwrap();
//! // Generate a [Template](crate::types::Template) which we can write later on
//! let template = tmpl_builder.generate().unwrap();
//!
//! // Create a file called "template" in the current dir
//! let mut file = File::create("./template").unwrap();
//! // Write the [Template](crate::types::Template) to the file we just created
//! file.write_all(template.inner.as_bytes()).unwrap();
//! ```
//!
//! See [TmplBuilder](crate::types::TmplBuilder) for most of the exciting other stuff.
mod crates;
mod gems;
mod helpers;
mod perldist;
#[cfg(test)]
mod tests;
pub mod errors;
pub mod tmplwriter;
pub mod types;
pub use crate::errors::*;
pub use crate::tmplwriter::*;
pub use crate::types::*;