Git clone fixed
This commit is contained in:
@ -57,6 +57,7 @@ namespace Yavsc.Migrations
|
|||||||
migrationBuilder.DropForeignKey(name: "FK_Project_ApplicationUser_ClientId", table: "Project");
|
migrationBuilder.DropForeignKey(name: "FK_Project_ApplicationUser_ClientId", table: "Project");
|
||||||
migrationBuilder.DropForeignKey(name: "FK_Project_PerformerProfile_PerformerId", table: "Project");
|
migrationBuilder.DropForeignKey(name: "FK_Project_PerformerProfile_PerformerId", table: "Project");
|
||||||
migrationBuilder.DropForeignKey(name: "FK_ProjectBuildConfiguration_Project_ProjectId", table: "ProjectBuildConfiguration");
|
migrationBuilder.DropForeignKey(name: "FK_ProjectBuildConfiguration_Project_ProjectId", table: "ProjectBuildConfiguration");
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "GitRepositoryReference",
|
name: "GitRepositoryReference",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
|
@ -13,6 +13,7 @@ namespace Yavsc.Lib
|
|||||||
public class GitClone : Batch<Project>
|
public class GitClone : Batch<Project>
|
||||||
{
|
{
|
||||||
string _repositoryRootPath;
|
string _repositoryRootPath;
|
||||||
|
string gitPath="git";
|
||||||
|
|
||||||
public GitClone(string repoRoot)
|
public GitClone(string repoRoot)
|
||||||
{
|
{
|
||||||
@ -28,10 +29,10 @@ namespace Yavsc.Lib
|
|||||||
// Model annotations => input.Repository!=null => input.Name == input.Repository.Path
|
// Model annotations => input.Repository!=null => input.Name == input.Repository.Path
|
||||||
var prjPath = Path.Combine(WorkingDir, input.Name);
|
var prjPath = Path.Combine(WorkingDir, input.Name);
|
||||||
var repoInfo = new DirectoryInfo(prjPath);
|
var repoInfo = new DirectoryInfo(prjPath);
|
||||||
var gitCmd = repoInfo.Exists ? "pull" : "clone";
|
var gitCmd = repoInfo.Exists ? "pull" : "clone --depth=1";
|
||||||
|
|
||||||
var cloneStart = new ProcessStartInfo
|
var cloneStart = new ProcessStartInfo
|
||||||
( gitCmd, $"{gitCmd} {input.Repository.Url} {input.Repository.Path}" )
|
( gitPath, $"{gitCmd} {input.Repository.Url} {input.Repository.Path}" )
|
||||||
{
|
{
|
||||||
WorkingDirectory = WorkingDir,
|
WorkingDirectory = WorkingDir,
|
||||||
RedirectStandardOutput = true,
|
RedirectStandardOutput = true,
|
||||||
@ -52,7 +53,7 @@ namespace Yavsc.Lib
|
|||||||
writer.WriteLine(process.StandardOutput.ReadLine());
|
writer.WriteLine(process.StandardOutput.ReadLine());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ResultHandler(true);
|
if (ResultHandler!=null) ResultHandler(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,17 +23,17 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"userSecretsId": "aspnet5-YavscWeb-a0dadd21-2ced-43d3-96f9-7e504345102f",
|
"userSecretsId": "aspnet5-YavscWeb-a0dadd21-2ced-43d3-96f9-7e504345102f",
|
||||||
"buildOptions": {
|
|
||||||
"debugType": "full",
|
|
||||||
"emitEntryPoint": true,
|
|
||||||
"outputName": "Yavsc",
|
|
||||||
"compile": {
|
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"wwwroot",
|
"wwwroot",
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"bower_components",
|
"bower_components",
|
||||||
"contrib"
|
"contrib"
|
||||||
],
|
],
|
||||||
|
"buildOptions": {
|
||||||
|
"debugType": "full",
|
||||||
|
"emitEntryPoint": true,
|
||||||
|
"outputName": "Yavsc",
|
||||||
|
"compile": {
|
||||||
"include": "*.cs"
|
"include": "*.cs"
|
||||||
},
|
},
|
||||||
"embed": [
|
"embed": [
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
"Banner": "/images/yavsc.png",
|
"Banner": "/images/yavsc.png",
|
||||||
"HomeViewName": "Home",
|
"HomeViewName": "Home",
|
||||||
"FavIcon": "/favicon.ico",
|
"FavIcon": "/favicon.ico",
|
||||||
"Icon": "/images/yavsc.png"
|
"Icon": "/images/yavsc.png",
|
||||||
|
"GitRepository": "testingrepo"
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"IncludeScopes": true,
|
"IncludeScopes": true,
|
||||||
|
6
test/package-lock.json
generated
6
test/package-lock.json
generated
@ -3,9 +3,9 @@
|
|||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-to-html": {
|
"ansi-to-html": {
|
||||||
"version": "0.6.4",
|
"version": "0.6.6",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-to-html/-/ansi-to-html-0.6.4.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-to-html/-/ansi-to-html-0.6.6.tgz",
|
||||||
"integrity": "sha512-XuUGfj3zOAg3/NCU7Oyf9PaCyFuDVj8dzMqezMycPxo5U52atXt+R4L/zW7ETNA2GTjyj/KGBVEFI8sgPWUu2w==",
|
"integrity": "sha512-90M/2sZna3OsoOEbSyXK46poFnlClBC53Rx6etNKQK7iShsX5fI5E/M9Ld6FurtLaxAWLuAPi0Jp8p3y5oAkxg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"entities": "1.1.1"
|
"entities": "1.1.1"
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,13 @@
|
|||||||
"Chat"
|
"Chat"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"exclude": [
|
||||||
|
"testingrepo",
|
||||||
|
"wwwroot",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"contrib"
|
||||||
|
],
|
||||||
"tooling": {
|
"tooling": {
|
||||||
"defaultNamespace": "test"
|
"defaultNamespace": "test"
|
||||||
},
|
},
|
||||||
|
@ -12,7 +12,7 @@ namespace test
|
|||||||
[Fact]
|
[Fact]
|
||||||
void TestNodeJsForAnsitohtml ()
|
void TestNodeJsForAnsitohtml ()
|
||||||
{
|
{
|
||||||
var procStart = new ProcessStartInfo("nodejs", "node_modules/ansi-to-html/bin/ansi-to-html");
|
var procStart = new ProcessStartInfo("node", "node_modules/ansi-to-html/bin/ansi-to-html");
|
||||||
procStart.UseShellExecute = false;
|
procStart.UseShellExecute = false;
|
||||||
procStart.RedirectStandardInput = true;
|
procStart.RedirectStandardInput = true;
|
||||||
procStart.RedirectStandardOutput = true;
|
procStart.RedirectStandardOutput = true;
|
||||||
@ -37,6 +37,7 @@ namespace test
|
|||||||
var encoded = GetStream(proc.StandardOutput);
|
var encoded = GetStream(proc.StandardOutput);
|
||||||
var reader = new StreamReader(encoded);
|
var reader = new StreamReader(encoded);
|
||||||
var txt = reader.ReadToEnd();
|
var txt = reader.ReadToEnd();
|
||||||
|
|
||||||
Console.WriteLine(txt);
|
Console.WriteLine(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Builder;
|
||||||
using Microsoft.AspNet.Builder.Internal;
|
using Microsoft.AspNet.Builder.Internal;
|
||||||
|
using Microsoft.Data.Entity;
|
||||||
using Microsoft.Dnx.Compilation.CSharp;
|
using Microsoft.Dnx.Compilation.CSharp;
|
||||||
using Microsoft.Dnx.Runtime;
|
using Microsoft.Dnx.Runtime;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
@ -39,7 +40,7 @@ namespace test
|
|||||||
|
|
||||||
var dbc = _serverFixture._app.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;
|
var dbc = _serverFixture._app.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;
|
||||||
|
|
||||||
var firstProject = dbc.Projects.FirstOrDefault();
|
var firstProject = dbc.Projects.Include(p=>p.Repository).FirstOrDefault();
|
||||||
Assert.NotNull (firstProject);
|
Assert.NotNull (firstProject);
|
||||||
|
|
||||||
var clone = new GitClone(_serverFixture._siteSetup.GitRepository);
|
var clone = new GitClone(_serverFixture._siteSetup.GitRepository);
|
||||||
|
Reference in New Issue
Block a user