From 7ece2f3603b599f948a2803145182417a0627cfd Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Wed, 20 May 2015 20:31:43 -0700 Subject: [PATCH 1/8] started Paket.PowerShell --- .gitignore | 1 + Paket.sln | 9 +++ src/Paket.PowerShell/Paket.PowerShell.fsproj | 76 ++++++++++++++++++ src/Paket.PowerShell/Paket.PowerShell.psd1 | Bin 0 -> 5280 bytes src/Paket.PowerShell/PowerShell.fs | 18 +++++ .../System.Management.Automation.ps1 | 2 + src/Paket.PowerShell/init.ps1 | 0 src/Paket/Paket.fsproj | 4 +- 8 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 src/Paket.PowerShell/Paket.PowerShell.fsproj create mode 100644 src/Paket.PowerShell/Paket.PowerShell.psd1 create mode 100644 src/Paket.PowerShell/PowerShell.fs create mode 100644 src/Paket.PowerShell/System.Management.Automation.ps1 create mode 100644 src/Paket.PowerShell/init.ps1 diff --git a/.gitignore b/.gitignore index 05f76d7eeb..d8ebc30178 100644 --- a/.gitignore +++ b/.gitignore @@ -199,3 +199,4 @@ docs/content/paket-restore.md docs/content/paket-simplify.md docs/content/paket-convert-from-nuget.md *.bak +System.Management.Automation.dll \ No newline at end of file diff --git a/Paket.sln b/Paket.sln index 95ccd48dae..44e6314fc9 100644 --- a/Paket.sln +++ b/Paket.sln @@ -49,6 +49,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paket.Bootstrapper", "src\P EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Paket.Core", "src\Paket.Core\Paket.Core.fsproj", "{7BAB0AE2-089F-4761-B138-A717AA2F86C5}" EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Paket.PowerShell", "src\Paket.PowerShell\Paket.PowerShell.fsproj", "{1F1581C1-6416-470E-BC48-92C6D4AAC785}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -71,6 +73,10 @@ Global {7BAB0AE2-089F-4761-B138-A717AA2F86C5}.Debug|Any CPU.Build.0 = Debug|Any CPU {7BAB0AE2-089F-4761-B138-A717AA2F86C5}.Release|Any CPU.ActiveCfg = Release|Any CPU {7BAB0AE2-089F-4761-B138-A717AA2F86C5}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1581C1-6416-470E-BC48-92C6D4AAC785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1581C1-6416-470E-BC48-92C6D4AAC785}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1581C1-6416-470E-BC48-92C6D4AAC785}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1581C1-6416-470E-BC48-92C6D4AAC785}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -80,4 +86,7 @@ Global {8E6D5255-776D-4B61-85F9-73C37AA1FB9A} = {A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1} {E789C72A-5CFD-436B-8EF1-61AA2852A89F} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4} EndGlobalSection + GlobalSection(Performance) = preSolution + HasPerformanceSessions = true + EndGlobalSection EndGlobal diff --git a/src/Paket.PowerShell/Paket.PowerShell.fsproj b/src/Paket.PowerShell/Paket.PowerShell.fsproj new file mode 100644 index 0000000000..cdafdb39d6 --- /dev/null +++ b/src/Paket.PowerShell/Paket.PowerShell.fsproj @@ -0,0 +1,76 @@ + + + + + Debug + AnyCPU + 2.0 + 1f1581c1-6416-470e-bc48-92c6d4aac785 + Library + Paket.PowerShell + Paket.PowerShell + v4.5 + 4.3.1.0 + Paket.PowerShell + + + true + full + false + false + bin\Debug\ + DEBUG;TRACE + 3 + bin\Debug\Paket.PowerShell.XML + + + pdbonly + true + true + bin\Release\ + TRACE + 3 + bin\Release\Paket.PowerShell.XML + + + 11 + + + + + $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets + + + + + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets + + + + + + + + + Always + + + + + + True + + + + + System.Management.Automation.dll + + + + \ No newline at end of file diff --git a/src/Paket.PowerShell/Paket.PowerShell.psd1 b/src/Paket.PowerShell/Paket.PowerShell.psd1 new file mode 100644 index 0000000000000000000000000000000000000000..ee8b37abc5d50278d83487d751bba2b64771b981 GIT binary patch literal 5280 zcmc(jU2hXd6o$`rrT&MNeBn?PLqbBJQYE5~?hTuV*q=0bBVy-Cu{^)!|IMY#5~VpX4w1;WBkwST0Qx&FV`p87&}5%q_lnF~=z z?n3{Wke!9Mh2C|SI3~=_t;}JWmh*ck8}i>?;(TI9qCJx&Zm+4h@r;N3t~-`SPd!-^ z>rOT5hBxRTY9Qf3q8Ij~IbG-7v3<$X*1mmN@`>HIr}jwHo@%tK`;M->+mohuG-^ug z%svTw9_jj6i` z!ut!mp7U5d@!)gGMsyOR?txIi0x4qG+W`K{l$`gLw0lo9VmuXDoEOp*v0aof;N=tX z#z!WG9@_GxTxUmNKE+=2xs9!ED85Z?TFPLG##*SZ>%Gdv5PFI@XNmiMeJc zs=YV$s3Yy4iY~Q#mFnHeL;k_d@{jFs~vx zSc{`NZc_duBcXjN13d^8oDn?()tdT+55+!=4CS>w+U#7pcck^?V9#UZUVL*HtmKu3 ztW17HYrels8>;7FW?e5()9k4*m9t{GTR{$FeJ0J{%R0G(V6Tp_oP{cZ{jQQ3X_~T; z_c5OXcQvAF^m!i|`${C(QpArX%XaXjWJ7$?YY4G|4Y@{Z(LYm{saW-(2`bNBTP*di zW&9V)P9xPnd?UuuI;*``EguIts%8Etd-fNS(`mZD=C+%Mtl~OIe!Q8lMgE_H`8fDD z=OQBL|G{0x@G01rV`();$#(c1IgK3Q@jbjM6Mbs}@7hBa)H6(93wMG=j%ACVc0lW+J9D`?e?Bit) z#VhcBx<(?h`rNZh3+bO{bUd$rv(!BwiZbY^*SA5C)7g~!2YCotz8NxY%(FMs!78my zQE=`61E-AJ=pd)FDfd^wro_KTf@jv7O4#%g+^%o97s`&s5L^d$x@NBpTb$ffiz U9sX6Zo$ZKUJCZg2zU=V+0||{`i2wiq literal 0 HcmV?d00001 diff --git a/src/Paket.PowerShell/PowerShell.fs b/src/Paket.PowerShell/PowerShell.fs new file mode 100644 index 0000000000..b0a07f3088 --- /dev/null +++ b/src/Paket.PowerShell/PowerShell.fs @@ -0,0 +1,18 @@ +namespace Paket.PowerShell + + open System + open System.Management.Automation + open System.ComponentModel + +// [] +// type PowerShell() = +// inherit PSSnapIn() +// override this.Name with get() = "aa" +// override this.Vendor with get() = "bb" +// override this.Description with get() = "dd" + + [] + type WriteHelp() = + inherit Cmdlet() + override this.ProcessRecord() = + base.WriteObject("help"); \ No newline at end of file diff --git a/src/Paket.PowerShell/System.Management.Automation.ps1 b/src/Paket.PowerShell/System.Management.Automation.ps1 new file mode 100644 index 0000000000..73da2647d5 --- /dev/null +++ b/src/Paket.PowerShell/System.Management.Automation.ps1 @@ -0,0 +1,2 @@ +# copies System.Management.Automation.dll from the GAC to this folder +cp ([PSObject].Assembly.Location) . \ No newline at end of file diff --git a/src/Paket.PowerShell/init.ps1 b/src/Paket.PowerShell/init.ps1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj index 3fc9b3bdc9..1f668566d4 100644 --- a/src/Paket/Paket.fsproj +++ b/src/Paket/Paket.fsproj @@ -27,10 +27,10 @@ 3 - update -f + update Project paket.exe - d:\code\Paket09x + C:\projects\SourceLink pdbonly From ecbd155e9777a57434906b915ff15410c22bd9f1 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Sat, 23 May 2015 13:32:37 -0700 Subject: [PATCH 2/8] stubbed out PowerShell commands --- src/Paket.PowerShell/CmdletExt.fs | 19 ++++ src/Paket.PowerShell/Paket.PowerShell.fsproj | 5 +- src/Paket.PowerShell/Paket.PowerShell.psd1 | Bin 5280 -> 0 bytes src/Paket.PowerShell/PowerShell.fs | 93 +++++++++++++++---- src/Paket.PowerShell/init.ps1 | 3 + src/Paket.PowerShell/paket.template | 11 +++ 6 files changed, 112 insertions(+), 19 deletions(-) create mode 100644 src/Paket.PowerShell/CmdletExt.fs delete mode 100644 src/Paket.PowerShell/Paket.PowerShell.psd1 create mode 100644 src/Paket.PowerShell/paket.template diff --git a/src/Paket.PowerShell/CmdletExt.fs b/src/Paket.PowerShell/CmdletExt.fs new file mode 100644 index 0000000000..030cf485e7 --- /dev/null +++ b/src/Paket.PowerShell/CmdletExt.fs @@ -0,0 +1,19 @@ +[] +module Paket.PowerShell.CmdletExt + +open System.Management.Automation + +// add F# printf write extensions +type Cmdlet with + + member x.WritefCommandDetail format = + Printf.ksprintf (fun s -> x.WriteCommandDetail s |> ignore) format + + member x.WritefDebug format = + Printf.ksprintf (fun s -> x.WriteDebug s |> ignore) format + + member x.WritefVebose format = + Printf.ksprintf (fun s -> x.WriteVerbose s |> ignore) format + + member x.WritefWarning format = + Printf.ksprintf (fun s -> x.WriteWarning s |> ignore) format \ No newline at end of file diff --git a/src/Paket.PowerShell/Paket.PowerShell.fsproj b/src/Paket.PowerShell/Paket.PowerShell.fsproj index cdafdb39d6..7eadde7f21 100644 --- a/src/Paket.PowerShell/Paket.PowerShell.fsproj +++ b/src/Paket.PowerShell/Paket.PowerShell.fsproj @@ -49,11 +49,10 @@ + - - Always - + diff --git a/src/Paket.PowerShell/Paket.PowerShell.psd1 b/src/Paket.PowerShell/Paket.PowerShell.psd1 deleted file mode 100644 index ee8b37abc5d50278d83487d751bba2b64771b981..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5280 zcmc(jU2hXd6o$`rrT&MNeBn?PLqbBJQYE5~?hTuV*q=0bBVy-Cu{^)!|IMY#5~VpX4w1;WBkwST0Qx&FV`p87&}5%q_lnF~=z z?n3{Wke!9Mh2C|SI3~=_t;}JWmh*ck8}i>?;(TI9qCJx&Zm+4h@r;N3t~-`SPd!-^ z>rOT5hBxRTY9Qf3q8Ij~IbG-7v3<$X*1mmN@`>HIr}jwHo@%tK`;M->+mohuG-^ug z%svTw9_jj6i` z!ut!mp7U5d@!)gGMsyOR?txIi0x4qG+W`K{l$`gLw0lo9VmuXDoEOp*v0aof;N=tX z#z!WG9@_GxTxUmNKE+=2xs9!ED85Z?TFPLG##*SZ>%Gdv5PFI@XNmiMeJc zs=YV$s3Yy4iY~Q#mFnHeL;k_d@{jFs~vx zSc{`NZc_duBcXjN13d^8oDn?()tdT+55+!=4CS>w+U#7pcck^?V9#UZUVL*HtmKu3 ztW17HYrels8>;7FW?e5()9k4*m9t{GTR{$FeJ0J{%R0G(V6Tp_oP{cZ{jQQ3X_~T; z_c5OXcQvAF^m!i|`${C(QpArX%XaXjWJ7$?YY4G|4Y@{Z(LYm{saW-(2`bNBTP*di zW&9V)P9xPnd?UuuI;*``EguIts%8Etd-fNS(`mZD=C+%Mtl~OIe!Q8lMgE_H`8fDD z=OQBL|G{0x@G01rV`();$#(c1IgK3Q@jbjM6Mbs}@7hBa)H6(93wMG=j%ACVc0lW+J9D`?e?Bit) z#VhcBx<(?h`rNZh3+bO{bUd$rv(!BwiZbY^*SA5C)7g~!2YCotz8NxY%(FMs!78my zQE=`61E-AJ=pd)FDfd^wro_KTf@jv7O4#%g+^%o97s`&s5L^d$x@NBpTb$ffiz U9sX6Zo$ZKUJCZg2zU=V+0||{`i2wiq diff --git a/src/Paket.PowerShell/PowerShell.fs b/src/Paket.PowerShell/PowerShell.fs index b0a07f3088..7da54463a0 100644 --- a/src/Paket.PowerShell/PowerShell.fs +++ b/src/Paket.PowerShell/PowerShell.fs @@ -1,18 +1,79 @@ namespace Paket.PowerShell - open System - open System.Management.Automation - open System.ComponentModel - -// [] -// type PowerShell() = -// inherit PSSnapIn() -// override this.Name with get() = "aa" -// override this.Vendor with get() = "bb" -// override this.Description with get() = "dd" - - [] - type WriteHelp() = - inherit Cmdlet() - override this.ProcessRecord() = - base.WriteObject("help"); \ No newline at end of file +open System.Management.Automation + +[] +type Add() = + inherit Cmdlet() + + [] member val NuGet = "" with get, set + [] member val Version = "" with get, set + [] member val Project = "" with get, set + [] member val Force = SwitchParameter() with get, set + [] member val Interactive = SwitchParameter() with get, set + [] member val Hard = SwitchParameter() with get, set + [] member val NoInstall = SwitchParameter() with get, set + + override x.ProcessRecord() = + x.WritefWarning "need this implement Add-Paket, nuget: %s" x.NuGet + () + +[] +type AutoRestoreCmdlet() = + inherit Cmdlet() + +[] +type ConfigCmdlet() = + inherit Cmdlet() + +[] +type ConvertFromNuGetCmdlet() = + inherit Cmdlet() + +[] +type FindRefsCmdlet() = + inherit Cmdlet() + +[] +type FindPackagesCmdlet() = + inherit Cmdlet() + +[] +type FindPackageVersionsCmdlet() = + inherit Cmdlet() + +[] +type InitCmdlet() = + inherit Cmdlet() + +[] +type InstallCmdlet() = + inherit Cmdlet() + +[] +type OutdatedCmdlet() = + inherit Cmdlet() + +[] +type PushCmdlet() = + inherit Cmdlet() + +[] +type RemoveCmdlet() = + inherit Cmdlet() + +[] +type RestoreCmdlet() = + inherit Cmdlet() + +[] +type SimplifyCmdlet() = + inherit Cmdlet() + +[] +type ShowInstalledPackagesCmdlet() = + inherit Cmdlet() + +[] +type UpdateCmdlet() = + inherit Cmdlet() \ No newline at end of file diff --git a/src/Paket.PowerShell/init.ps1 b/src/Paket.PowerShell/init.ps1 index e69de29bb2..77482f21c1 100644 --- a/src/Paket.PowerShell/init.ps1 +++ b/src/Paket.PowerShell/init.ps1 @@ -0,0 +1,3 @@ +param($installPath, $toolsPath, $package) +Import-Module (Join-Path $toolsPath Paket.PowerShell.dll) -WarningAction SilentlyContinue +# Paket-Restore here so that packages get restored when Visual Studio opens the solution \ No newline at end of file diff --git a/src/Paket.PowerShell/paket.template b/src/Paket.PowerShell/paket.template new file mode 100644 index 0000000000..bdadcade8d --- /dev/null +++ b/src/Paket.PowerShell/paket.template @@ -0,0 +1,11 @@ +type file +id Paket.PowerShell +authors Paket +projectUrl http://fsprojects.github.io/Paket/ +licenseUrl http://fsprojects.github.io/Paket/license.html +description + PowerShell for Paket +files + bin\Release\*.dll ==> tools + bin\Release\*.pdb ==> tools + init.ps1 ==> tools \ No newline at end of file From 8441971a8dccdcdd76575dc5ec0454d630a44660 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Wed, 27 May 2015 01:13:28 -0700 Subject: [PATCH 3/8] added Paket.PowerShell to the Paket nupkg --- Paket.PowerShell.sln | 27 ++++++++++++++++++++ Paket.sln | 15 +++++------ build.fsx | 18 +++++++++++++ nuget/paket.template | 2 ++ src/Paket.PowerShell/Paket.PowerShell.fsproj | 13 +++++++--- src/Paket.PowerShell/PowerShell.fs | 12 +++++++++ src/Paket.PowerShell/paket.template | 11 -------- 7 files changed, 75 insertions(+), 23 deletions(-) create mode 100644 Paket.PowerShell.sln delete mode 100644 src/Paket.PowerShell/paket.template diff --git a/Paket.PowerShell.sln b/Paket.PowerShell.sln new file mode 100644 index 0000000000..e6d87be8e0 --- /dev/null +++ b/Paket.PowerShell.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.22823.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{BF60BC93-E09B-4E5F-9D85-95A519479D54}" + ProjectSection(SolutionItems) = preProject + build.cmd = build.cmd + build.fsx = build.fsx + EndProjectSection +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Paket.PowerShell", "src\Paket.PowerShell\Paket.PowerShell.fsproj", "{1F1581C1-6416-470E-BC48-92C6D4AAC785}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1F1581C1-6416-470E-BC48-92C6D4AAC785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1581C1-6416-470E-BC48-92C6D4AAC785}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1581C1-6416-470E-BC48-92C6D4AAC785}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1581C1-6416-470E-BC48-92C6D4AAC785}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Paket.sln b/Paket.sln index 7e889a0369..f69ba44dd6 100644 --- a/Paket.sln +++ b/Paket.sln @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{BF60 docs\tools\generate.fsx = docs\tools\generate.fsx LICENSE.txt = LICENSE.txt paket.dependencies = paket.dependencies + paket.lock = paket.lock nuget\paket.template = nuget\paket.template README.md = README.md RELEASE_NOTES.md = RELEASE_NOTES.md @@ -27,6 +28,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{8E6D ProjectSection(SolutionItems) = preProject docs\content\bootstrapper.md = docs\content\bootstrapper.md docs\content\dependencies-file.md = docs\content\dependencies-file.md + docs\content\editor-support.md = docs\content\editor-support.md docs\content\faq.md = docs\content\faq.md docs\content\http-dependencies.md = docs\content\http-dependencies.md docs\content\index.md = docs\content\index.md @@ -35,7 +37,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{8E6D docs\content\paket.dependencies = docs\content\paket.dependencies docs\content\reference-from-repl.fsx = docs\content\reference-from-repl.fsx docs\content\references-files.md = docs\content\references-files.md + docs\content\resolver.fsx = docs\content\resolver.fsx docs\content\template-files.md = docs\content\template-files.md + docs\content\testimonials.md = docs\content\testimonials.md EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{ED8079DD-2B06-4030-9F0F-DC548F98E1C4}" @@ -48,16 +52,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paket.Bootstrapper", "src\P EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Paket.Core", "src\Paket.Core\Paket.Core.fsproj", "{7BAB0AE2-089F-4761-B138-A717AA2F86C5}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Paket.PowerShell", "src\Paket.PowerShell\Paket.PowerShell.fsproj", "{1F1581C1-6416-470E-BC48-92C6D4AAC785}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "commands", "commands", "{4425A246-BD18-4622-86B5-0154F19165E4}" ProjectSection(SolutionItems) = preProject docs\content\commands\add.md = docs\content\commands\add.md docs\content\commands\auto-restore.md = docs\content\commands\auto-restore.md docs\content\commands\config.md = docs\content\commands\config.md docs\content\commands\convert-from-nuget.md = docs\content\commands\convert-from-nuget.md + docs\content\commands\find-package-versions.md = docs\content\commands\find-package-versions.md + docs\content\commands\find-packages.md = docs\content\commands\find-packages.md docs\content\commands\find-refs.md = docs\content\commands\find-refs.md docs\content\commands\outdated.md = docs\content\commands\outdated.md docs\content\commands\remove.md = docs\content\commands\remove.md + docs\content\commands\show-installed-packages.md = docs\content\commands\show-installed-packages.md docs\content\commands\simplify.md = docs\content\commands\simplify.md docs\content\commands\update.md = docs\content\commands\update.md EndProjectSection @@ -84,10 +90,6 @@ Global {7BAB0AE2-089F-4761-B138-A717AA2F86C5}.Debug|Any CPU.Build.0 = Debug|Any CPU {7BAB0AE2-089F-4761-B138-A717AA2F86C5}.Release|Any CPU.ActiveCfg = Release|Any CPU {7BAB0AE2-089F-4761-B138-A717AA2F86C5}.Release|Any CPU.Build.0 = Release|Any CPU - {1F1581C1-6416-470E-BC48-92C6D4AAC785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1F1581C1-6416-470E-BC48-92C6D4AAC785}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1F1581C1-6416-470E-BC48-92C6D4AAC785}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1F1581C1-6416-470E-BC48-92C6D4AAC785}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -98,7 +100,4 @@ Global {E789C72A-5CFD-436B-8EF1-61AA2852A89F} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4} {4425A246-BD18-4622-86B5-0154F19165E4} = {8E6D5255-776D-4B61-85F9-73C37AA1FB9A} EndGlobalSection - GlobalSection(Performance) = preSolution - HasPerformanceSessions = true - EndGlobalSection EndGlobal diff --git a/build.fsx b/build.fsx index 2a6b8f8a17..066e39ca08 100644 --- a/build.fsx +++ b/build.fsx @@ -41,6 +41,7 @@ let tags = "nuget, bundler, F#" // File system information let solutionFile = "Paket.sln" +let solutionFilePowerShell = "Paket.PowerShell.sln" // Pattern specifying assemblies to be tested using NUnit let testAssemblies = "tests/**/bin/Release/*Tests*.dll" @@ -131,6 +132,22 @@ Target "Build" (fun _ -> |> ignore ) +// -------------------------------------------------------------------------------------- +// Build PowerShell project + +Target "BuildPowerShell" (fun _ -> + if File.Exists "src/Paket.PowerShell/System.Management.Automation.dll" = false then + let result = + ExecProcess (fun info -> + info.FileName <- Path.Combine(Environment.SystemDirectory, @"WindowsPowerShell\v1.0\powershell.exe") + info.Arguments <- "src/Paket.PowerShell/System.Management.Automation.ps1") System.TimeSpan.MaxValue + if result <> 0 then failwithf "Error copying System.Management.Automation.dll" + + !! solutionFilePowerShell + |> MSBuildRelease "" "Rebuild" + |> ignore +) + // -------------------------------------------------------------------------------------- // Run the unit tests using test runner @@ -324,6 +341,7 @@ Target "All" DoNothing "All" ==> "MergePaketTool" + =?> ("BuildPowerShell", not isMono) ==> "SignAssemblies" ==> "NuGet" ==> "BuildPackage" diff --git a/nuget/paket.template b/nuget/paket.template index 05057019bd..b6ea2fba2a 100644 --- a/nuget/paket.template +++ b/nuget/paket.template @@ -19,3 +19,5 @@ tags nuget, bundler, F# files ../bin/merged/paket.exe ==> tools + ../bin/Paket.PowerShell.dll ==> tools + ../src/Paket.PowerShell/init.ps1 ==> tools diff --git a/src/Paket.PowerShell/Paket.PowerShell.fsproj b/src/Paket.PowerShell/Paket.PowerShell.fsproj index 7eadde7f21..42669f3b7e 100644 --- a/src/Paket.PowerShell/Paket.PowerShell.fsproj +++ b/src/Paket.PowerShell/Paket.PowerShell.fsproj @@ -18,19 +18,21 @@ full false false - bin\Debug\ + ..\..\bin\ DEBUG;TRACE 3 - bin\Debug\Paket.PowerShell.XML + + pdbonly true true - bin\Release\ + ..\..\bin\ TRACE 3 - bin\Release\Paket.PowerShell.XML + + 11 @@ -59,6 +61,9 @@ True + + ..\..\bin\merged\paket.exe + diff --git a/src/Paket.PowerShell/PowerShell.fs b/src/Paket.PowerShell/PowerShell.fs index 7da54463a0..fb90229cd1 100644 --- a/src/Paket.PowerShell/PowerShell.fs +++ b/src/Paket.PowerShell/PowerShell.fs @@ -1,6 +1,9 @@ namespace Paket.PowerShell open System.Management.Automation +open Paket +open Paket.Commands +open Nessos.UnionArgParser [] type Add() = @@ -66,6 +69,15 @@ type RemoveCmdlet() = type RestoreCmdlet() = inherit Cmdlet() + override x.ProcessRecord() = + +// let parser = UnionArgParser.Create() + +// https://github.com/nessos/UnionArgParser/issues/35 +// let args = [ RestoreArgs.Force ; RestoreArgs.References_Files "abc.txt" ] +// Program.restore (ArgParseResults(args)) + () + [] type SimplifyCmdlet() = inherit Cmdlet() diff --git a/src/Paket.PowerShell/paket.template b/src/Paket.PowerShell/paket.template deleted file mode 100644 index bdadcade8d..0000000000 --- a/src/Paket.PowerShell/paket.template +++ /dev/null @@ -1,11 +0,0 @@ -type file -id Paket.PowerShell -authors Paket -projectUrl http://fsprojects.github.io/Paket/ -licenseUrl http://fsprojects.github.io/Paket/license.html -description - PowerShell for Paket -files - bin\Release\*.dll ==> tools - bin\Release\*.pdb ==> tools - init.ps1 ==> tools \ No newline at end of file From fe1ad4a3e4920dde5f4acc7ea11108230fcc98bb Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Thu, 28 May 2015 09:08:49 -0700 Subject: [PATCH 4/8] added PowerShell Add & Restore args, attempt to load for paket.exe as assembly --- nuget/paket.template | 1 + src/Paket.PowerShell/Paket.PowerShell.fsproj | 2 +- src/Paket.PowerShell/Paket.PowerShell.psd1 | 99 ++++++++++++++++++++ src/Paket.PowerShell/PowerShell.fs | 43 +++++++-- src/Paket.PowerShell/UnionArgParserExt.fs | 12 +++ src/Paket.PowerShell/init.ps1 | 2 +- 6 files changed, 148 insertions(+), 11 deletions(-) create mode 100644 src/Paket.PowerShell/Paket.PowerShell.psd1 create mode 100644 src/Paket.PowerShell/UnionArgParserExt.fs diff --git a/nuget/paket.template b/nuget/paket.template index b6ea2fba2a..49d487cd08 100644 --- a/nuget/paket.template +++ b/nuget/paket.template @@ -21,3 +21,4 @@ files ../bin/merged/paket.exe ==> tools ../bin/Paket.PowerShell.dll ==> tools ../src/Paket.PowerShell/init.ps1 ==> tools + ../src/Paket.PowerShell/Paket.PowerShell.psd1 ==> tools diff --git a/src/Paket.PowerShell/Paket.PowerShell.fsproj b/src/Paket.PowerShell/Paket.PowerShell.fsproj index 42669f3b7e..84c2bc6efa 100644 --- a/src/Paket.PowerShell/Paket.PowerShell.fsproj +++ b/src/Paket.PowerShell/Paket.PowerShell.fsproj @@ -52,9 +52,9 @@ + - diff --git a/src/Paket.PowerShell/Paket.PowerShell.psd1 b/src/Paket.PowerShell/Paket.PowerShell.psd1 new file mode 100644 index 0000000000..49c910cf44 --- /dev/null +++ b/src/Paket.PowerShell/Paket.PowerShell.psd1 @@ -0,0 +1,99 @@ +# +# Module manifest for module 'Paket.PowerShell' +# +# Generated by: cameron +# +# Generated on: 5/14/2015 +# + +@{ + +# Script module or binary module file associated with this manifest. +# RootModule = '' + +# Version number of this module. +ModuleVersion = '0.0.1' + +# ID used to uniquely identify this module +GUID = 'e7bdf748-93e9-4e24-95a2-ace98df3d687' + +# Author of this module +Author = 'Paket' + +# Company or vendor of this module +CompanyName = 'Paket' + +# Copyright statement for this module +Copyright = '(c) 2015 Paket. All rights reserved.' + +# Description of the functionality provided by this module +# Description = '' + +# Minimum version of the Windows PowerShell engine required by this module +# PowerShellVersion = '' + +# Name of the Windows PowerShell host required by this module +# PowerShellHostName = '' + +# Minimum version of the Windows PowerShell host required by this module +# PowerShellHostVersion = '' + +# Minimum version of Microsoft .NET Framework required by this module +# DotNetFrameworkVersion = '' + +# Minimum version of the common language runtime (CLR) required by this module +# CLRVersion = '' + +# Processor architecture (None, X86, Amd64) required by this module +# ProcessorArchitecture = '' + +# Modules that must be imported into the global environment prior to importing this module +# RequiredModules = @() + +# Assemblies that must be loaded prior to importing this module +# RequiredAssemblies = @() +RequiredAssemblies = '.\paket.exe' + +# Script files (.ps1) that are run in the caller's environment prior to importing this module. +# ScriptsToProcess = @() + +# Type files (.ps1xml) to be loaded when importing this module +# TypesToProcess = @() + +# Format files (.ps1xml) to be loaded when importing this module +# FormatsToProcess = @() + +# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess +# NestedModules = @() +NestedModules = '.\Paket.PowerShell.dll' +#NestedModules = @('.\Paket.PowerShell.dll', '.\paket.exe') + +# Functions to export from this module +FunctionsToExport = '*' + +# Cmdlets to export from this module +CmdletsToExport = '*' + +# Variables to export from this module +VariablesToExport = '*' + +# Aliases to export from this module +AliasesToExport = '*' + +# List of all modules packaged with this module +# ModuleList = @() + +# List of all files packaged with this module +# FileList = @() +#FileList = '.\paket.exe' + +# Private data to pass to the module specified in RootModule/ModuleToProcess +# PrivateData = '' + +# HelpInfo URI of this module +# HelpInfoURI = '' + +# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. +# DefaultCommandPrefix = '' + +} \ No newline at end of file diff --git a/src/Paket.PowerShell/PowerShell.fs b/src/Paket.PowerShell/PowerShell.fs index fb90229cd1..ec934660dd 100644 --- a/src/Paket.PowerShell/PowerShell.fs +++ b/src/Paket.PowerShell/PowerShell.fs @@ -4,6 +4,7 @@ open System.Management.Automation open Paket open Paket.Commands open Nessos.UnionArgParser +open System [] type Add() = @@ -18,8 +19,26 @@ type Add() = [] member val NoInstall = SwitchParameter() with get, set override x.ProcessRecord() = - x.WritefWarning "need this implement Add-Paket, nuget: %s" x.NuGet - () + let parser = UnionArgParser.Create() + seq { + if String.IsNullOrEmpty x.NuGet = false then + yield AddArgs.Nuget x.NuGet + if String.IsNullOrEmpty x.Version = false then + yield AddArgs.Version x.Version + if String.IsNullOrEmpty x.Project = false then + yield AddArgs.Project x.Project + if x.Force.IsPresent then + yield AddArgs.Force + if x.Interactive.IsPresent then + yield AddArgs.Interactive + if x.Hard.IsPresent then + yield AddArgs.Hard + if x.NoInstall.IsPresent then + yield AddArgs.No_Install + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.add [] type AutoRestoreCmdlet() = @@ -69,14 +88,20 @@ type RemoveCmdlet() = type RestoreCmdlet() = inherit Cmdlet() - override x.ProcessRecord() = - -// let parser = UnionArgParser.Create() + [] member val Force = SwitchParameter() with get, set + [] member val ReferencesFiles = Array.empty with get, set -// https://github.com/nessos/UnionArgParser/issues/35 -// let args = [ RestoreArgs.Force ; RestoreArgs.References_Files "abc.txt" ] -// Program.restore (ArgParseResults(args)) - () + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if x.Force.IsPresent then + yield RestoreArgs.Force + for rf in x.ReferencesFiles do + yield RestoreArgs.References_Files rf + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.restore [] type SimplifyCmdlet() = diff --git a/src/Paket.PowerShell/UnionArgParserExt.fs b/src/Paket.PowerShell/UnionArgParserExt.fs new file mode 100644 index 0000000000..89c00184c5 --- /dev/null +++ b/src/Paket.PowerShell/UnionArgParserExt.fs @@ -0,0 +1,12 @@ +[] +module Paket.PowerShell.UnionArgParserExt + +open Nessos.UnionArgParser + +// https://github.com/nessos/UnionArgParser/issues/35 + +type UnionArgParser<'Args when 'Args :> IArgParserTemplate> with + member parser.CreateParseResultsOfList(inputs : 'Args list) : ArgParseResults<'Args> = + let cliParams = parser.PrintCommandLine inputs // unparse inputs to cli form + parser.ParseCommandLine cliParams + diff --git a/src/Paket.PowerShell/init.ps1 b/src/Paket.PowerShell/init.ps1 index 77482f21c1..9338aeaca4 100644 --- a/src/Paket.PowerShell/init.ps1 +++ b/src/Paket.PowerShell/init.ps1 @@ -1,3 +1,3 @@ param($installPath, $toolsPath, $package) -Import-Module (Join-Path $toolsPath Paket.PowerShell.dll) -WarningAction SilentlyContinue +Import-Module (Join-Path $toolsPath Paket.PowerShell.psd1) -DisableNameChecking # Paket-Restore here so that packages get restored when Visual Studio opens the solution \ No newline at end of file From 597731a5832f848c9e865b2b13ccbbe4c4bdcfde Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Tue, 9 Jun 2015 21:53:49 -0700 Subject: [PATCH 5/8] ArgParseResult to ParseResult https://github.com/nessos/UnionArgParser/commit/7cbe88e1b5223a2f238457aff46f06a3c16ec39a --- src/Paket.PowerShell/UnionArgParserExt.fs | 2 +- src/Paket/Program.fs | 40 +++++++++++------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Paket.PowerShell/UnionArgParserExt.fs b/src/Paket.PowerShell/UnionArgParserExt.fs index 89c00184c5..90c975b20f 100644 --- a/src/Paket.PowerShell/UnionArgParserExt.fs +++ b/src/Paket.PowerShell/UnionArgParserExt.fs @@ -6,7 +6,7 @@ open Nessos.UnionArgParser // https://github.com/nessos/UnionArgParser/issues/35 type UnionArgParser<'Args when 'Args :> IArgParserTemplate> with - member parser.CreateParseResultsOfList(inputs : 'Args list) : ArgParseResults<'Args> = + member parser.CreateParseResultsOfList(inputs : 'Args list) : ParseResults<'Args> = let cliParams = parser.PrintCommandLine inputs // unparse inputs to cli form parser.ParseCommandLine cliParams diff --git a/src/Paket/Program.fs b/src/Paket/Program.fs index 3cf29f4b66..fa67033372 100644 --- a/src/Paket/Program.fs +++ b/src/Paket/Program.fs @@ -68,13 +68,13 @@ let processWithValidation<'T when 'T :> IArgParserTemplate> validateF commandF c if not silent then tracefn "%s - ready." elapsedTime -let processCommand<'T when 'T :> IArgParserTemplate> (commandF : ArgParseResults<'T> -> unit) = +let processCommand<'T when 'T :> IArgParserTemplate> (commandF : ParseResults<'T> -> unit) = processWithValidation (fun _ -> true) commandF Logging.verbose <- v Option.iter setLogFile logFile -let add (results : ArgParseResults<_>) = +let add (results : ParseResults<_>) = let packageName = results.GetResult <@ AddArgs.Nuget @> let version = defaultArg (results.TryGetResult <@ AddArgs.Version @>) "" let force = results.Contains <@ AddArgs.Force @> @@ -87,11 +87,11 @@ let add (results : ArgParseResults<_>) = let interactive = results.Contains <@ AddArgs.Interactive @> Dependencies.Locate().Add(packageName, version, force, hard, interactive, noInstall |> not) -let validateConfig (results : ArgParseResults<_>) = +let validateConfig (results : ParseResults<_>) = let args = results.GetResults <@ ConfigArgs.AddCredentials @> args.Length > 0 -let config (results : ArgParseResults<_>) = +let config (results : ParseResults<_>) = let args = results.GetResults <@ ConfigArgs.AddCredentials @> let source = args.Item 0 let username = @@ -101,41 +101,41 @@ let config (results : ArgParseResults<_>) = "" Dependencies.Locate().AddCredentials(source, username) -let validateAutoRestore (results : ArgParseResults<_>) = +let validateAutoRestore (results : ParseResults<_>) = results.GetAllResults().Length = 1 -let autoRestore (results : ArgParseResults<_>) = +let autoRestore (results : ParseResults<_>) = match results.GetAllResults() with | [On] -> Dependencies.Locate().TurnOnAutoRestore() | [Off] -> Dependencies.Locate().TurnOffAutoRestore() | _ -> failwith "expected only one argument" -let convert (results : ArgParseResults<_>) = +let convert (results : ParseResults<_>) = let force = results.Contains <@ ConvertFromNugetArgs.Force @> let noInstall = results.Contains <@ ConvertFromNugetArgs.No_Install @> let noAutoRestore = results.Contains <@ ConvertFromNugetArgs.No_Auto_Restore @> let credsMigrationMode = results.TryGetResult <@ ConvertFromNugetArgs.Creds_Migration @> Dependencies.ConvertFromNuget(force, noInstall |> not, noAutoRestore |> not, credsMigrationMode) -let findRefs (results : ArgParseResults<_>) = +let findRefs (results : ParseResults<_>) = let packages = results.GetResults <@ FindRefsArgs.Packages @> Dependencies.Locate().ShowReferencesFor(packages) -let init (results : ArgParseResults) = +let init (results : ParseResults) = Dependencies.Init() -let install (results : ArgParseResults<_>) = +let install (results : ParseResults<_>) = let force = results.Contains <@ InstallArgs.Force @> let hard = results.Contains <@ InstallArgs.Hard @> let withBindingRedirects = results.Contains <@ InstallArgs.Redirects @> Dependencies.Locate().Install(force, hard, withBindingRedirects) -let outdated (results : ArgParseResults<_>) = +let outdated (results : ParseResults<_>) = let strict = results.Contains <@ OutdatedArgs.Ignore_Constraints @> |> not let includePrereleases = results.Contains <@ OutdatedArgs.Include_Prereleases @> Dependencies.Locate().ShowOutdated(strict, includePrereleases) -let remove (results : ArgParseResults<_>) = +let remove (results : ParseResults<_>) = let packageName = results.GetResult <@ RemoveArgs.Nuget @> let force = results.Contains <@ RemoveArgs.Force @> let hard = results.Contains <@ RemoveArgs.Hard @> @@ -148,16 +148,16 @@ let remove (results : ArgParseResults<_>) = let interactive = results.Contains <@ RemoveArgs.Interactive @> Dependencies.Locate().Remove(packageName, force, hard, interactive, noInstall |> not) -let restore (results : ArgParseResults<_>) = +let restore (results : ParseResults<_>) = let force = results.Contains <@ RestoreArgs.Force @> let files = results.GetResults <@ RestoreArgs.References_Files @> Dependencies.Locate().Restore(force, files) -let simplify (results : ArgParseResults<_>) = +let simplify (results : ParseResults<_>) = let interactive = results.Contains <@ SimplifyArgs.Interactive @> Dependencies.Locate().Simplify(interactive) -let update (results : ArgParseResults<_>) = +let update (results : ParseResults<_>) = let hard = results.Contains <@ UpdateArgs.Hard @> let force = results.Contains <@ UpdateArgs.Force @> match results.TryGetResult <@ UpdateArgs.Nuget @> with @@ -168,7 +168,7 @@ let update (results : ArgParseResults<_>) = let withBindingRedirects = results.Contains <@ UpdateArgs.Redirects @> Dependencies.Locate().Update(force, hard, withBindingRedirects) -let pack (results : ArgParseResults<_>) = +let pack (results : ParseResults<_>) = let outputPath = results.GetResult <@ PackArgs.Output @> Dependencies.Locate() .Pack(outputPath, @@ -177,7 +177,7 @@ let pack (results : ArgParseResults<_>) = ?releaseNotes = results.TryGetResult <@ PackArgs.ReleaseNotes @>, ?templateFile = results.TryGetResult <@ PackArgs.TemplateFile @>) -let findPackages (results : ArgParseResults<_>) = +let findPackages (results : ParseResults<_>) = let maxResults = defaultArg (results.TryGetResult <@ FindPackagesArgs.MaxResults @>) 10000 let silent = results.Contains <@ FindPackagesArgs.Silent @> let sources = @@ -210,7 +210,7 @@ let findPackages (results : ArgParseResults<_>) = | Some searchText -> searchAndPrint searchText -let showInstalledPackages (results : ArgParseResults<_>) = +let showInstalledPackages (results : ParseResults<_>) = let dependenciesFile = Dependencies.Locate() let packages = match results.TryGetResult <@ ShowInstalledPackagesArgs.Project @> with @@ -232,7 +232,7 @@ let showInstalledPackages (results : ArgParseResults<_>) = for name,version in packages do tracefn "%s - %s" name version -let findPackageVersions (results : ArgParseResults<_>) = +let findPackageVersions (results : ParseResults<_>) = let maxResults = defaultArg (results.TryGetResult <@ FindPackageVersionsArgs.MaxResults @>) 10000 let name = results.GetResult <@ FindPackageVersionsArgs.Name @> let source = defaultArg (results.TryGetResult <@ FindPackageVersionsArgs.Source @>) Constants.DefaultNugetStream @@ -243,7 +243,7 @@ let findPackageVersions (results : ArgParseResults<_>) = for p in result do tracefn "%s" p -let push (results : ArgParseResults<_>) = +let push (results : ParseResults<_>) = let fileName = results.GetResult <@ PushArgs.FileName @> Dependencies.Push(fileName, ?url = results.TryGetResult <@ PushArgs.Url @>, ?endPoint = results.TryGetResult <@ PushArgs.EndPoint @>, From 30f53df4405e6d5bcf70fde5e838c954530f969e Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Tue, 9 Jun 2015 21:59:52 -0700 Subject: [PATCH 6/8] reference NuGet FSharp.Core --- paket.lock | 6 +- src/Paket.PowerShell/Paket.PowerShell.fsproj | 97 ++++++++++++++------ src/Paket.PowerShell/paket.references | 1 + 3 files changed, 73 insertions(+), 31 deletions(-) create mode 100644 src/Paket.PowerShell/paket.references diff --git a/paket.lock b/paket.lock index ac1f153183..e86bcf3007 100644 --- a/paket.lock +++ b/paket.lock @@ -28,9 +28,9 @@ GITHUB FsUnit.fs (81d27fd09575a32c4ed52eadb2eeac5f365b8348) remote: fsharp/FAKE specs: - modules/Octokit/Octokit.fsx (891840ae812cd0b6bec90e143c653b1c0cc95789) + modules/Octokit/Octokit.fsx (32c23b57535a478ad092043a1b692806415df25c) Octokit - src/app/FakeLib/Globbing/Globbing.fs (891840ae812cd0b6bec90e143c653b1c0cc95789) + src/app/FakeLib/Globbing/Globbing.fs (32c23b57535a478ad092043a1b692806415df25c) remote: fsprojects/Chessie specs: - src/Chessie/ErrorHandling.fs (3017092260b4a59a3b4b25bf8fca6be6eb7487eb) \ No newline at end of file + src/Chessie/ErrorHandling.fs (c7b1d53cfa7bfdd662b0611d024ea8b807315bbe) \ No newline at end of file diff --git a/src/Paket.PowerShell/Paket.PowerShell.fsproj b/src/Paket.PowerShell/Paket.PowerShell.fsproj index 84c2bc6efa..2b29ab1cf8 100644 --- a/src/Paket.PowerShell/Paket.PowerShell.fsproj +++ b/src/Paket.PowerShell/Paket.PowerShell.fsproj @@ -28,39 +28,22 @@ pdbonly true true - ..\..\bin\ + ..\..\bin\merged TRACE - 3 + 5 - - 11 - - - - - $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets - - - - - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets - - - - + + - - True - ..\..\bin\merged\paket.exe @@ -70,11 +53,69 @@ System.Management.Automation.dll - + + + + + ..\..\packages\FSharp.Core\lib\net40\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\FSharp.Core\lib\MonoAndroid\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\FSharp.Core\lib\MonoTouch\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\FSharp.Core\lib\portable-net45+netcore45+MonoAndroid1+MonoTouch1\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\FSharp.Core\lib\portable-net45+sl5+netcore45+MonoAndroid1+MonoTouch1\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wp8+MonoAndroid1+MonoTouch1\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\FSharp.Core.dll + True + True + + + + \ No newline at end of file diff --git a/src/Paket.PowerShell/paket.references b/src/Paket.PowerShell/paket.references new file mode 100644 index 0000000000..6f627f42c5 --- /dev/null +++ b/src/Paket.PowerShell/paket.references @@ -0,0 +1 @@ +FSharp.Core From 634d84475bacab9f114b1445691767812e42338f Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Thu, 11 Jun 2015 00:09:04 -0700 Subject: [PATCH 7/8] merge in Paket.PowerShell.dll into paket.exe too --- Paket.PowerShell.sln | 1 + build.fsx | 4 +- nuget/paket.template | 4 +- paket.lock | 4 +- src/Paket.PowerShell/Paket.PowerShell.fsproj | 29 +++++- src/Paket.PowerShell/Paket.PowerShell.psd1 | 99 -------------------- src/Paket.PowerShell/UnionArgParserExt.fs | 2 +- src/Paket.PowerShell/init.ps1 | 9 +- src/Paket.PowerShell/paket.references | 1 + src/Paket/Program.fs | 40 ++++---- 10 files changed, 61 insertions(+), 132 deletions(-) delete mode 100644 src/Paket.PowerShell/Paket.PowerShell.psd1 diff --git a/Paket.PowerShell.sln b/Paket.PowerShell.sln index e6d87be8e0..8a0bce19ce 100644 --- a/Paket.PowerShell.sln +++ b/Paket.PowerShell.sln @@ -6,6 +6,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{BF60 ProjectSection(SolutionItems) = preProject build.cmd = build.cmd build.fsx = build.fsx + nuget\paket.template = nuget\paket.template EndProjectSection EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Paket.PowerShell", "src\Paket.PowerShell\Paket.PowerShell.fsproj", "{1F1581C1-6416-470E-BC48-92C6D4AAC785}" diff --git a/build.fsx b/build.fsx index 6d2a795172..d2f751baff 100644 --- a/build.fsx +++ b/build.fsx @@ -167,7 +167,7 @@ Target "MergePaketTool" (fun _ -> CreateDir buildMergedDir let toPack = - ["paket.exe"; "Paket.Core.dll"; "FSharp.Core.dll"; "Newtonsoft.Json.dll"; "UnionArgParser.dll"] + ["paket.exe"; "Paket.Core.dll"; "FSharp.Core.dll"; "Newtonsoft.Json.dll"; "UnionArgParser.dll"; "Paket.PowerShell.dll"] |> List.map (fun l -> buildDir @@ l) |> separated " " @@ -337,6 +337,7 @@ Target "All" DoNothing "Clean" ==> "AssemblyInfo" ==> "Build" + =?> ("BuildPowerShell", not isMono) ==> "RunTests" =?> ("GenerateReferenceDocs",isLocalBuild && not isMono) =?> ("GenerateDocs",isLocalBuild && not isMono) @@ -345,7 +346,6 @@ Target "All" DoNothing "All" ==> "MergePaketTool" - =?> ("BuildPowerShell", not isMono) ==> "SignAssemblies" ==> "NuGet" ==> "BuildPackage" diff --git a/nuget/paket.template b/nuget/paket.template index 49d487cd08..b160192e3f 100644 --- a/nuget/paket.template +++ b/nuget/paket.template @@ -19,6 +19,4 @@ tags nuget, bundler, F# files ../bin/merged/paket.exe ==> tools - ../bin/Paket.PowerShell.dll ==> tools - ../src/Paket.PowerShell/init.ps1 ==> tools - ../src/Paket.PowerShell/Paket.PowerShell.psd1 ==> tools + ../src/Paket.PowerShell/init.ps1 ==> tools diff --git a/paket.lock b/paket.lock index e86bcf3007..a0d365bcb2 100644 --- a/paket.lock +++ b/paket.lock @@ -28,9 +28,9 @@ GITHUB FsUnit.fs (81d27fd09575a32c4ed52eadb2eeac5f365b8348) remote: fsharp/FAKE specs: - modules/Octokit/Octokit.fsx (32c23b57535a478ad092043a1b692806415df25c) + modules/Octokit/Octokit.fsx (66b3fe7bdc8f4b032982cf6a400fe7fdab4d0761) Octokit - src/app/FakeLib/Globbing/Globbing.fs (32c23b57535a478ad092043a1b692806415df25c) + src/app/FakeLib/Globbing/Globbing.fs (66b3fe7bdc8f4b032982cf6a400fe7fdab4d0761) remote: fsprojects/Chessie specs: src/Chessie/ErrorHandling.fs (c7b1d53cfa7bfdd662b0611d024ea8b807315bbe) \ No newline at end of file diff --git a/src/Paket.PowerShell/Paket.PowerShell.fsproj b/src/Paket.PowerShell/Paket.PowerShell.fsproj index 2b29ab1cf8..eb8df520af 100644 --- a/src/Paket.PowerShell/Paket.PowerShell.fsproj +++ b/src/Paket.PowerShell/Paket.PowerShell.fsproj @@ -18,7 +18,7 @@ full false false - ..\..\bin\ + ..\..\bin DEBUG;TRACE 3 @@ -28,7 +28,7 @@ pdbonly true true - ..\..\bin\merged + ..\..\bin TRACE 5 @@ -45,7 +45,10 @@ - ..\..\bin\merged\paket.exe + ..\..\bin\paket.exe + + + ..\..\bin\Paket.Core.dll @@ -118,4 +121,24 @@ + + + + + ..\..\packages\UnionArgParser\lib\net35\UnionArgParser.dll + True + True + + + + + + + ..\..\packages\UnionArgParser\lib\net40\UnionArgParser.dll + True + True + + + + \ No newline at end of file diff --git a/src/Paket.PowerShell/Paket.PowerShell.psd1 b/src/Paket.PowerShell/Paket.PowerShell.psd1 deleted file mode 100644 index 49c910cf44..0000000000 --- a/src/Paket.PowerShell/Paket.PowerShell.psd1 +++ /dev/null @@ -1,99 +0,0 @@ -# -# Module manifest for module 'Paket.PowerShell' -# -# Generated by: cameron -# -# Generated on: 5/14/2015 -# - -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '0.0.1' - -# ID used to uniquely identify this module -GUID = 'e7bdf748-93e9-4e24-95a2-ace98df3d687' - -# Author of this module -Author = 'Paket' - -# Company or vendor of this module -CompanyName = 'Paket' - -# Copyright statement for this module -Copyright = '(c) 2015 Paket. All rights reserved.' - -# Description of the functionality provided by this module -# Description = '' - -# Minimum version of the Windows PowerShell engine required by this module -# PowerShellVersion = '' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() -RequiredAssemblies = '.\paket.exe' - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() -NestedModules = '.\Paket.PowerShell.dll' -#NestedModules = @('.\Paket.PowerShell.dll', '.\paket.exe') - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() -#FileList = '.\paket.exe' - -# Private data to pass to the module specified in RootModule/ModuleToProcess -# PrivateData = '' - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} \ No newline at end of file diff --git a/src/Paket.PowerShell/UnionArgParserExt.fs b/src/Paket.PowerShell/UnionArgParserExt.fs index 90c975b20f..89c00184c5 100644 --- a/src/Paket.PowerShell/UnionArgParserExt.fs +++ b/src/Paket.PowerShell/UnionArgParserExt.fs @@ -6,7 +6,7 @@ open Nessos.UnionArgParser // https://github.com/nessos/UnionArgParser/issues/35 type UnionArgParser<'Args when 'Args :> IArgParserTemplate> with - member parser.CreateParseResultsOfList(inputs : 'Args list) : ParseResults<'Args> = + member parser.CreateParseResultsOfList(inputs : 'Args list) : ArgParseResults<'Args> = let cliParams = parser.PrintCommandLine inputs // unparse inputs to cli form parser.ParseCommandLine cliParams diff --git a/src/Paket.PowerShell/init.ps1 b/src/Paket.PowerShell/init.ps1 index 9338aeaca4..7cd275986f 100644 --- a/src/Paket.PowerShell/init.ps1 +++ b/src/Paket.PowerShell/init.ps1 @@ -1,3 +1,8 @@ param($installPath, $toolsPath, $package) -Import-Module (Join-Path $toolsPath Paket.PowerShell.psd1) -DisableNameChecking -# Paket-Restore here so that packages get restored when Visual Studio opens the solution \ No newline at end of file + +#Import-Module (Join-Path $toolsPath paket.exe) -DisableNameChecking +# vote for the above to work: https://connect.microsoft.com/PowerShell/feedbackdetail/view/1421358/import-module-with-exe +Import-Module -Assembly ([Reflection.Assembly]::LoadFile($(Join-Path $toolsPath paket.exe))) -DisableNameChecking + +# Paket-Restore here so that packages get restored when Visual Studio opens the solution +# TODO \ No newline at end of file diff --git a/src/Paket.PowerShell/paket.references b/src/Paket.PowerShell/paket.references index 6f627f42c5..19af91be7f 100644 --- a/src/Paket.PowerShell/paket.references +++ b/src/Paket.PowerShell/paket.references @@ -1 +1,2 @@ +UnionArgParser FSharp.Core diff --git a/src/Paket/Program.fs b/src/Paket/Program.fs index fa67033372..3cf29f4b66 100644 --- a/src/Paket/Program.fs +++ b/src/Paket/Program.fs @@ -68,13 +68,13 @@ let processWithValidation<'T when 'T :> IArgParserTemplate> validateF commandF c if not silent then tracefn "%s - ready." elapsedTime -let processCommand<'T when 'T :> IArgParserTemplate> (commandF : ParseResults<'T> -> unit) = +let processCommand<'T when 'T :> IArgParserTemplate> (commandF : ArgParseResults<'T> -> unit) = processWithValidation (fun _ -> true) commandF Logging.verbose <- v Option.iter setLogFile logFile -let add (results : ParseResults<_>) = +let add (results : ArgParseResults<_>) = let packageName = results.GetResult <@ AddArgs.Nuget @> let version = defaultArg (results.TryGetResult <@ AddArgs.Version @>) "" let force = results.Contains <@ AddArgs.Force @> @@ -87,11 +87,11 @@ let add (results : ParseResults<_>) = let interactive = results.Contains <@ AddArgs.Interactive @> Dependencies.Locate().Add(packageName, version, force, hard, interactive, noInstall |> not) -let validateConfig (results : ParseResults<_>) = +let validateConfig (results : ArgParseResults<_>) = let args = results.GetResults <@ ConfigArgs.AddCredentials @> args.Length > 0 -let config (results : ParseResults<_>) = +let config (results : ArgParseResults<_>) = let args = results.GetResults <@ ConfigArgs.AddCredentials @> let source = args.Item 0 let username = @@ -101,41 +101,41 @@ let config (results : ParseResults<_>) = "" Dependencies.Locate().AddCredentials(source, username) -let validateAutoRestore (results : ParseResults<_>) = +let validateAutoRestore (results : ArgParseResults<_>) = results.GetAllResults().Length = 1 -let autoRestore (results : ParseResults<_>) = +let autoRestore (results : ArgParseResults<_>) = match results.GetAllResults() with | [On] -> Dependencies.Locate().TurnOnAutoRestore() | [Off] -> Dependencies.Locate().TurnOffAutoRestore() | _ -> failwith "expected only one argument" -let convert (results : ParseResults<_>) = +let convert (results : ArgParseResults<_>) = let force = results.Contains <@ ConvertFromNugetArgs.Force @> let noInstall = results.Contains <@ ConvertFromNugetArgs.No_Install @> let noAutoRestore = results.Contains <@ ConvertFromNugetArgs.No_Auto_Restore @> let credsMigrationMode = results.TryGetResult <@ ConvertFromNugetArgs.Creds_Migration @> Dependencies.ConvertFromNuget(force, noInstall |> not, noAutoRestore |> not, credsMigrationMode) -let findRefs (results : ParseResults<_>) = +let findRefs (results : ArgParseResults<_>) = let packages = results.GetResults <@ FindRefsArgs.Packages @> Dependencies.Locate().ShowReferencesFor(packages) -let init (results : ParseResults) = +let init (results : ArgParseResults) = Dependencies.Init() -let install (results : ParseResults<_>) = +let install (results : ArgParseResults<_>) = let force = results.Contains <@ InstallArgs.Force @> let hard = results.Contains <@ InstallArgs.Hard @> let withBindingRedirects = results.Contains <@ InstallArgs.Redirects @> Dependencies.Locate().Install(force, hard, withBindingRedirects) -let outdated (results : ParseResults<_>) = +let outdated (results : ArgParseResults<_>) = let strict = results.Contains <@ OutdatedArgs.Ignore_Constraints @> |> not let includePrereleases = results.Contains <@ OutdatedArgs.Include_Prereleases @> Dependencies.Locate().ShowOutdated(strict, includePrereleases) -let remove (results : ParseResults<_>) = +let remove (results : ArgParseResults<_>) = let packageName = results.GetResult <@ RemoveArgs.Nuget @> let force = results.Contains <@ RemoveArgs.Force @> let hard = results.Contains <@ RemoveArgs.Hard @> @@ -148,16 +148,16 @@ let remove (results : ParseResults<_>) = let interactive = results.Contains <@ RemoveArgs.Interactive @> Dependencies.Locate().Remove(packageName, force, hard, interactive, noInstall |> not) -let restore (results : ParseResults<_>) = +let restore (results : ArgParseResults<_>) = let force = results.Contains <@ RestoreArgs.Force @> let files = results.GetResults <@ RestoreArgs.References_Files @> Dependencies.Locate().Restore(force, files) -let simplify (results : ParseResults<_>) = +let simplify (results : ArgParseResults<_>) = let interactive = results.Contains <@ SimplifyArgs.Interactive @> Dependencies.Locate().Simplify(interactive) -let update (results : ParseResults<_>) = +let update (results : ArgParseResults<_>) = let hard = results.Contains <@ UpdateArgs.Hard @> let force = results.Contains <@ UpdateArgs.Force @> match results.TryGetResult <@ UpdateArgs.Nuget @> with @@ -168,7 +168,7 @@ let update (results : ParseResults<_>) = let withBindingRedirects = results.Contains <@ UpdateArgs.Redirects @> Dependencies.Locate().Update(force, hard, withBindingRedirects) -let pack (results : ParseResults<_>) = +let pack (results : ArgParseResults<_>) = let outputPath = results.GetResult <@ PackArgs.Output @> Dependencies.Locate() .Pack(outputPath, @@ -177,7 +177,7 @@ let pack (results : ParseResults<_>) = ?releaseNotes = results.TryGetResult <@ PackArgs.ReleaseNotes @>, ?templateFile = results.TryGetResult <@ PackArgs.TemplateFile @>) -let findPackages (results : ParseResults<_>) = +let findPackages (results : ArgParseResults<_>) = let maxResults = defaultArg (results.TryGetResult <@ FindPackagesArgs.MaxResults @>) 10000 let silent = results.Contains <@ FindPackagesArgs.Silent @> let sources = @@ -210,7 +210,7 @@ let findPackages (results : ParseResults<_>) = | Some searchText -> searchAndPrint searchText -let showInstalledPackages (results : ParseResults<_>) = +let showInstalledPackages (results : ArgParseResults<_>) = let dependenciesFile = Dependencies.Locate() let packages = match results.TryGetResult <@ ShowInstalledPackagesArgs.Project @> with @@ -232,7 +232,7 @@ let showInstalledPackages (results : ParseResults<_>) = for name,version in packages do tracefn "%s - %s" name version -let findPackageVersions (results : ParseResults<_>) = +let findPackageVersions (results : ArgParseResults<_>) = let maxResults = defaultArg (results.TryGetResult <@ FindPackageVersionsArgs.MaxResults @>) 10000 let name = results.GetResult <@ FindPackageVersionsArgs.Name @> let source = defaultArg (results.TryGetResult <@ FindPackageVersionsArgs.Source @>) Constants.DefaultNugetStream @@ -243,7 +243,7 @@ let findPackageVersions (results : ParseResults<_>) = for p in result do tracefn "%s" p -let push (results : ParseResults<_>) = +let push (results : ArgParseResults<_>) = let fileName = results.GetResult <@ PushArgs.FileName @> Dependencies.Push(fileName, ?url = results.TryGetResult <@ PushArgs.Url @>, ?endPoint = results.TryGetResult <@ PushArgs.EndPoint @>, From 6833cf0f3ed275ab81527580ce9dadf56f464f85 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Fri, 12 Jun 2015 00:50:25 -0700 Subject: [PATCH 8/8] PowerShell wrappers for the rest of the commands --- Paket.PowerShell.sln | 1 - build.fsx | 2 +- nuget/paket.template | 3 +- src/Paket.PowerShell/AssemblyInfo.fs | 14 + src/Paket.PowerShell/Paket.PowerShell.fsproj | 3 + src/Paket.PowerShell/PowerShell.fs | 254 ++++++++++++++++++- src/Paket.PowerShell/init.ps1 | 11 +- src/Paket.PowerShell/paket.template | 23 ++ 8 files changed, 299 insertions(+), 12 deletions(-) create mode 100644 src/Paket.PowerShell/AssemblyInfo.fs create mode 100644 src/Paket.PowerShell/paket.template diff --git a/Paket.PowerShell.sln b/Paket.PowerShell.sln index 8a0bce19ce..e6d87be8e0 100644 --- a/Paket.PowerShell.sln +++ b/Paket.PowerShell.sln @@ -6,7 +6,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{BF60 ProjectSection(SolutionItems) = preProject build.cmd = build.cmd build.fsx = build.fsx - nuget\paket.template = nuget\paket.template EndProjectSection EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Paket.PowerShell", "src\Paket.PowerShell\Paket.PowerShell.fsproj", "{1F1581C1-6416-470E-BC48-92C6D4AAC785}" diff --git a/build.fsx b/build.fsx index 757665e9f9..2c8871bd05 100644 --- a/build.fsx +++ b/build.fsx @@ -167,7 +167,7 @@ Target "MergePaketTool" (fun _ -> CreateDir buildMergedDir let toPack = - ["paket.exe"; "Paket.Core.dll"; "FSharp.Core.dll"; "Newtonsoft.Json.dll"; "UnionArgParser.dll"; "Paket.PowerShell.dll"] + ["paket.exe"; "Paket.Core.dll"; "FSharp.Core.dll"; "Newtonsoft.Json.dll"; "UnionArgParser.dll"] |> List.map (fun l -> buildDir @@ l) |> separated " " diff --git a/nuget/paket.template b/nuget/paket.template index b160192e3f..1e2cb32e18 100644 --- a/nuget/paket.template +++ b/nuget/paket.template @@ -18,5 +18,4 @@ iconurl https://raw.githubusercontent.com/fsprojects/Paket/master/docs/files/img tags nuget, bundler, F# files - ../bin/merged/paket.exe ==> tools - ../src/Paket.PowerShell/init.ps1 ==> tools + ../bin/merged/paket.exe ==> tools \ No newline at end of file diff --git a/src/Paket.PowerShell/AssemblyInfo.fs b/src/Paket.PowerShell/AssemblyInfo.fs new file mode 100644 index 0000000000..74ba508507 --- /dev/null +++ b/src/Paket.PowerShell/AssemblyInfo.fs @@ -0,0 +1,14 @@ +namespace System +open System.Reflection + +[] +[] +[] +[] +[] +[] +[] +do () + +module internal AssemblyVersionInformation = + let [] Version = "1.13.0" diff --git a/src/Paket.PowerShell/Paket.PowerShell.fsproj b/src/Paket.PowerShell/Paket.PowerShell.fsproj index eb8df520af..d81626cc56 100644 --- a/src/Paket.PowerShell/Paket.PowerShell.fsproj +++ b/src/Paket.PowerShell/Paket.PowerShell.fsproj @@ -41,6 +41,8 @@ + + @@ -55,6 +57,7 @@ System.Management.Automation.dll + diff --git a/src/Paket.PowerShell/PowerShell.fs b/src/Paket.PowerShell/PowerShell.fs index ec934660dd..609357be3a 100644 --- a/src/Paket.PowerShell/PowerShell.fs +++ b/src/Paket.PowerShell/PowerShell.fs @@ -44,46 +44,239 @@ type Add() = type AutoRestoreCmdlet() = inherit Cmdlet() + [] member val On = SwitchParameter() with get, set + [] member val Off = SwitchParameter() with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if x.On.IsPresent then + yield AutoRestoreArgs.On + if x.Off.IsPresent then + yield AutoRestoreArgs.Off + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.autoRestore + [] type ConfigCmdlet() = inherit Cmdlet() + [] member val AddCredentials = "" with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if String.IsNullOrEmpty x.AddCredentials = false then + yield ConfigArgs.AddCredentials x.AddCredentials + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.config + [] type ConvertFromNuGetCmdlet() = inherit Cmdlet() + [] member val Force = SwitchParameter() with get, set + [] member val NoInstall = SwitchParameter() with get, set + [] member val NoAutoRestore = SwitchParameter() with get, set + [] + [] member val CredsMigration = "encrypt" with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if x.Force.IsPresent then + yield ConvertFromNugetArgs.Force + if x.NoInstall.IsPresent then + yield ConvertFromNugetArgs.No_Install + if x.NoAutoRestore.IsPresent then + yield ConvertFromNugetArgs.No_Auto_Restore + if String.IsNullOrEmpty x.CredsMigration = false then + yield ConvertFromNugetArgs.Creds_Migration x.CredsMigration + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.convert + [] type FindRefsCmdlet() = inherit Cmdlet() + [] member val NuGet : string[] = Array.empty with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + for p in x.NuGet do + yield FindRefsArgs.Packages p + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.findRefs + [] type FindPackagesCmdlet() = inherit Cmdlet() + [] member val SearchText = "" with get, set + [] member val Source = "" with get, set + [] member val Max = Int32.MinValue with get, set + [] member val Silent = SwitchParameter() with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if String.IsNullOrEmpty x.SearchText = false then + yield FindPackagesArgs.SearchText x.SearchText + if String.IsNullOrEmpty x.Source = false then + yield FindPackagesArgs.Source x.Source + if x.Max <> Int32.MinValue then + yield FindPackagesArgs.MaxResults x.Max + if x.Silent.IsPresent then + yield FindPackagesArgs.Silent + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.findPackages + [] type FindPackageVersionsCmdlet() = inherit Cmdlet() + [] member val Name = "" with get, set + [] member val Source = "" with get, set + [] member val Max = Int32.MinValue with get, set + [] member val Silent = SwitchParameter() with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if String.IsNullOrEmpty x.Name = false then + yield FindPackageVersionsArgs.Name x.Name + if String.IsNullOrEmpty x.Source = false then + yield FindPackageVersionsArgs.Source x.Source + if x.Max <> Int32.MinValue then + yield FindPackageVersionsArgs.MaxResults x.Max + if x.Silent.IsPresent then + yield FindPackageVersionsArgs.Silent + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.findPackageVersions + [] type InitCmdlet() = inherit Cmdlet() + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + List.empty + |> parser.CreateParseResultsOfList + |> Program.init + [] type InstallCmdlet() = inherit Cmdlet() + [] member val Force = SwitchParameter() with get, set + [] member val Hard = SwitchParameter() with get, set + [] member val Redirects = SwitchParameter() with get, set +// [] member val OnlyReferenced = SwitchParameter() with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if x.Force.IsPresent then + yield InstallArgs.Force + if x.Hard.IsPresent then + yield InstallArgs.Hard + if x.Redirects.IsPresent then + yield InstallArgs.Redirects +// if x.OnlyReferences.IsPresent then +// yield InstallArgs.OnlyReferenced + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.install + [] type OutdatedCmdlet() = inherit Cmdlet() + [] member val IgnoreConstraints = SwitchParameter() with get, set + [] member val IncludePrereleases = SwitchParameter() with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if x.IgnoreConstraints.IsPresent then + yield OutdatedArgs.Ignore_Constraints + if x.IncludePrereleases.IsPresent then + yield OutdatedArgs.Include_Prereleases + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.outdated + [] type PushCmdlet() = inherit Cmdlet() + [] member val Url = "" with get, set + [] member val File = "" with get, set + [] member val ApiKey = "" with get, set + [] member val Endpoint = "" with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if String.IsNullOrEmpty x.Url = false then + yield PushArgs.Url x.Url + if String.IsNullOrEmpty x.File = false then + yield PushArgs.FileName x.File + if String.IsNullOrEmpty x.ApiKey = false then + yield PushArgs.ApiKey x.ApiKey + if String.IsNullOrEmpty x.Endpoint = false then + yield PushArgs.EndPoint x.Endpoint + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.push + [] type RemoveCmdlet() = inherit Cmdlet() + [] member val NuGet = "" with get, set + [] member val Project = "" with get, set + [] member val Force = SwitchParameter() with get, set + [] member val Interactive = SwitchParameter() with get, set + [] member val Hard = SwitchParameter() with get, set + [] member val NoInstall = SwitchParameter() with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if String.IsNullOrEmpty x.NuGet = false then + yield RemoveArgs.Nuget x.NuGet + if String.IsNullOrEmpty x.Project = false then + yield RemoveArgs.Project x.Project + if x.Force.IsPresent then + yield RemoveArgs.Force + if x.Interactive.IsPresent then + yield RemoveArgs.Interactive + if x.Hard.IsPresent then + yield RemoveArgs.Hard + if x.NoInstall.IsPresent then + yield RemoveArgs.No_Install + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.remove + [] type RestoreCmdlet() = inherit Cmdlet() @@ -104,13 +297,70 @@ type RestoreCmdlet() = |> Program.restore [] -type SimplifyCmdlet() = +type SimplifyCmdlet() = inherit Cmdlet() + [] member val Interactive = SwitchParameter() with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if x.Interactive.IsPresent then + yield SimplifyArgs.Interactive + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.simplify + [] type ShowInstalledPackagesCmdlet() = inherit Cmdlet() + [] member val All = SwitchParameter() with get, set + [] member val Project = "" with get, set + [] member val Silent = SwitchParameter() with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if x.All.IsPresent then + yield ShowInstalledPackagesArgs.All + if String.IsNullOrEmpty x.Project = false then + yield ShowInstalledPackagesArgs.Project x.Project + if x.Silent.IsPresent then + yield ShowInstalledPackagesArgs.Silent + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.showInstalledPackages + [] type UpdateCmdlet() = - inherit Cmdlet() \ No newline at end of file + inherit Cmdlet() + + [] member val NuGet = "" with get, set + [] member val Version = "" with get, set + [] member val Force = SwitchParameter() with get, set + [] member val Hard = SwitchParameter() with get, set + [] member val Redirects = SwitchParameter() with get, set +// [] member val NoInstall = SwitchParameter() with get, set + + override x.ProcessRecord() = + let parser = UnionArgParser.Create() + seq { + if String.IsNullOrEmpty x.NuGet = false then + yield UpdateArgs.Nuget x.NuGet + if String.IsNullOrEmpty x.Version = false then + yield UpdateArgs.Version x.Version + if x.Force.IsPresent then + yield UpdateArgs.Force + if x.Hard.IsPresent then + yield UpdateArgs.Hard + if x.Redirects.IsPresent then + yield UpdateArgs.Redirects +// if x.NoInstall.IsPresent then +// yield UpdateArgs.No_Install + } + |> List.ofSeq + |> parser.CreateParseResultsOfList + |> Program.update \ No newline at end of file diff --git a/src/Paket.PowerShell/init.ps1 b/src/Paket.PowerShell/init.ps1 index 7cd275986f..5af940397b 100644 --- a/src/Paket.PowerShell/init.ps1 +++ b/src/Paket.PowerShell/init.ps1 @@ -1,8 +1,7 @@ param($installPath, $toolsPath, $package) +Import-Module (Join-Path $toolsPath Paket.PowerShell.dll) -DisableNameChecking -#Import-Module (Join-Path $toolsPath paket.exe) -DisableNameChecking -# vote for the above to work: https://connect.microsoft.com/PowerShell/feedbackdetail/view/1421358/import-module-with-exe -Import-Module -Assembly ([Reflection.Assembly]::LoadFile($(Join-Path $toolsPath paket.exe))) -DisableNameChecking - -# Paket-Restore here so that packages get restored when Visual Studio opens the solution -# TODO \ No newline at end of file +# restore packages when Visual Studio opens the solution +#if(Test-Path paket.dependencies){ +# Paket-Restore +#} \ No newline at end of file diff --git a/src/Paket.PowerShell/paket.template b/src/Paket.PowerShell/paket.template new file mode 100644 index 0000000000..c9169d0154 --- /dev/null +++ b/src/Paket.PowerShell/paket.template @@ -0,0 +1,23 @@ +type file +id Paket.PowerShell +description + A package dependency manager for .NET with support for NuGet packages and GitHub repositories. +version + 0.30.0-alpha014 +authors + Paket team +summary + A package dependency manager for .NET with support for NuGet packages and GitHub repositories. +licenseurl http://fsprojects.github.io/Paket/license.html +projecturl http://fsprojects.github.com/Paket +iconurl https://raw.githubusercontent.com/fsprojects/Paket/master/docs/files/img/logo.png +tags + nuget, bundler, F# +files + ../../bin/paket.exe ==> tools + ../../bin/Paket.Core.dll ==> tools + ../../bin/FSharp.Core.dll ==> tools + ../../bin/Newtonsoft.Json.dll ==> tools + ../../bin/UnionArgParser.dll ==> tools + ../../bin/Paket.PowerShell.dll ==> tools + init.ps1 ==> tools \ No newline at end of file