added proper default config file

This commit is contained in:
Trevor Bentley
2023-01-12 03:00:35 +01:00
parent d30d031728
commit 871ff0a30e
4 changed files with 45 additions and 25 deletions
+24 -21
View File
@@ -7,17 +7,17 @@
# A friendly name for the generated site. # A friendly name for the generated site.
# #
# This is accessible in all templates. # This is accessible in all templates.
site_name = "Trevor's Repos" #site_name = ""
# The URL where this generated site is hosted. # The URL where this generated site is hosted.
# #
# This is accessible in all templates. # This is accessible in all templates.
site_url = "https://git.trevorbentley.com" #site_url = ""
# A description of the generated site. # A description of the generated site.
# #
# This is accessible in all templates. # This is accessible in all templates.
site_description = "A bunch of git repos in a stupid format." #site_description = ""
# List of directories, each of which contains Git repositories to # List of directories, each of which contains Git repositories to
# index. # index.
@@ -31,7 +31,7 @@ site_description = "A bunch of git repos in a stupid format."
# settings for bulk-imported repositories. Repositories that require # settings for bulk-imported repositories. Repositories that require
# specific configuration can be explicitly specified later in this # specific configuration can be explicitly specified later in this
# file. # file.
recursive_repo_dirs = ["repos/"] #recursive_repo_dirs = []
# List of files to copy to the site's `global_assets` directory. # List of files to copy to the site's `global_assets` directory.
# #
@@ -44,7 +44,7 @@ recursive_repo_dirs = ["repos/"]
# #
# This can also be set per-repository, in which case the `repo_assets` output # This can also be set per-repository, in which case the `repo_assets` output
# directory is used. # directory is used.
asset_files = ["test.html"] #asset_files = []
# Whether to render Markdown files in repos into HTML. # Whether to render Markdown files in repos into HTML.
# #
@@ -87,7 +87,7 @@ syntax_highlight_theme = "base16-ocean.light"
# usage. # usage.
# #
# This can also be set per-repository. # This can also be set per-repository.
limit_history = 500 #limit_history = 500
# Limits maximum number of commits to output. # Limits maximum number of commits to output.
# #
@@ -96,7 +96,7 @@ limit_history = 500
# to the templates. # to the templates.
# #
# This can also be set per-repository. # This can also be set per-repository.
limit_commits = 500 #limit_commits = 500
# Limits maximum number of branches to parse. # Limits maximum number of branches to parse.
# #
@@ -107,7 +107,7 @@ limit_commits = 500
# values for this are very large, or 0 (to disable branches). # values for this are very large, or 0 (to disable branches).
# #
# This can also be set per-repository. # This can also be set per-repository.
limit_branches = 500 #limit_branches = 500
# Limits maximum number of tags to parse. # Limits maximum number of tags to parse.
# #
@@ -118,7 +118,7 @@ limit_branches = 500
# for this are very large, or 0 (to disable tags). # for this are very large, or 0 (to disable tags).
# #
# This can also be set per-repository. # This can also be set per-repository.
limit_tags = 500 #limit_tags = 500
# Limits directory depth to traverse when parsing files. # Limits directory depth to traverse when parsing files.
# #
@@ -131,7 +131,7 @@ limit_tags = 500
# file listing. If set to 1 or greater, only applies to `all_files`. # file listing. If set to 1 or greater, only applies to `all_files`.
# #
# This can also be set per-repository. # This can also be set per-repository.
limit_tree_depth = 20 #limit_tree_depth = 20
# Limits size of files in repo with content previews. # Limits size of files in repo with content previews.
# #
@@ -140,7 +140,7 @@ limit_tree_depth = 20
# include the text contents. # include the text contents.
# #
# This can also be set per-repository. # This can also be set per-repository.
limit_file_size = 2097152 #limit_file_size = 2097152
# Limits size of a single produced repository. # Limits size of a single produced repository.
# #
@@ -157,7 +157,7 @@ limit_file_size = 2097152
# disk usage. # disk usage.
# #
# This can also be set per-repository. # This can also be set per-repository.
limit_repo_size = 52428800 #limit_repo_size = 52428800
# Limits total size of all output. # Limits total size of all output.
# #
@@ -174,7 +174,7 @@ limit_repo_size = 52428800
# disk usage. # disk usage.
# #
# This can also be set per-repository. # This can also be set per-repository.
limit_total_size = 524288000 #limit_total_size = 524288000
@@ -342,18 +342,19 @@ generated_by = "Itsy-Gitsy"
# The section name is used as the repository name if no `name` attribute is # The section name is used as the repository name if no `name` attribute is
# provided. # provided.
[circadian] #[my_repository]
# Path to the Git repository. # Path to the Git repository.
path = "more_repos/circadian" #path = "/path/to/my_repository"
# Name of this repository, if different from the section name. # Name of this repository, if different from the section name.
name = "circadian" #name = "my_repository"
# A description of this repository. # A description of this repository.
description = "A repository full of code" #description = ""
# URL of website associated with this repository. # URL of website associated with this repository.
website = "https://circadian.trevorbentley.com" #website = ""
# Dictionary of arbitrary, user-defined attributes associated with the repo. # Dictionary of arbitrary, user-defined attributes associated with the repo.
# #
@@ -361,7 +362,7 @@ website = "https://circadian.trevorbentley.com"
# #
# Available in all repo-specific page templates. # Available in all repo-specific page templates.
# #
attributes = { status = "active", type = "daemon" } #attributes = { status = "active", type = "daemon" }
# Per-repository settings, same as the global versions described above: # Per-repository settings, same as the global versions described above:
@@ -386,5 +387,7 @@ attributes = { status = "active", type = "daemon" }
#status = "active" #status = "active"
#type = "daemon" #type = "daemon"
[ossuary] # Remote HTTPS repositories can also be specified:
path = "https://github.com/mrmekon/ossuary" #
#[remote_repo]
#path = "https://github.com/my_user_name/remote_repo"
+18 -1
View File
@@ -893,8 +893,20 @@ fn write_rendered(path: &str, rendered: &str) -> usize {
fn main() { fn main() {
let start_all = std::time::Instant::now(); let start_all = std::time::Instant::now();
let cli = CliArgs::parse(); let cli = CliArgs::parse();
let config_path = cli.config.as_deref().unwrap_or(Path::new("config.toml")); let config_path = cli.config.as_deref().unwrap_or(Path::new("config.toml")).to_owned();
let config_dir = config_path.parent().expect("Config file not in valid directory.").to_owned(); let config_dir = config_path.parent().expect("Config file not in valid directory.").to_owned();
let config_dir = match config_dir.to_str().unwrap_or_default().len() > 0 {
true => config_dir,
false => PathBuf::from("."),
};
let config_path = match config_path.canonicalize() {
Ok(d) => d,
_ => config_path.clone(),
};
let config_dir = match config_dir.canonicalize() {
Ok(d) => d,
_ => config_dir.clone(),
};
VERBOSITY.store(match cli.quiet { VERBOSITY.store(match cli.quiet {
true => 0, true => 0,
false => (cli.verbose + 1).into(), false => (cli.verbose + 1).into(),
@@ -1003,6 +1015,11 @@ fn main() {
let mut total_bytes = 0; let mut total_bytes = 0;
let mut repos: Vec<GitRepo> = vec!(); let mut repos: Vec<GitRepo> = vec!();
if repo_descriptions.len() == 0 {
panic!("No Git repositories defined! Please check your configuration file ({})",
config_path.display());
}
// Sort the repositories by name // Sort the repositories by name
let mut repo_vec: Vec<GitsySettingsRepo> = repo_descriptions.drain().collect(); let mut repo_vec: Vec<GitsySettingsRepo> = repo_descriptions.drain().collect();
repo_vec.sort_by(|x,y| x.name.as_deref().map(|n| n.cmp(&y.name.as_deref().unwrap_or_default())) repo_vec.sort_by(|x,y| x.name.as_deref().map(|n| n.cmp(&y.name.as_deref().unwrap_or_default()))
+1 -1
View File
@@ -1,7 +1,7 @@
<html> <html>
<head> <head>
{% block html_head -%} {% block html_head -%}
<title>{{site_name}}</title> <title>{{site_name | default(value="Itsy-Gitsy")}}</title>
{% block html_head_extra -%} {% block html_head_extra -%}
{% endblock html_head_extra -%} {% endblock html_head_extra -%}
{% endblock html_head -%} {% endblock html_head -%}
+2 -2
View File
@@ -1,3 +1,3 @@
Site: {{site_name}}<br/> Site: {{site_name | default(value="Itsy-Gitsy") }}<br/>
Description: {{site_description}}<br/> Description: {{site_description | default(value="A collection of Git repositories")}}<br/>
<hr/> <hr/>