Skip to content

Commit

Permalink
More Documentation and Badges for Projects
Browse files Browse the repository at this point in the history
  • Loading branch information
wyatt-herkamp committed Aug 28, 2024
1 parent 53e223a commit f097892
Show file tree
Hide file tree
Showing 24 changed files with 438 additions and 370 deletions.
109 changes: 0 additions & 109 deletions crates/core/src/repository/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use uuid::Uuid;

use crate::database::repository::DBRepositoryConfig;
pub mod project;
use super::Policy;
pub mod repository_page;
#[derive(Debug, Error)]
pub enum RepositoryConfigError {
Expand Down Expand Up @@ -87,111 +86,3 @@ pub async fn get_repository_config_or_default<
.map(|x| x.unwrap_or_default())
}
pub type DynRepositoryConfigType = Box<dyn RepositoryConfigType>;
#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
#[serde(default)]

pub struct SecurityConfig {
#[schemars(title = "Require Auth Token for Push")]
/// If the repository requires an auth token to be used
pub must_use_auth_token_for_push: bool,
}
#[derive(Debug, Clone, Copy, Default)]
pub struct SecurityConfigType;
impl RepositoryConfigType for SecurityConfigType {
fn get_type(&self) -> &'static str {
"security"
}
fn get_description(&self) -> ConfigDescription {
ConfigDescription {
name: "Security",
description: Some("Security settings for the repository"),
documentation_link: None,
..Default::default()
}
}

fn validate_config(&self, config: Value) -> Result<(), RepositoryConfigError> {
let _config: SecurityConfig = serde_json::from_value(config)?;
Ok(())
}

fn default(&self) -> Result<Value, RepositoryConfigError> {
Ok(serde_json::to_value(SecurityConfig::default())?)
}

fn schema(&self) -> Option<Schema> {
Some(schema_for!(SecurityConfig))
}

fn get_type_static() -> &'static str
where
Self: Sized,
{
"security"
}
}

#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[serde(default)]
pub struct PushRulesConfig {
#[schemars(title = "Push Policy")]
/// The push policy. Rather it allows snapshots, stages, or both
pub push_policy: Policy,
/// If yanking is allowed
#[schemars(title = "Yanking Allowed")]
pub yanking_allowed: bool,
/// If overwriting is allowed
#[schemars(title = "Allow Overwrite")]
pub allow_overwrite: bool,
/// If a project exists the user must be a member of the project to push.
#[schemars(title = "Project Members can only push")]
pub must_be_project_member: bool,
#[schemars(title = "Require Nitro Deploy")]
pub require_nitro_deploy: bool,
}
impl Default for PushRulesConfig {
fn default() -> Self {
Self {
push_policy: Default::default(),
yanking_allowed: true,
allow_overwrite: true,
must_be_project_member: Default::default(),
require_nitro_deploy: false,
}
}
}
#[derive(Debug, Clone, Copy, Default)]

pub struct PushRulesConfigType;
impl RepositoryConfigType for PushRulesConfigType {
fn get_type(&self) -> &'static str {
"push_rules"
}
fn get_description(&self) -> ConfigDescription {
ConfigDescription {
name: "Push Rules",
description: Some("Rules for pushing to the repository"),
documentation_link: None,
..Default::default()
}
}
fn validate_config(&self, config: Value) -> Result<(), RepositoryConfigError> {
let _config: PushRulesConfig = serde_json::from_value(config)?;
Ok(())
}

fn default(&self) -> Result<Value, RepositoryConfigError> {
Ok(serde_json::to_value(PushRulesConfig::default())?)
}

fn schema(&self) -> Option<Schema> {
Some(schema_for!(PushRulesConfig))
}

fn get_type_static() -> &'static str
where
Self: Sized,
{
"push_rules"
}
}
2 changes: 1 addition & 1 deletion crates/core/src/repository/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ pub enum Visibility {
Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default, EnumIter, JsonSchema, EnumIs,
)]
pub enum Policy {
#[default]
Release,
Snapshot,
#[default]
Mixed,
}
#[derive(Debug, Error)]
Expand Down
3 changes: 2 additions & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules
/.vitepress/dist
/docs/.vitepress/dist
/docs/.vitepress/cache
173 changes: 102 additions & 71 deletions docs/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,84 +1,115 @@
import {defineConfig} from 'vitepress'
import { defineConfig } from "vitepress";

export default defineConfig({
lang: 'en-US',
title: 'Nitro_Repo',
description: 'A Fast Artifact Manager',
lastUpdated: true,
themeConfig: {
nav: [
{text: 'Home', link: '/', activeMatch: '^/$'},
{
text: 'System Admin',
link: '/sysAdmin/',
activeMatch: '^/sysAdmin/'
},
{
text: 'Knowledge Base',
link: '/knowledge/',
activeMatch: '^/knowledge/'
},
{
text: 'Release Notes',
link: 'https://github.com/wyatt-herkamp/nitro_repo/releases'
}
],
socialLinks: [
{icon: 'github', link: 'https://github.com/wyatt-herkamp/nitro_repo'}
],
sidebar: {
'/': generalInfo(),
'/sysAdmin/': sysAdminBar(),
'/knowledge/': knowledgeBaseBar()
},
lang: "en-US",
title: "Nitro_Repo",
description: "A Fast Artifact Manager",
lastUpdated: true,
themeConfig: {
nav: [
{ text: "Home", link: "/", activeMatch: "^/$" },
{
text: "System Admin",
link: "/sysAdmin/",
activeMatch: "^/sysAdmin/",
},
{
text: "Knowledge Base",
link: "/knowledge/",
activeMatch: "^/knowledge/",
},
{
text: "Repository Types",
link: "/repositoryTypes/",
activeMatch: "^/repositoryTypes/",
},
{
text: "Release Notes",
link: "https://github.com/wyatt-herkamp/nitro_repo/releases",
},
],
socialLinks: [
{ icon: "github", link: "https://github.com/wyatt-herkamp/nitro_repo" },
],
sidebar: {
"/": generalInfo(),
"/sysAdmin/": sysAdminBar(),
"/knowledge/": knowledgeBaseBar(),
"/repositoryTypes/": repositoryTypesBar(),
},

})
},
});

function generalInfo() {
return [
{
text: 'Nitro Repo',
items: [
{text: 'What is Nitro Repo?', link: '/'},
{text: 'Features', link: '/features'},
{text: 'Compiling', link: '/compiling'},
{text: 'Contributing', link: '/contributing'},
]
}
]
return [
{
text: "Nitro Repo",
items: [
{ text: "What is Nitro Repo?", link: "/" },
{ text: "Features", link: "/features" },
{ text: "Contributing", link: "/contributing" },
],
},
];
}

function knowledgeBaseBar() {
return [
{
text: 'User Management',
items: [
{text: 'User Permissions', link: '/knowledge/userpermissions'},
]
}, {
text: 'Repositories',
items: [
{text: 'Artifact Types', link: '/knowledge/ArtifactTypes'}
]
}, {
text: 'Other',
items: [
{text: 'Internal Workings', link: '/knowledge/InternalWorkings'}
]
},

]
return [
{
text: "Other",
items: [
{ text: "Internal Workings", link: "/knowledge/InternalWorkings" },
],
},
];
}

function sysAdminBar() {
return [
{
text: 'Installing',
items: [
{text: 'Prepping your System', link: '/sysAdmin/'},
return [
{
text: "Installing",
items: [{ text: "Prepping your System", link: "/sysAdmin/" }],
},
];
}

]
}
]
function repositoryTypesBar() {
return [
{
text: "Maven",
link: "/repositoryTypes/maven",
items: [
{
text: "Maven Standard",
link: "/repositoryTypes/maven/standard",
},
{
text: "Nitro Deploy",
link: "/repositoryTypes/maven/nitroDeploy",
},
{
text: "Configs",
link: "/repositoryTypes/maven/configs",
},
],
},
{
text: "NPM",
link: "/repositoryTypes/npm",
items: [
{
text: "NPM Standard",
link: "/repositoryTypes/npm/standard",
},
{
text: "Configs",
link: "/repositoryTypes/npm/configs",
},
{
text: "Common Issues",
link: "/repositoryTypes/npm/errors",
},
],
},
];
}
27 changes: 0 additions & 27 deletions docs/docs/compiling.md

This file was deleted.

7 changes: 0 additions & 7 deletions docs/docs/knowledge/ArtifactTypes.md

This file was deleted.

25 changes: 0 additions & 25 deletions docs/docs/knowledge/userpermissions.md

This file was deleted.

Empty file.
Loading

0 comments on commit f097892

Please sign in to comment.