-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bob Tabor
committed
Jul 16, 2020
1 parent
3722c0f
commit ba85e4f
Showing
14 changed files
with
568 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.29102.190 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "scaffold", "scaffold\scaffold.csproj", "{C248E7B8-E0C5-44CE-8108-67F65CC92A1F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C248E7B8-E0C5-44CE-8108-67F65CC92A1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C248E7B8-E0C5-44CE-8108-67F65CC92A1F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C248E7B8-E0C5-44CE-8108-67F65CC92A1F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{C248E7B8-E0C5-44CE-8108-67F65CC92A1F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {29338731-7606-4320-82C1-8546B153D50D} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace scaffold | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
// TODO: Print version number. | ||
// TODO: Check to make sure all the templates are in the right folder. | ||
|
||
var originalColor = Console.ForegroundColor; | ||
|
||
Console.WriteLine("Hi, I scaffold Learn modules!"); | ||
Console.WriteLine(""); | ||
Console.WriteLine("First, what is the module's UID?"); | ||
string moduleUID = Console.ReadLine(); | ||
|
||
Console.WriteLine(""); | ||
Console.Write("Next, please enter each unit UID, starting with "); | ||
Console.ForegroundColor = ConsoleColor.Cyan; | ||
Console.Write("'introduction'"); | ||
Console.ForegroundColor = originalColor; | ||
Console.WriteLine(", selecting [Enter] to add another."); | ||
|
||
Console.Write("When I see "); | ||
Console.ForegroundColor = ConsoleColor.Cyan; | ||
Console.Write("'summary'"); | ||
Console.ForegroundColor = originalColor; | ||
Console.WriteLine(" I'll know you're done."); | ||
|
||
Console.Write("Type "); | ||
Console.ForegroundColor = ConsoleColor.Red; | ||
Console.Write("'quit'"); | ||
Console.ForegroundColor = originalColor; | ||
Console.WriteLine(" to exit before generating any files."); | ||
|
||
var unitUIDs = new List<string>(); | ||
while (true) | ||
{ | ||
var unitUID = Console.ReadLine(); | ||
|
||
if (unitUID == "quit") return; | ||
|
||
unitUIDs.Add(unitUID); | ||
|
||
if (unitUIDs.Last() == "summary") break; | ||
} | ||
|
||
// Do some input checking here ... | ||
|
||
Console.WriteLine(""); | ||
Console.WriteLine("Working ..."); | ||
Console.WriteLine(""); | ||
|
||
|
||
// Create folders | ||
|
||
string baseDirectory = $"c:\\working\\{moduleUID}"; | ||
System.IO.Directory.CreateDirectory(baseDirectory); | ||
Console.WriteLine($"Created {baseDirectory}"); | ||
|
||
string mediaDirectory = baseDirectory + "\\media"; | ||
System.IO.Directory.CreateDirectory(mediaDirectory); | ||
Console.WriteLine($"Created {mediaDirectory}"); | ||
|
||
string includesDirectory = baseDirectory + "\\includes"; | ||
System.IO.Directory.CreateDirectory(includesDirectory); | ||
Console.WriteLine($"Created {includesDirectory}"); | ||
|
||
// Use templates | ||
|
||
createIndex(moduleUID, unitUIDs, baseDirectory); | ||
createYamls(moduleUID, unitUIDs, baseDirectory); | ||
|
||
createMarkdowns(moduleUID, unitUIDs, includesDirectory); | ||
|
||
createReference(baseDirectory); | ||
|
||
// Spit out next steps | ||
|
||
Console.WriteLine(""); | ||
Console.WriteLine("Success!"); | ||
|
||
Console.WriteLine(""); | ||
Console.ForegroundColor = ConsoleColor.Red; | ||
Console.WriteLine("Next steps:"); | ||
Console.ForegroundColor = originalColor; | ||
Console.WriteLine($"Your scaffolded module is saved at: {baseDirectory}"); | ||
Console.WriteLine($"Copy this to your local Learn-PR repo"); | ||
|
||
|
||
// todo: in the future, perhaps I could automate even more first steps: | ||
// https://github.com/libgit2/libgit2sharp/wiki | ||
|
||
} | ||
|
||
private static void createReference(string baseDirectory) | ||
{ | ||
var content = System.IO.File.ReadAllText("c:\\scaffold\\templates\\reference.txt"); | ||
|
||
var fileName = baseDirectory + "\\reference.txt"; | ||
System.IO.File.AppendAllText(fileName, content); | ||
|
||
Console.WriteLine("Created the reference.txt"); | ||
} | ||
|
||
static void createIndex(string moduleUID, List<string> unitUIDs, string baseDirectory) | ||
{ | ||
|
||
// Get data from index.txt | ||
var content = System.IO.File.ReadAllText("c:\\scaffold\\templates\\index.txt"); | ||
|
||
// String replace | ||
content = content.Replace("{{moduleUID}}", moduleUID); | ||
|
||
var myDate = DateTime.Now.ToString("MM/dd/yyyy"); | ||
content = content.Replace("{{date}}", myDate); | ||
|
||
var uids = new StringBuilder(); | ||
foreach (var item in unitUIDs) | ||
{ | ||
uids.AppendLine("- learn.languages." + moduleUID + "." + item); | ||
} | ||
content = content.Replace("{{unitUIDs}}", uids.ToString()); | ||
|
||
// Create file, save | ||
var fileName = baseDirectory + "\\index.yml"; | ||
System.IO.File.AppendAllText(fileName, content); | ||
|
||
Console.WriteLine("Created the index.yml"); | ||
} | ||
|
||
static void createYamls(string moduleUID, List<string> unitUIDs, string baseDirectory) | ||
{ | ||
var content = System.IO.File.ReadAllText("c:\\scaffold\\templates\\unit-yaml.txt"); | ||
var interactive = System.IO.File.ReadAllText("c:\\scaffold\\templates\\unit-yaml-interactive.txt"); | ||
|
||
var myDate = DateTime.Now.ToString("MM/dd/yyyy"); | ||
|
||
content = content.Replace("{{date}}", myDate); | ||
interactive = interactive.Replace("{{date}}", myDate); | ||
|
||
var counter = 0; | ||
|
||
foreach (var unitUID in unitUIDs) | ||
{ | ||
counter++; | ||
string newContent = ""; | ||
|
||
if (unitUID == "knowledge-check") | ||
{ | ||
createKnowledgeCheck(moduleUID, unitUIDs, baseDirectory, counter); | ||
continue; | ||
} else if (unitUID == "introduction" || unitUID == "summary") | ||
{ | ||
newContent = content; | ||
} else | ||
{ | ||
newContent = interactive; | ||
} | ||
|
||
var numberModuleUID = $"{counter}-{unitUID}"; | ||
|
||
newContent = newContent.Replace("{{numberModuleUID}}", numberModuleUID); | ||
|
||
newContent = newContent.Replace("{{moduleUID}}", moduleUID); | ||
newContent = newContent.Replace("{{unitUID}}", unitUID); | ||
|
||
var fileName = baseDirectory + "\\" + numberModuleUID + ".yml"; | ||
System.IO.File.AppendAllText(fileName, newContent); | ||
|
||
Console.WriteLine($"Created {fileName}"); | ||
} | ||
} | ||
|
||
static void createMarkdowns(string moduleUID, List<string> unitUIDs, string includesDirectory) | ||
{ | ||
var content = System.IO.File.ReadAllText("c:\\scaffold\\templates\\unit-markdown.txt"); | ||
var introduction = System.IO.File.ReadAllText("c:\\scaffold\\templates\\unit-introduction.txt"); | ||
var summary = System.IO.File.ReadAllText("c:\\scaffold\\templates\\unit-summary.txt"); | ||
|
||
var exercise = System.IO.File.ReadAllText("c:\\scaffold\\templates\\unit-exercise.txt"); | ||
var challenge = System.IO.File.ReadAllText("c:\\scaffold\\templates\\unit-challenge.txt"); | ||
var solution = System.IO.File.ReadAllText("c:\\scaffold\\templates\\unit-solution.txt"); | ||
|
||
var counter = 0; | ||
|
||
foreach (var unitUID in unitUIDs) | ||
{ | ||
counter++; | ||
|
||
if (unitUID == "knowledge-check") continue; | ||
|
||
var numberModuleUID = $"{counter}-{unitUID}"; | ||
|
||
var fileName = includesDirectory + "\\" + numberModuleUID + ".md"; | ||
|
||
if (unitUID == "introduction") | ||
{ | ||
System.IO.File.AppendAllText(fileName, introduction); | ||
} | ||
else if (unitUID == "summary") | ||
{ | ||
System.IO.File.AppendAllText(fileName, summary); | ||
} | ||
else if (unitUID.StartsWith("exercise")) | ||
{ | ||
System.IO.File.AppendAllText(fileName, exercise); | ||
} | ||
else if (unitUID.StartsWith("challenge")) | ||
{ | ||
System.IO.File.AppendAllText(fileName, challenge); | ||
} | ||
else if (unitUID.StartsWith("solution")) | ||
{ | ||
System.IO.File.AppendAllText(fileName, solution); | ||
} | ||
else | ||
{ | ||
System.IO.File.AppendAllText(fileName, content); | ||
} | ||
|
||
Console.WriteLine($"Created {fileName}"); | ||
} | ||
} | ||
|
||
static void createKnowledgeCheck(string moduleUID, List<string> unitUIDs, string baseDirectory, int counter) | ||
{ | ||
var content = System.IO.File.ReadAllText("c:\\scaffold\\templates\\unit-knowledge-check.txt"); | ||
|
||
var myDate = DateTime.Now.ToString("MM/dd/yyyy"); | ||
content = content.Replace("{{date}}", myDate); | ||
|
||
content = content.Replace("{{moduleUID}}", moduleUID); | ||
|
||
var numberModuleUID = $"{counter}-knowledge-check"; | ||
|
||
var fileName = baseDirectory + "\\" + numberModuleUID + ".yml"; | ||
System.IO.File.AppendAllText(fileName, content); | ||
|
||
Console.WriteLine($"Created {fileName}"); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
### YamlMime:Module | ||
uid: learn.languages.{{moduleUID}} | ||
metadata: | ||
title: Setup your C# beginner development environment with Visual Studio 2019 Community Edition | ||
description: Get started learning C# by istalling and configuring the tools you'll need to build real applications. | ||
ms.date: {{date}} | ||
author: bobtabor-msft | ||
ms.author: rotabor | ||
ms.topic: interactive-tutorial | ||
ms.prod: learning-azure | ||
title: Setup your C# beginner development environment with Visual Studio 2019 Community Edition | ||
summary: Get started learning C# by istalling and configuring the tools you'll need to build real applications. | ||
abstract: | | ||
In this module, you will: | ||
- Install and configure Visual Studio 2019 Community Edition | ||
prerequisites: None | ||
ratingEnabled: true | ||
iconUrl: /learn/achievements/{{moduleUID}}.svg | ||
levels: | ||
- beginner | ||
roles: | ||
- developer | ||
products: | ||
- dotnet | ||
units: | ||
{{unitUIDs}} | ||
badge: | ||
uid: learn.languages.{{moduleUID}}.badge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
| ||
|
||
Open Pull Requests | ||
https://github.com/MicrosoftDocs/learn-pr/pulls/bobtabor-msft | ||
|
||
QA Checklist | ||
https://microsoft.sharepoint.com/teams/APEXLearningCoreAzure/Shared%20Documents/Forms/AllItems.aspx?id=%2Fteams%2FAPEXLearningCoreAzure%2FShared%20Documents%2FGeneral%2FChecklists%2Fqa%2Dchecklist%2Emd&parent=%2Fteams%2FAPEXLearningCoreAzure%2FShared%20Documents%2FGeneral%2FChecklists | ||
|
||
Pre-pub Checklist | ||
https://microsoft.sharepoint.com/teams/APEXLearningCoreAzure/Shared%20Documents/Forms/AllItems.aspx?id=%2Fteams%2FAPEXLearningCoreAzure%2FShared%20Documents%2FGeneral%2FChecklists%2Fpre%2Dpub%2Dchecklist%2Emd&parent=%2Fteams%2FAPEXLearningCoreAzure%2FShared%20Documents%2FGeneral%2FChecklists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Update="index.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="reference.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="unit-introduction.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="unit-knowledge-check.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="unit-exercise.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="unit-challenge.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="unit-solution.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="unit-markdown.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="unit-summary.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="unit-yaml-interactive.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="unit-yaml.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This is an introduction paragraph. | ||
|
||
## This is the first heading | ||
|
||
This explains the purpose of this section. | ||
|
||
### Step 1 - Do the first thing | ||
|
||
Instructions for the first thing go here. | ||
|
||
### Step 2 - Do the second thing | ||
|
||
Instructions for the second thing go here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This is an introduction paragraph. | ||
|
||
## This is the first heading | ||
|
||
This explains the purpose of this section. | ||
|
||
### Step 1 - Do the first thing | ||
|
||
Instructions for the first thing go here. | ||
|
||
### Step 2 - Do the second thing | ||
|
||
Instructions for the second thing go here. |
Oops, something went wrong.