-
-
Notifications
You must be signed in to change notification settings - Fork 811
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
Avoiding creating a C:\tools directory #473
Comments
In the short term, you can change that path with Beyond that, there's some discussion over in #328 about the future of distributing posh-git with Chocolatey. That may be a while yet, though, so I would not be opposed to switching from If you, or anyone, does decide to tackle this, keep in mind that the uninstaller should continue to correctly purge posh-git from |
Hi, I would ask to make an example out of InvokeBuild package: https://chocolatey.org/pack.... This is a build tool that I use at work, in the form of Powershell module. It installs correctly in the conventional directories where Powershell modules are discoverable. These directories can be:
Please check out this document from MSDN: https://msdn.microsoft.com/en-us/library/dd878350(v=vs.85).aspx#Anchor_1 To check if the module is correctly installed in the system, it should appear in The use case for this is that installing a module in the correct directories is important if you use 3rd party software that depends on these modules, as it wouldn't be discoverable by them otherwise. For example I use the console emulator Cmder, which supposedly integrates with posh-git when emulating a Powershell terminal in a Git directory. |
For reference, here's @ferventcoder does Chocolatey convention have a stance on this sort of install, vs using
This surprises me. If you installed poshgit (via Chocolatey; note "poshgit" not "posh-git") from the Cmder shell, it should automatically import posh-git as part of your |
Tried on two different workstations but apparently it does not integrate, I see WARNINGS at the Cmder PS prompt. |
This sounds very neat and magical. Can you tell where this module is installed? Or where it's coming from? |
Cmder installs posh-git here: |
In the case of Chocolatey, installing to My suggestion is, by default, to installs to I will happily submit a PR if this is the way you want to do (as I have a template that pretty much works for all the modules I mentioned). Two other points:
The above is meant to be helpful and not critical so hopefully it's taken the right way! |
@pauby appreciate your input! I'm somewhat settled that this isn't worth changing for v0.x, though I suppose changing this location might be a reasonable excuse to bump from 0.7.x to 0.8.0. If we do make this change, For v1.0 I'm strongly considering adding PowerShell 5+ as a Chocolatey dependency, and having the install/uninstall scripts just delegate to PowerShellGet using the PowerShell Gallery. Thoughts?
Maybe submit a PR against the
Yeah, it's not intended that users would add
I feel like you're probably the exception here. The vast majority of posh-git users aren't PowerShell developers, and I would guess a significant amount have nothing besides |
I wouldn't add PS 5 as a package dependency in your Chocolatey .nuspec file. Most people won't be installing PS from Chocolatey (Core being an exception) as it comes installed out of the box. If you add PS 5 as a dependency everybody will have the Chocolatey PS 5 package installed by default even if it is already installed with their Windows 10. What I would do is do a check in the
Sure I'll submit a PR soon.
I'm a little confused as by definition GIT is a development tool and used by developers. So what do the non-developers use posh-git for??!? Package should install themselves and let the users handle any specific configuration that they may want, by default. I wholeheartedly agree that if a user does want you to update their profile then they can give you the permission to do so (using a chocolatey parameter) but you shouldn't assume that's what they want. |
Not non-developers. Non-PowerShell developers. People who use PowerShell as a shell (often for posh-git, often from GitHub for Windows initially), but have never written a script or module themselves. |
As a PowerShell Professional™️ I would also like to have an option for scoping it to the current user to avoid the need to have an elevated shell. |
@bergmeister Chocolatey needs to run elevated so it can install packages. It would be difficult to scope a package installation to the current user. There are ways to do it but none of them are pretty. |
Sorry, I did not know that, I am clearly not a Chocolatey Professional™️ 🤣 . I guess a simplistic installation script does the job in most cases. |
That's cool. Chocolatey is still something new to a lot of people - but you should check it out :) It does reinvent the wheel a little insomuch as we have another way to install a module. But the module is bundled with the package so it's an all-in-one package without the need for PowerShellGet or anything else. PowerShellGet is not installed by default in PS4 and below and with Chocolatey we are supporting PS back to v2. |
If you're this picky, I'm inclined to let you use
v1+ drops support for < 5 specifically so we can assume PowerShellGet is available.
Taking a nupkg, no (AFAIK), but you're absolutely right that the current Chocolatey installer replicates what |
But for them they can use Add-PoshGitToProfile to add it there rather than you doing it for everybody in the installation script. I also, dare I say, think you're treating your users a bit too simplistically. If they can you use another 'language'. If they can use Git. If they can use PowerShell. They can run a cmdlet to add posh-git to their profile. As an aside, your code will not find where I am importing posh-git as I don't keep it in $PROFILE (it looks like your code only checks for that?). There's also a LOT of code around adding it. You're also distributing tests and other code that isn't relevant to the module - is this deliberate? I know I've gone off on talking about the Chocolatey side of it but I've just noticed the other stuff and thought I'd point it out. |
Agreed, except for the part where a C:\tools folder appears. 😇 |
I disagree entirely. As a Chocolatey user I very much care 'how'. |
It's an accident of installing from a ZIP of the repo. This was one of the first Chocolatey packages ever written (not by me: #193) when Chocolatey and this project were much simpler. Until last year (#358 has some good context), the package always installed Thus reconsidering for v1. 😀
I don't mean to; it's not a matter of "can". But this is the first I can recall in seven years as a Chocolatey package that someone has objected to modifying their profile. And for most of that time we didn't handle CurrentUser/AllUsers/CurrentHost/AllHosts. (Related: in a Chocolatey install script we actually can't: chocolatey/choco#1154.) Most people simply don't seem to care, and I'm not inclined to require that they care if we can provide a reasonable default. That said, I'm sure there's a way to let the Chocolatey install respect an option to not touch |
You'll probably find that most people don't know you're modifying the profile. There is nothing in the Chocolatey description or output from the package install to say it. If you removed updating the profile you'd probably have no complaints either! Have a look at https://chocolatey.org/packages/invoke-build and see the notes in the description around adding to your profile.
I've outline the reasons you should do this in the PR I submitted (#578) rather add an option to modify the profile.
If you add a prompt the installation will not be silent which is what Chocolatey prefers to have. |
Right. My point is that they don't need to know as long as it works. They probably don't know that Chocolatey itself also modifies their profile to support |
I respectfully disagree. You need to let them know what you're doing as modifying people's 'stuff' is not okay. I really don't like this whole idea of 'hey this stuff works you don't need to know how'. That's why consumer IT is in such a mess. I agree that the user 'doesn't need to know if they don't want to know' but give them the choice. And don't start modifying things outside of your module without gaining their consent. You are not in a position to decide what the user does and does not need to know. (There really is no way to write that without it sounding confrontational :))
Chocolatey doesn't do this (I never thought it did but I just checked with the team). |
With respect, you're thinking from a PowerShell Module standpoint, not a Chocolatey "application" standpoint. Application installers nearly always change their environment on install, otherwise
Unless I'm missing something, you were told wrong: |
I'm not actually thinking of module vs Chocolatey. I'm thinking user consent / understanding / knowing what you're going to do vs modifying files that the user has no way to stop and no way to know it's being done. If you had a Chocolatey parameter (to allow / disallow profile modification) then you'd first of all need to tell people (there is the consent) and you are giving people an choice. In my case you're not modifying the file I keep all my profile in so it makes troubleshooting any issues a problem as I won't be looking in $PROFILE (as all it does it dot sources a central profile ps1 file - this is not unusual). A parameter would allow me to stop that from happening. But to look at it from a module (ie. PS Gallery) vs, Chocolatey (or other method) you have one set of behaviours from PS Gallery and another from Chocolatey. This will again cause that misunderstanding for people going from one to the other. Let them know it's different and how. As an aside this thread has move away from using C:\Tools so I'm not sure if it would be more appropriate to start a new issue which might allows others to come in too. I'll leave that to your call.
@gep13 can you comment on this? |
Making the chocolatey package function to any degree at all (without manual intervention) is apparently a wontfix, so I've installed it with PowerShellGet. See: - dahlbyk/posh-git#734 - dahlbyk/posh-git#473
Making the chocolatey package function to any degree at all (without manual intervention) is apparently a wontfix, so I've installed it with PowerShellGet. See: - https://github DOT com/dahlbyk/posh-git/issues/734 - https://github DOT com/dahlbyk/posh-git/issues/473
Is it possible to move
C:\tools\poshgit
to%appdata%\poshgit
?I'm using the Chocolatey package.
The text was updated successfully, but these errors were encountered: