dom96 / choosenim

Tool for easily installing and managing multiple versions of the Nim programming language.
BSD 3-Clause "New" or "Revised" License
682 stars 66 forks source link

Modify runme.bat script to include --firstInstall #188

Closed dom96 closed 2 years ago

dom96 commented 4 years ago

The current script does not include that flag, which means that users are not asked whether they wish to add Nim to their PATH.

Ivoz commented 4 years ago

Additionally, this command fails when you try to run it manually afterwards.

Downloading C compiler (Mingw64)
[##################################################] 100.0% 0kb/s
 Extracting mingw64.7z
Downloading DLLs (openssl, pcre, ...)
[##################################################] 100.0% 0kb/s
 Extracting dlls.zip
Downloading Nim 1.2.6 from nim-lang.org
[##################################################] 100.0% 0kb/s
 Extracting nim-1.2.6_x64.zip
   Building Nim 1.2.6
  Compiler: Already built
     Tools: Already built
  Installed component 'nim'
      Hint: Binary 'nim' isn't in your PATH
  Installed component 'nimble'
      Hint: Binary 'nimble' isn't in your PATH
  Installed component 'nimgrep'
      Hint: Binary 'nimgrep' isn't in your PATH
  Installed component 'nimpretty'
      Hint: Binary 'nimpretty' isn't in your PATH
  Installed component 'nimsuggest'
      Hint: Binary 'nimsuggest' isn't in your PATH
  Installed component 'testament'
      Hint: Binary 'testament' isn't in your PATH
  Installed component 'gcc'
      Hint: Binary 'gcc' isn't in your PATH
  Installed component 'g++'
      Hint: Binary 'g++' isn't in your PATH
  Installed component 'gdb'
      Hint: Binary 'gdb' isn't in your PATH
  Installed component 'ld'
      Hint: Binary 'ld' isn't in your PATH
      Hint: Use 'choosenim <version/channel> --firstInstall' to add
        ... C:\Users\Matthew\.nimble\bin to your PATH.
   Switched to Nim 1.2.6
        1 file(s) copied.
            Work finished.
            Now you must ensure that the Nimble bin dir is in your PATH:
              C:\Users\Matthew\.nimble\bin
Press any key to continue . . .

If someone is running this for the first time I imagine they just want the "stable" channel running? but it tells you to run choosenim <version/channel> --firstInstall without really suggesting a value for <version/channel>. They might choose 1.2.6 but I imagine stable is better choice?

Okay, so I go to the .nimble/bin directory:

C:\Users\Matthew\.nimble\bin>choosenim.exe stable --firstInstall
      Info: C:\Users\Matthew\.choosenim\downloads\dlls.zip already downloaded
 Extracting dlls.zip
     Error: Unable to extract. Error was 'Cannot create a file when that file already exists.
        ... '.

Welp, great. From the previous output of runme.bat, it looks like this step was already completed but now this is trying that again and failing. If there is anything else to do apart from add /bin to my path I won't know about it.

Ivoz commented 4 years ago

Sidenote: some maintainer might want to look at grabbing maintainership of the chocolatey package - https://chocolatey.org/packages/nim because it looks like others have left it out of date (apparently it's not that hard to take over if previous maintainers have gone 'afk' or you are part of official project). A package that installed choosenim correctly might be cool too.

dom96 commented 4 years ago

Just add C:\Users\Matthew\.nimble\bin to your PATH manually. The problem you are running into is a bug that was fixed but a new release hasn't been made yet. Once you change your PATH (and restart your terminal to make sure the PATH is changed) it should work fine.

Ivoz commented 4 years ago

Would be cool to get a release out just fixing these basic issues, otherwise I'm guessing choosenim would have worked just fine for me first time.

genotrance commented 3 years ago

It might be time to ditch the runme.bat script since choosenim should now be standalone - what we could offer is a powershell script, similar to the shell script on Linux, that runs firstInstall.

dom96 commented 3 years ago

What do you mean it should now be standalone? We still ship a zip with this runme.bat file.

genotrance commented 3 years ago

The Windows binary no longer needs supporting dlls, so the binary by itself is all you really need. No need for a zip file.

If it is a question of running some initial command like --firstInstall, might as well create a powershell script that complements our posix init.sh. runme.bat seems obsolete.

dom96 commented 3 years ago

True, I suppose we can do that. For those that aren't super familiar with CLIs though, it might be best to still ship a zip file with this bat script (it also gives support for older Windows OS')

jdf-id-au commented 2 years ago

I ran runme.bat on a new machine and it edited my PATH to append ;"C:\Users\User Name\.nimble\bin" (with quotes). This successfully added nim to the PATH in cmd.exe, but it only worked in PowerShell when the quotes were removed.

(Also I got some errors that the .nimble\bin directory didn't exist yet. I ran runme.bat a second time and it worked.)

dom96 commented 2 years ago

This should be resolved now with the latest release.