technomancy / leiningen

Moved to Codeberg; this is a convenience mirror
https://codeberg.org/leiningen/leiningen
Other
7.29k stars 1.61k forks source link

Move bat script over to ps1 script #2192

Open hypirion opened 8 years ago

hypirion commented 8 years ago

With the pull request #2174 we're not far away from replacing the batch script with powershell. This will require some investigation to keep the usability good (or at least alright):

aadrian commented 8 years ago

-1

Bat was working in all environments without problems. PowerShell not so (restricted in many corporate environments) :(.

With the last 2.6.1 migration to 2.7.0 now Lein is broken because of PS use.

c:\downloads>lein version
Processing -File '' failed: The path is not of a legal form. Specify a valid path for the -File parameter.
jevad commented 8 years ago

As aadrian noted, PowerShell requires special "ExecutionPolicy" permissions to run scripts. Setting that special permission is easy , but it potentially requires "Administrator" privileges, which ordinary users do not have in many corporate and (most especially) government environments.

I ran into the same error message as aadrian when I ran the 2.7.0 bat file. However, my corporate environment does allow PowerShell, so I just downloaded the PS1 file from GitHub, then ran Set-ExcutionPolicy from an "Administrator" shell, and all was good (well, except for the issue I reported just now, but I fixed that too).

hypirion commented 8 years ago

ah, darn, I'll push out a bugfix which resolves the lein.bat breakage asap.

Is the issue that powershell itself is too restricted, or is the issue the execution policy of powershell? And if so, are there any ways to get around that? One of the reasons we wanted to go over to ps was because it handled downloading much better for us, but if powershell or the execution policy isn't widely available then powershell doesn't sound like a viable replacement at this point.

hypirion commented 8 years ago

A normal lein upgrade will not mess up lein.bat scripts anymore, sorry for that inconvenience.

aadrian commented 8 years ago

@hyPiRion Thank you. It works again now. The lein.bat needs to be manually re-downloaded first, and than everything seems to work again :) .

aadrian commented 8 years ago

@hyPiRion I have to rectify. After testing it on more machines, unfortunately the Windows version does not work without PowerShell - even if Curl is in the path :(.

Also tried with the new 2.7.1 lein.bat file and it's the same problem :(.

c:\work>lein upgrade
The script at c:\tools\lein-2.x\bin\lein.bat will be upgraded to the latest stable version.
Do you want to continue (Y/N)?y
Downloading latest Leiningen batch script...
Exception calling "DownloadFile" with "2" argument(s): "Unable to connect to the remote server"
At line:1 char:145
+ ... rkCredentials; $client.DownloadFile($a, $f)} "https://github.com/technomancy/lei ...
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException

Upgrading...
'"c:\tools\lein-2.x\bin\temp-lein-297059864.bat"' is not recognized as an internal or external command,
operable program or batch file.