Skip to content

Clu #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 18, 2015
Merged

Clu #260

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions src/CLU/CLUCoreCLR.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.Common", "Commands.Common\Commands.Common.xproj", "{5F567ACA-595E-436D-83DB-A21E08F82DF6}"
EndProject
Expand Down Expand Up @@ -37,7 +37,13 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.CLU.Run", "Micros
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.CLU", "Microsoft.CLU\Microsoft.CLU.xproj", "{D0A59671-088D-463B-B060-2ADAFFB9C3F6}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.CLU.Test", "Microsoft.CLU.Test\Microsoft.CLU.Test.xproj", "{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Compute", "Microsoft.Azure.Commands.Compute\Microsoft.Azure.Commands.Compute.xproj", "{04F9968A-5662-4508-BEE2-31F56848FCBA}"
ProjectSection(ProjectDependencies) = postProject
{99B1290D-A073-4907-8018-51C714431778} = {99B1290D-A073-4907-8018-51C714431778}
{3910613E-4ED2-49E2-8CCF-966D586665AC} = {3910613E-4ED2-49E2-8CCF-966D586665AC}
{81A48E48-89A7-4B93-8207-4F8FA6DC251B} = {81A48E48-89A7-4B93-8207-4F8FA6DC251B}
{45B05B68-516F-4D74-897F-56D12894946C} = {45B05B68-516F-4D74-897F-56D12894946C}
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.Common.ScenarioTest", "Commands.Common.ScenarioTest\Commands.Common.ScenarioTest.xproj", "{B1D3CB1F-C0CA-401F-8146-B2E9C1EF460F}"
EndProject
Expand All @@ -49,7 +55,7 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Co
{04F9968A-5662-4508-BEE2-31F56848FCBA} = {04F9968A-5662-4508-BEE2-31F56848FCBA}
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Compute", "Microsoft.Azure.Commands.Compute\Microsoft.Azure.Commands.Compute.xproj", "{04F9968A-5662-4508-BEE2-31F56848FCBA}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.ScenarioTest.CLU", "Microsoft.ScenarioTests.CLU\Microsoft.ScenarioTest.CLU.xproj", "{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -125,10 +131,10 @@ Global
{D0A59671-088D-463B-B060-2ADAFFB9C3F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0A59671-088D-463B-B060-2ADAFFB9C3F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0A59671-088D-463B-B060-2ADAFFB9C3F6}.Release|Any CPU.Build.0 = Release|Any CPU
{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Release|Any CPU.Build.0 = Release|Any CPU
{04F9968A-5662-4508-BEE2-31F56848FCBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{04F9968A-5662-4508-BEE2-31F56848FCBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{04F9968A-5662-4508-BEE2-31F56848FCBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{04F9968A-5662-4508-BEE2-31F56848FCBA}.Release|Any CPU.Build.0 = Release|Any CPU
{B1D3CB1F-C0CA-401F-8146-B2E9C1EF460F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1D3CB1F-C0CA-401F-8146-B2E9C1EF460F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1D3CB1F-C0CA-401F-8146-B2E9C1EF460F}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -137,10 +143,10 @@ Global
{13C34370-51A4-4726-81B8-BE0996FC9CFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13C34370-51A4-4726-81B8-BE0996FC9CFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13C34370-51A4-4726-81B8-BE0996FC9CFF}.Release|Any CPU.Build.0 = Release|Any CPU
{04F9968A-5662-4508-BEE2-31F56848FCBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{04F9968A-5662-4508-BEE2-31F56848FCBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{04F9968A-5662-4508-BEE2-31F56848FCBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{04F9968A-5662-4508-BEE2-31F56848FCBA}.Release|Any CPU.Build.0 = Release|Any CPU
{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion src/CLU/Microsoft.CLU.Run/PackageManagementMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ private static void GenerateScript(string cfgPath)
" export CmdletSessionID=$PPID",
"fi",
"SCRIPTPATH=$(dirname \"$0\")",
$"$SCRIPTPATH/clurun -s {scriptName} -r $SCRIPTPATH/{Path.GetFileName(cfgPath)} $*"
$"$SCRIPTPATH/clurun -s {scriptName} -r $SCRIPTPATH/{Path.GetFileName(cfgPath)} \"$@\""
});
System.Diagnostics.Process.Start("chmod", $"777 {scriptPath}");
}
Expand Down
4 changes: 0 additions & 4 deletions src/CLU/Microsoft.CLU.Test/Content/package.cfg

This file was deleted.

30 changes: 0 additions & 30 deletions src/CLU/Microsoft.CLU.Test/TestCLU.bat

This file was deleted.

4 changes: 4 additions & 0 deletions src/CLU/Microsoft.ScenarioTests.CLU/Content/package.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Name: Microsoft.ScenarioTests.CLU
CommandAssemblies: Microsoft.ScenarioTests.CLU.dll
NounPrefix: Test
NounFirst: true
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
RtPackage: Microsoft.CLU.Commands
RtEntry: Microsoft.CLU.CommandModel.CmdletCommandModel.Run
RtAssembly: Microsoft.CLU.dll
Modules: Microsoft.CLU.Test
NounPrefix: AzureRm
Modules: Microsoft.ScenarioTests.CLU
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Microsoft.CLU.Test</id>
<id>Microsoft.ScenarioTests.CLU</id>
<title>Microsoft CLU CommandLine test command packge</title>
<version>%PackageVersion%</version>
<authors>Microsoft</authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,18 @@ protected override void ProcessRecord()
WriteObject(new TestRecord() { Name = $"Matched {RecordName}", Value = $"Matched {Value}", SomethingElse = $"Matched {SomethingElse}" });
}
}

[Cmdlet(VerbsCommon.Show, "TestRecordFromParameter")]
public class ShowTestRecordFromParameter : PSCmdlet
{

[Parameter(Mandatory = true, ValueFromPipeline = true)]
[Alias("Rec")]
public TestRecord Record { get; set; }

protected override void ProcessRecord()
{
WriteObject(Record);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.CLU.Test")]
[assembly: AssemblyTitle("Microsoft.ScenarioTests.CLU")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.CLU.Test")]
[assembly: AssemblyProduct("Microsoft.ScenarioTests.CLU")]
[assembly: AssemblyCopyright("Copyright © Microsoft")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down
33 changes: 33 additions & 0 deletions src/CLU/Microsoft.ScenarioTests.CLU/testrunner.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
SETLOCAL EnableExtensions

ECHO Test return code success case
call testclu success show 2> out.error
REM We expect that the commands above succeed (return 0)
IF %ERRORLEVEL% NEQ 0 (
ECHO "Expected error level 0 for success, got " %ERRORLEVEL%
EXIT /B 1
)

ECHO Test return codes non terminating error case
call testclu success show --generatenonterminatingerror true 2> out.error
IF %ERRORLEVEL% NEQ 1 (
ECHO "Expected error level 1 for non-terminating error, got " %ERRORLEVEL%
EXIT /B 1
)

ECHO Test return codes terminating error case
call testclu success show --generateterminatingerror true 2> out.error
IF %ERRORLEVEL% NEQ 2 (
ECHO "Expected error level 2 for terminating error, got " %ERRORLEVEL%
EXIT /B 1
)

ECHO Test pipeline aliasing
call testclu record new | testclu record show > out.txt
IF %ERRORLEVEL% NEQ 0 (
ECHO "Expected error level 0 for success, got " %ERRORLEVEL%
EXIT /B 1
)


ECHO ALL TESTS ARE HAPPY
14 changes: 7 additions & 7 deletions tools/CLU/BuildPackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

if (!(Test-Path $cmdletsDir))
{
throw "cmdletsDir: '$cmdletsDir' must be an existing directory containing cmdlet code"
throw "cmdletsDir: '$cmdletsDir' must be an existing directory containing cmdlet code"
}
if (!(Test-Path $outputDir))
{
throw "outputDir: '$outputDir' must be an existing directory"
throw "outputDir: '$outputDir' must be an existing directory"
}

if ([string]::IsNullOrWhiteSpace($env:WORKSPACE) -or !(Test-Path $env:WORKSPACE))
{
throw "env:WORKSPACE: '$env:WORKSPACE' must be an existing directory"
throw "env:WORKSPACE: '$env:WORKSPACE' must be an existing directory"
}

$packageSource = $packageSource.TrimEnd('\\')
Expand All @@ -34,19 +34,19 @@ $contentFileText = ""
$contentFiles | %{ $contentFileText += (" <file src=""" + $_.Name + """ target=""content""/>`r`n")}
if ($packageId -ne "Microsoft.CLU.Commands")
{
$contentFileText += " <file src=""content\azure.lx"" target=""content""/>`r`n"
$contentFileText += " <file src=""content\*.lx"" target=""content""/>`r`n"
}
if ($renameFileExists)
{
$contentFileText += " <file src=""content\rename.cfg"" target=""content""/>`r`n"
$contentFileText += " <file src=""content\rename.cfg"" target=""content""/>`r`n"
}
$contentFileText += " <file src=""content\package.cfg"" target=""content""/>`r`n"
$sourceFileText = ""
$refFiles | %{$sourceFileText += (" <file src=""" + $_.Name + """ target=""lib\dnxcore50""/>`r`n")}
$outputContent = $fileContent -replace "%PackageVersion%", $packageVersion
$outputContent = $outputContent -replace "%ReferenceFiles%", $refFileText
$outputContent = $outputContent -replace "%SourceFiles%", $sourceFileText
$outputContent = $outputContent -replace "%ContentFiles%", $contentFileText
$outputContent = $outputContent -replace "%SourceFiles%", $sourceFileText
$outputContent = $outputContent -replace "%ContentFiles%", $contentFileText
Set-Content -Value $outputContent -Path $nuspecOutput

Write-Host "Creating nuget package..."
Expand Down