Commit b40279ea authored by Nathan Bean's avatar Nathan Bean
Browse files

Updated windows service

parent cb4e58c3
......@@ -88,6 +88,9 @@ namespace KSU.CS.Pendant.Server.Controllers
[JsonPropertyName("ref")]
public string Ref { get; set; }
[JsonPropertyName("after")]
public string CommitID { get; set; }
[JsonPropertyName("repository")]
public GitHubRepository Repository { get; set; }
......
......@@ -23,7 +23,18 @@ namespace KSU.CS.ProgramVerifier
{
public bool DoesCompile { get; set; }
public List<string> Issues { get; set; }
public List<string> Issues
{
get
{
var issues = new List<string>();
issues.AddRange(StructuralIssues);
issues.AddRange(FunctionalIssues);
issues.AddRange(DesignIssues.Select(s => s.Message));
issues.AddRange(StyleIssues.Select(s => s.Message));
return issues;
}
}
public List<string> StructuralIssues { get; set; } = new List<string>();
......@@ -42,7 +53,6 @@ namespace KSU.CS.ProgramVerifier
public AnalysisResult()
{
Issues = new List<string>();
DoesCompile = true;
}
}
......
......@@ -10,8 +10,10 @@ namespace KSU.CS.Pendant.Server.Helpers
{
public class GithubHelper
{
public static async Task<string> CloneAndCheckout(string repoUrl, string path, string branch)
public static async Task<string> CloneAndCheckout(string repoUrl, string commitID)
{
var path = "C:\\users\\nhbean\\Desktop\\trial";// System.IO.Path.GetTempPath();
var psi = new ProcessStartInfo() {
FileName = "cmd.exe",
UseShellExecute = false,
......@@ -25,9 +27,19 @@ namespace KSU.CS.Pendant.Server.Helpers
if (writer.BaseStream.CanWrite)
{
// Clone the repo (if it doesn't already exist
writer.WriteLine($"git clone {repoUrl} {path}");
// Change into the repo directory
writer.WriteLine($"cd {path}");
writer.WriteLine($"git checkout {branch}");
// Checkout commit
writer.WriteLine($"git checkout {commitID}");
// Create a remote tracking branch (if it doesn't already exist)
//writer.WriteLine($"git checkout -b {branch} origin/{branch}");
// Check out the branch (we must do this if the branch already existed)
//writer.WriteLine($"git checkout {branch}");
//
}
Console.WriteLine(process.StandardOutput.ReadToEnd());
......
using System;
using System.IO;
using KSU.CS.Pendant.Server.Helpers;
using KSU.CS.ProgramVerifier;
namespace WindowsService
{
......@@ -9,7 +10,25 @@ namespace WindowsService
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
GithubHelper.CloneAndCheckout("git@github.com:ksu-cis/webhook-test-zombiepaladin.git", "C:\\Users\\nhbean\\Desktop\\Test", "main");
var validationRequest = new ValidationRequest()
{
RepoURL = "git@github.com:ksu-cis/webhook-test-zombiepaladin.git",
CommitID = "276dfb9315b93b525e0dd3f57eb5c58cf4f9bae8",
SpecificationPath = "C:\\workDirectory\\specifications\\v3mdy40k.xak\\ms1"
};
var path = GithubHelper.CloneAndCheckout(validationRequest.RepoURL, validationRequest.CommitID).GetAwaiter().GetResult();
Console.WriteLine(path);
var results = Verifier.Check(path, validationRequest.SpecificationPath).GetAwaiter().GetResult();
foreach(string issue in results.Issues)
{
Console.WriteLine(issue);
}
//LibGit2Sharp.Repository.Clone("git@github.com:ksu-cis/webhook-test-zombiepaladin.git", "C:\\Users\\nhbean\\Desktop\\Test");
}
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WindowsService
{
public class ValidationRequest
{
public string RepoURL { get; set; }
public string CommitID { get; set; }
public string SpecificationPath { get; set; }
}
}
......@@ -5,4 +5,8 @@
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Verifier\ProgramVerifier.csproj" />
</ItemGroup>
</Project>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment