Skip to content

Commit

Permalink
remove website to git option + readme
Browse files Browse the repository at this point in the history
  • Loading branch information
leedavi committed Feb 12, 2024
1 parent 1639237 commit 0611db5
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 198 deletions.
61 changes: 29 additions & 32 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,7 @@ static void Main(string[] args)
var markDownData = new MarkDownLimpet(_sourceRootPath);
markDownData.SaveDocs(_websiteFolder);
}
else
{
Console.WriteLine("MARKDOWN documentation skipped. use '/docs' option on cmd to process documentation. ");
}

// do recursive copy files
Console.WriteLine("--- Folder Search ---");
DirCopy(_sourceRootPath); // copy root without recursive
Expand Down Expand Up @@ -291,31 +288,31 @@ static void SyncAll(DirectoryInfo gitDir, DirectoryInfo webDir)
foreach (FileInfo fi in webDir.GetFiles()) { webList.Add(fi); webListNames.Add(Path.GetFileName(fi.Name)); }

// copy any newer files from website to git repo
foreach (var fi in webList)
{
if (Path.GetExtension(fi.Name) == "")
{
Console.WriteLine("WARNING: No file extension. (Not Processed) " + fi.FullName);
}
else
{
if (File.Exists(Path.Combine(gitDir.FullName, fi.Name)))
{
var fileWebDate = fi.LastWriteTime;
var fileGitDate = File.GetLastWriteTime(Path.Combine(gitDir.FullName, fi.Name));
if (fileGitDate < fileWebDate)
{
Console.WriteLine("DO NOT Pull: " + Path.Combine(gitDir.FullName, fi.Name));
//fi.CopyTo(Path.Combine(gitDir.FullName, fi.Name), true);
}
}
else
{
//Console.WriteLine("Pull: " + fi.Name);
//fi.CopyTo(Path.Combine(gitDir.FullName, fi.Name), true);
}
}
}
//foreach (var fi in webList)
//{
// if (Path.GetExtension(fi.Name) == "")
// {
// Console.WriteLine("WARNING: No file extension. (Not Processed) " + fi.FullName);
// }
// else
// {
// if (File.Exists(Path.Combine(gitDir.FullName, fi.Name)))
// {
// var fileWebDate = fi.LastWriteTime;
// var fileGitDate = File.GetLastWriteTime(Path.Combine(gitDir.FullName, fi.Name));
// if (fileGitDate < fileWebDate)
// {
// Console.WriteLine("DO NOT Pull: " + Path.Combine(gitDir.FullName, fi.Name));
// //fi.CopyTo(Path.Combine(gitDir.FullName, fi.Name), true);
// }
// }
// else
// {
// //Console.WriteLine("Pull: " + fi.Name);
// //fi.CopyTo(Path.Combine(gitDir.FullName, fi.Name), true);
// }
// }
//}
// copy any newer files from git repo to website
foreach (var fi in gitList)
{
Expand All @@ -329,11 +326,11 @@ static void SyncAll(DirectoryInfo gitDir, DirectoryInfo webDir)
{
var fileGitDate = fi.LastWriteTime;
var fileWebDate = File.GetLastWriteTime(Path.Combine(webDir.FullName, fi.Name));
//if (fileGitDate > fileWebDate)
//{
if (fileGitDate > fileWebDate || _repofilesdelete)
{
Console.WriteLine("CopyTo: " + Path.Combine(webDir.FullName, fi.Name));
fi.CopyTo(Path.Combine(webDir.FullName, fi.Name), true);
//}
}
}
else
{
Expand Down
185 changes: 19 additions & 166 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,189 +140,42 @@ Copy Razor templates

When we copy razor templates we do not wish to compile and copy the assemblies. (Doing this will cause the AppPool to recycle)

We create a config in the VS project called "Razor" (or any other name starting with "nc-") that has ALL project compile turned off. We can use this to Sync the razor templates. Any templates on the website folder will be copied to the Git project folder if they are newer than the Git file. And the same copy/sync rules apply for copying the Git working area files to the website.

Build Documentation
-------------------
Markdown documentation files can be automatically converted to html for documentation. Use "\docs" option the command.

The Markdown files MUST be in a sub-folder of the project called "\docs".

Any images used MUST be in a sub-folder of the project called "\docs\img".

Any generated html and images will be created in the destination website under the [_metadata_:docsfolder] meta data specified in the markdown.

The ReadMe.md on the project root will also be included.

If the markdown does NOT have any meta data, the file will be ignored.

### Markdown Meta Data
The markdown meta data in a simple set of text that will be hidden.

```
[_metadata_:docsfolder]: docs\erms\advert
[_metadata_:menugroup]: Advert
[_metadata_:name]: Introduction
[_metadata_:sortorder]: 0
```
**NOTE: Token values MUST NOT have any spaces, any underscore will be converted to a space.**

### Template base & Tokens
The documentation HTML is made using a html template. The Template MUST be called "\docs\templates\Template.html" & "\docs\templates\menuline.html".

Tokens included will inject the [MENU] and [BODY] for the full template and [URL] and [NAME] for the Menu template.

Example Menu Line Template:
```
<a href="[URL]" class="w3-bar-item w3-button w3-hover-white">[NAME]</a>
```

Example Full Template:
```
<!DOCTYPE html>
<html lang="en">
<head>
<title>CRS - Advert</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3-theme-indigo.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<style>
html, body, h1, h2, h3, h4, h5, h6 {
font-family: "Roboto", sans-serif;
}
.w3-sidebar {
z-index: 3;
width: 250px;
top: 43px;
bottom: 0;
height: inherit;
}
</style>
</head>
<body>
<!-- Navbar -->
<div class="w3-top">
<div class="w3-bar w3-theme w3-left-align w3-large w3-text-bottom" style="height:43px;">
<div class="w3-bar-item w3-theme-l1">Central Resource System - Adverts</div>
<div class="w3-bar-item w3-right w3-input w3-padding" id="google_translate_element"></div>
<div class="w3-bar-item w3-button w3-right w3-hide-large w3-hover-white w3-large w3-theme-l1" onclick="w3_open()"><i class="fa fa-bars"></i></div>
</div>
</div>
<!-- Sidebar -->
<nav class="w3-sidebar w3-bar-block w3-collapse w3-large w3-theme-l5 " id="mySidebar">
<a href="javascript:void(0)" onclick="w3_close()" class="w3-right w3-xlarge w3-padding-large w3-hover-black w3-hide-large" title="Close Menu">
<i class="fa fa-remove"></i>
</a>
[MENU]
</nav>
<!-- Overlay effect when opening sidebar on small screens -->
<div class="w3-overlay w3-hide-large" onclick="w3_close()" style="cursor:pointer" title="close side menu" id="myOverlay"></div>
<!-- Main content: shift it to the right by 250 pixels when the sidebar is visible -->
<div class="w3-main" style="margin-left:250px">
<div class="w3-row w3-margin-top w3-padding-64">
<div class="w3-container">
[BODY]
</div>
</div>
<footer id="myFooter">
<div class="w3-container">
<div class="w3-right">Powered by <a href="https://www.rocket-cds.org/" target="_blank">RocketCDS</a></div>
</div>
</footer>
<!-- END MAIN -->
</div>
<script>
document.addEventListener("DOMContentLoaded", () => {
googleTranslateElementInit();
});
// Get the Sidebar
var mySidebar = document.getElementById("mySidebar");
// Get the DIV with overlay effect
var overlayBg = document.getElementById("myOverlay");
// Toggle between showing and hiding the sidebar, and add overlay effect
function w3_open() {
if (mySidebar.style.display === 'block') {
mySidebar.style.display = 'none';
overlayBg.style.display = "none";
} else {
mySidebar.style.display = 'block';
overlayBg.style.display = "block";
}
}
// Close the sidebar with the close button
function w3_close() {
mySidebar.style.display = "none";
overlayBg.style.display = "none";
}
// Google Translate
function googleTranslateElementInit() {
new google.translate.TranslateElement({ pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE }, 'google_translate_element');
}
</script>
</body>
</html>
```
We create a config in the VS project that has ALL project compile turned off, we can then use this to Sync the razor templates without a compile.
Any templates in the Git project folder will be copied to the website, if they are newer than the Git file.

And the same copy/sync rules apply for copying the Git working area files to the website.

VS External Tool
----------------
You can also setup external tools in VS to make compiling quicker.

It is best to setup 3 tools, each for release, debug, razor.

Shortcut keys can also help. Setup from >Tools>Options>Environment>Keyboard

Search for "External." to find the possible commands. If you place the compile in position 1,2,3 you can link like this:
You can also setup external tools in VS to make compiling quicker.
*Tools>External Tools>*
![Vstools](vstools.png)

```
DNN Build (release)
DNNpackager
DNNpackager.exe
$(ProjectDir) $(TargetDir) release
$(ProjectDir) $(TargetDir) razor
$(ProjectDir)
```
\<Shit + Ctrl + 1\>
Copies only files that have changed in Git folder

```
DNN Build (debug)
DNNpackager
DNNpackager.exe
$(ProjectDir) $(TargetDir) debug
$(ProjectDir) $(TargetDir) razor /clean
$(ProjectDir)
```
\<Shit + Ctrl + 2\>
Copies all files in Git folder and deletes files not in Git folder.

Shortcut keys can also help. Setup from >Tools>Options>Environment>Keyboard

Search for "Tools.ExternalCommand" to find the possible commands. If you place the command in position 1 you can link to a key like this:
```
DNN Build (razor)
DNNpackager.exe
$(ProjectDir) $(TargetDir) razor
$(ProjectDir)
Tools.ExternalCommand1
```
```
Ctrl+Shift+1>
```
\<Shit + Ctrl + 3\>


Working with Multiple Projects
Expand Down
Loading

0 comments on commit 0611db5

Please sign in to comment.