Commit 5629cc60 authored by Prenshaw, David G's avatar Prenshaw, David G
Browse files

Moving artifact path and general cleanup.

parent e53cfabf
Loading
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+6 −0
Original line number Diff line number Diff line
# Build results
[Bb]in/
[Oo]bj/

# Visual Studio 2015/2017 cache/options directory
.vs/
+2 −2
Original line number Diff line number Diff line
@@ -15,6 +15,6 @@ release:
    - master
  artifacts:
    paths:
      - artifacts/MustachioTemplatePreviewer
      - MustachioTemplatePreviewer
  script:
    - dotnet publish MustachioTemplatePreviewer -c Release -o  ../artifacts/MustachioTemplatePreviewer
 No newline at end of file
    - dotnet publish MustachioTemplatePreviewer -c Release -o  ../MustachioTemplatePreviewer
 No newline at end of file
+2 −57
Original line number Diff line number Diff line
//using Newtonsoft.Json.Converters;
//using System;
//using System.Collections.Generic;
//using System.Dynamic;
//using System.Text.RegularExpressions;

//namespace TemplatePreviewer
//{
//    class Program
//    {
//        static void Main(string[] args)
//        {
//            string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
//            Regex appPathMatcher = new Regex(@"(?<!fil)[A-Za-z]:\\+[\S\s]*?(?=\\+TemplatePreviewer)");
//            string repoPath = appPathMatcher.Match(path).ToString();

//            string templateDirectory = repoPath + "/dist";
//            string payloadDirectory = repoPath + "/src/payloads";
//            string previewsDirectory = repoPath + "/previews";

//            Dictionary<string, string> templates = new Dictionary<string, string>();
//            Dictionary<string, string> payloads = new Dictionary<string, string>();

//            foreach (string s in System.IO.Directory.GetFiles(templateDirectory))
//            {
//                System.IO.FileInfo fi = new System.IO.FileInfo(s);
//                templates.Add(fi.Name, System.IO.File.ReadAllText(fi.FullName));
//            }

//            foreach (string s in System.IO.Directory.GetFiles(payloadDirectory))
//            {
//                System.IO.FileInfo fi = new System.IO.FileInfo(s);
//                payloads.Add(fi.Name, System.IO.File.ReadAllText(fi.FullName));
//            }

//            System.IO.Directory.CreateDirectory(previewsDirectory);

//            foreach (KeyValuePair<string, string> template in templates)
//            {
//                var expConverter = new ExpandoObjectConverter();
//                var parsedTemplate = Mustachio.Parser.Parse(template.Value);
//                var preview = template.Value;
//                if (payloads.ContainsKey(System.IO.Path.GetFileNameWithoutExtension(template.Key) + ".json"))
//                {
//                    dynamic templateModel = Newtonsoft.Json.JsonConvert.DeserializeObject<ExpandoObject>(payloads[System.IO.Path.GetFileNameWithoutExtension(template.Key) + ".json"], expConverter);
//                    preview = parsedTemplate(templateModel);
//                }

//                System.IO.File.WriteAllText(previewsDirectory + "/" + template.Key, preview);
//            }
//        }
//    }
//}


using CommandLine;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Dynamic;
using CommandLine;
using Newtonsoft.Json.Converters;

namespace MustachioTemplatePreviewer
{