From 5c2ebe85722f110c8e08c2b960abf2b7d186db96 Mon Sep 17 00:00:00 2001 From: DrPeterVanNostrand Date: Wed, 12 Dec 2018 18:47:45 +0000 Subject: [PATCH] Added docs to build.rs. --- build.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 7bad688..1b9c4d9 100644 --- a/build.rs +++ b/build.rs @@ -1,15 +1,23 @@ use std::fs; use std::path::Path; +/// If no `.env` file exists, this function will create an `.env` file and copy the contents +/// of `sample.env` into it (this is why `sample.env` is kept under source control). +/// +/// +/// # Panics +/// +/// This function panics if both the `.env` file and `sample.env` file do not exist, or if we +/// fail to copy `sample.env` into `.env`. fn create_env_file_if_dne() { let env_path = Path::new(".env"); if !env_path.exists() { let sample_env_path = Path::new("sample.env"); if !sample_env_path.exists() { - panic!("neither the .env nor the sample.env files exist"); + panic!("neither the `.env` nor the `sample.env` files exist, one of these files must exist to build the `poagov`"); } fs::copy(sample_env_path, env_path) - .unwrap_or_else(|e| panic!("could not create .env file from sample.env: {:?}", e)); + .unwrap_or_else(|e| panic!("failed to create the `.env` file from `sample.env`: {:?}", e)); } }