Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CSE
Pendant
Commits
b40279ea
Commit
b40279ea
authored
Aug 24, 2021
by
Nathan Bean
Browse files
Updated windows service
parent
cb4e58c3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Server/Controllers/GitHubController.cs
View file @
b40279ea
...
...
@@ -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
;
}
...
...
Verifier/AnalysisResult.cs
View file @
b40279ea
...
...
@@ -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
;
}
}
...
...
WindowsService/Helpers/GithubHelper.cs
View file @
b40279ea
...
...
@@ -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
());
...
...
WindowsService/Program.cs
View file @
b40279ea
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");
}
}
...
...
WindowsService/ValidationRequest.cs
0 → 100644
View file @
b40279ea
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
;
}
}
}
WindowsService/WindowsService.csproj
View file @
b40279ea
...
...
@@ -5,4 +5,8 @@
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Verifier\ProgramVerifier.csproj" />
</ItemGroup>
</Project>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment