-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from qiuhaotc/SupportMultiCodeIndexes
Initialize the multi code indexes project
- Loading branch information
Showing
15 changed files
with
224 additions
and
88 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 |
---|---|---|
@@ -1,17 +1,29 @@ | ||
name: .NET Core | ||
|
||
on: [push] | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/checkout@v2 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 3.1.100 | ||
- name: Build with dotnet | ||
run: dotnet build src/CodeIndex.sln --configuration Release | ||
dotnet-version: 3.1.101 | ||
- name: Install dependencies | ||
run: | | ||
cd src | ||
dotnet restore | ||
- name: Build CodeIndex | ||
run: dotnet build src/CodeIndex.sln --configuration Release --no-restore | ||
- name: Test CodeIndex | ||
run: | | ||
cd src | ||
dotnet test --no-restore --verbosity normal |
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,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace CodeIndex.Common | ||
{ | ||
public class IndexConfig | ||
{ | ||
public Guid Pk { get; set; } | ||
public string IndexName { get; set; } | ||
public string MonitorFolder { get; set; } | ||
public IEnumerable<string> IncludedExtensions { get; set; } | ||
public IEnumerable<string> ExcludedExtensions { get; set; } | ||
public int MaxContentHighlightLength { get; set; } | ||
public IEnumerable<string> ExcludedPaths { get; set; } | ||
public int SaveIntervalSeconds { get; set; } | ||
public string OpenIDEUriFormat { get; set; } | ||
public string MonitorFolderRealPath { get; set; } | ||
public DateTime IndexCreatedDate { get; set; } | ||
public DateTime IndexLastUpdatedDate { get; set; } | ||
} | ||
} |
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 @@ | ||
namespace CodeIndex.Common | ||
{ | ||
public enum IndexStatus | ||
{ | ||
Created, | ||
Initializing, | ||
Monitoring, | ||
Deleting | ||
} | ||
} |
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,15 @@ | ||
namespace CodeIndex.Common | ||
{ | ||
public class IndexStatusInfo | ||
{ | ||
public IndexStatusInfo(IndexStatus indexStatus, IndexConfig indexConfig) | ||
{ | ||
indexConfig.RequireNotNull(nameof(indexConfig)); | ||
IndexStatus = indexStatus; | ||
IndexConfig = indexConfig; | ||
} | ||
|
||
public IndexStatus IndexStatus { get; set; } | ||
public IndexConfig IndexConfig { get; } | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,18 +1,12 @@ | ||
using System.Linq; | ||
using CodeIndex.Common; | ||
|
||
namespace CodeIndex.Files | ||
{ | ||
public static class FilePathHelper | ||
public static class FilePathHelper | ||
{ | ||
public static string[] GetPaths(string[] paths, bool isInLinux) | ||
{ | ||
if (isInLinux) | ||
{ | ||
return paths?.Select(u => u.ToUpperInvariant().Replace('\\', '/')).ToArray(); | ||
} | ||
|
||
return paths?.Select(u => u.ToUpperInvariant().Replace('/', '\\')).ToArray(); | ||
return isInLinux ? paths?.Select(u => u.ToUpperInvariant().Replace('\\', '/')).ToArray() : paths?.Select(u => u.ToUpperInvariant().Replace('/', '\\')).ToArray(); | ||
} | ||
} | ||
} |
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,11 @@ | ||
@page "/IndexManagement" | ||
|
||
<div class="row"> | ||
<div class="col-sm"> | ||
<h3>Index Management</h3> | ||
</div> | ||
</div> | ||
|
||
@code { | ||
|
||
} |
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
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
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
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,43 @@ | ||
using CodeIndex.Common; | ||
using NUnit.Framework; | ||
using System; | ||
|
||
namespace CodeIndex.Test | ||
{ | ||
class IndexConfigTest | ||
{ | ||
[Test] | ||
public void TestConstructor() | ||
{ | ||
var pk = Guid.NewGuid(); | ||
var config = new IndexConfig | ||
{ | ||
ExcludedExtensions = new[] { "A" }, | ||
ExcludedPaths = new[] { "B" }, | ||
IncludedExtensions = new[] { "C" }, | ||
IndexCreatedDate = new DateTime(2020, 1, 1), | ||
IndexLastUpdatedDate = new DateTime(2020, 1, 2), | ||
IndexName = "ABC", | ||
MaxContentHighlightLength = 100, | ||
MonitorFolder = "BCA", | ||
MonitorFolderRealPath = "AAA", | ||
OpenIDEUriFormat = "BBB", | ||
Pk = pk, | ||
SaveIntervalSeconds = 10 | ||
}; | ||
|
||
CollectionAssert.AreEquivalent(config.ExcludedExtensions, new[] { "A" }); | ||
CollectionAssert.AreEquivalent(config.ExcludedPaths, new[] { "B" }); | ||
CollectionAssert.AreEquivalent(config.IncludedExtensions, new[] { "C" }); | ||
Assert.AreEqual(new DateTime(2020, 1, 1), config.IndexCreatedDate); | ||
Assert.AreEqual(new DateTime(2020, 1, 2), config.IndexLastUpdatedDate); | ||
Assert.AreEqual("ABC", config.IndexName); | ||
Assert.AreEqual(100, config.MaxContentHighlightLength); | ||
Assert.AreEqual("BCA", config.MonitorFolder); | ||
Assert.AreEqual("AAA", config.MonitorFolderRealPath); | ||
Assert.AreEqual("BBB", config.OpenIDEUriFormat); | ||
Assert.AreEqual(pk, config.Pk); | ||
Assert.AreEqual(10, config.SaveIntervalSeconds); | ||
} | ||
} | ||
} |
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,18 @@ | ||
using CodeIndex.Common; | ||
using NUnit.Framework; | ||
using System; | ||
|
||
namespace CodeIndex.Test | ||
{ | ||
class IndexStatusInfoTest | ||
{ | ||
[Test] | ||
public void TestConstructor() | ||
{ | ||
var statusInfo = new IndexStatusInfo(IndexStatus.Initializing, new IndexConfig()); | ||
Assert.IsNotNull(statusInfo.IndexConfig); | ||
Assert.AreEqual(IndexStatus.Initializing, statusInfo.IndexStatus); | ||
Assert.Throws<ArgumentException>(() => _ = new IndexStatusInfo(default, null)); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.