Skip to content
Permalink
Browse files

CR feedback

  • Loading branch information...
rchande committed Jun 7, 2019
1 parent dff17b2 commit 609ca60e93a62aaeccda2c2b8c02c4eb7b93b092
@@ -15,7 +15,7 @@ namespace MLS.PackageTool
{
public class PackageToolConstants
{
public const string LocateBuildAsset = "locate-build-asset";
public const string LocateProjectAsset = "locate-project-asset";
public const string LocateWasmAsset = "locate-wasm-asset";
public const string PreparePackage = "prepare-package";
}
@@ -116,7 +116,7 @@ public class CommandLineParser

Command LocateBuildAsset()
{
return new Command(PackageToolConstants.LocateBuildAsset)
return new Command(PackageToolConstants.LocateProjectAsset)
{
Handler = CommandHandler.Create(getBuildAsset)
};
@@ -22,7 +22,7 @@ public CommandLineParserTests(ITestOutputHelper output)
{
_output = output;
_parser = CommandLineParser.Create(
getBuildAsset: (_) => { _command = PackageToolConstants.LocateBuildAsset; },
getBuildAsset: (_) => { _command = PackageToolConstants.LocateProjectAsset; },
getWasmAsset: (_) => { _command = PackageToolConstants.LocateWasmAsset; },
prepare: (_) => {
_command = "prepare-package";
@@ -33,8 +33,8 @@ public CommandLineParserTests(ITestOutputHelper output)
[Fact]
public async Task Parse_locate_build_locates_build()
{
await _parser.InvokeAsync(PackageToolConstants.LocateBuildAsset, _console);
_command.Should().Be(PackageToolConstants.LocateBuildAsset);
await _parser.InvokeAsync(PackageToolConstants.LocateProjectAsset, _console);
_command.Should().Be(PackageToolConstants.LocateProjectAsset);
}

[Fact]
@@ -95,7 +95,7 @@ private string RemoveTrailingSlash(string path)
// dotnet tool install doesn't like it if directory arguments end with "/"
if (path.EndsWith("\\"))
{
return path.Substring(0, path.Length - 2);
return path.Substring(0, path.Length - 1);
}

return path;
@@ -38,11 +38,11 @@ async Task<TPackage> IPackageFinder.Find<TPackage>(PackageDescriptor descriptor)
protected async Task<IPackage> CreatePackage(PackageDescriptor descriptor, PackageTool tool)
{
await tool.Prepare();
var buildAsset = await tool.LocateProjectAsset();
if (buildAsset != null)
var projectAsset = await tool.LocateProjectAsset();
if (projectAsset != null)
{
var package = new Package2(descriptor.Name, tool.DirectoryAccessor);
package.Add(buildAsset);
package.Add(projectAsset);

var wasmAsset = await tool.LocateWasmAsset();
if (wasmAsset != null)
@@ -30,7 +30,7 @@ public PackageTool(string name, IDirectoryAccessor directoryAccessor)

public async Task<ProjectAsset> LocateProjectAsset()
{
var result = await CommandLine.Execute(_path.Value, MLS.PackageTool.PackageToolConstants.LocateBuildAsset, DirectoryAccessor.GetFullyQualifiedRoot());
var result = await CommandLine.Execute(_path.Value, MLS.PackageTool.PackageToolConstants.LocateProjectAsset, DirectoryAccessor.GetFullyQualifiedRoot());
var projectDirectory = new DirectoryInfo(string.Join("", result.Output));
return new ProjectAsset(new FileSystemDirectoryAccessor(projectDirectory));
}

0 comments on commit 609ca60

Please sign in to comment.
You can’t perform that action at this time.