Skip to content

Make the Install-VSCode script work on *nix #1597

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 22 commits into from
Nov 7, 2018

Conversation

rjmholt
Copy link
Contributor

@rjmholt rjmholt commented Nov 1, 2018

PR Summary

Made a few changes so the Install-VSCode.ps1 script supports macOS and various Linux distros as well.

It's probably not exhaustive and could do with a bit of testing.

I added a -WhatIf parameter as well, so you can use that to test and it will do the downloads but won't install anything.

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets.
Please mark anything not applicable to this PR NA.

  • PR has a meaningful title
  • Summarized changes
  • PR has tests
  • This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good just a few questions

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just a small question!

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

[switch]$EnableContextMenus
[switch]$EnableContextMenus,

[switch]$WhatIf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this is an anti-pattern in PowerShell. Don't declare this parameter but change the [CmdletBinding()] to [CmdletBinding(SupportsShouldProcess)]. Then, below instead of checking $WhatIf, use if ($PSCmdlet.ShouldProcess(<target>, <action>) { ... }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I wondered about the right way for this -- I didn't find anything that discussed WhatIf very well. I'll change it 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok @rkeithhill, I've implemented this with ShouldProcess now. Let me know if I'm using it the right way :)

@@ -462,7 +460,7 @@ try {

$installerPath = [System.IO.Path]::Combine($tmpdir, $installerName)

if ($onWindows) {
if ($PSVersionTable.PSVersion.Major -lt 6) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not Core compatible huh?

Copy link
Contributor Author

@rjmholt rjmholt Nov 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BitsTransfer wasn't loading for me 😢

Copy link
Contributor

@rkeithhill rkeithhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I assume when you run it with -whatif, it does (and doesn't do) what you expect. :-)

Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an extra comma in a param block, other than that LGTM

@rjmholt
Copy link
Contributor Author

rjmholt commented Nov 7, 2018

Ok, I've tested it on Windows and Ubuntu with WhatIf (and without -- it's part of an install script I wrote; why I made the changes). Everything seems to be working :)

@rjmholt rjmholt merged commit b507ec4 into PowerShell:master Nov 7, 2018
@rjmholt rjmholt deleted the install-script-xplat branch November 8, 2018 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants