Skip to content

Use go-update and semver for a better upgrade experience#385

Merged
kytrinyx merged 1 commit intomasterfrom
better-upgrade
Jun 30, 2017
Merged

Use go-update and semver for a better upgrade experience#385
kytrinyx merged 1 commit intomasterfrom
better-upgrade

Conversation

@Tonkpils
Copy link
Contributor

@Tonkpils Tonkpils commented Apr 9, 2017

This should resolve #381

I haven't gotten a chance to test this on Windows but if the unzipping works correctly, go-update should handle the upgrade correctly.

I will be writing tests for this shortly. Just wanted to get something out there to iterate over.

@kytrinyx
Copy link
Member

This looks great! I still need to read it in detail, but I really like relying on 3rd party libraries for this behavior. ✨

@Tonkpils
Copy link
Contributor Author

Great! Let me know if you have any feedback. Also, if you know someone that can test this out on Windows that would be great, if not I can set up a VM to test it at some point. I've tested it both on Linux and Darwin and it worked fine so far.

@rpottsoh
Copy link
Member

@Tonkpils I have managed to install Go onto Windows, fork this repo, and to build the cli based on branch better-upgrade. I am assuming the intent of the PR is to improve the upgrade experience for Windows users of the Exercism client. I can be your guine pig, but I think I need a way to revert the version of the client I have built so that it believes it is suitable to be upgraded. What I am building thinks is 2.4 which currently agrees with the known current version so no attempt is made to upgrade.

How should or can I proceed? I have no experience with Go so please be patient. 😄 Thanks.

cc: @kytrinyx

@rpottsoh
Copy link
Member

Success! Congrats @Tonkpils! I found Version in main.go and set it equal to 2.3.9 for my build. exercism upgrade worked fine for me in Windows 7. The resulting EXE reports that it is version 2.4.0. Prior to the upgrade my EXE reported that it was 2.3.9.

Let me know if there is anything else I can do to help.

@kytrinyx
Copy link
Member

@rpottsoh awesome! Thank you.

You can also download older versions (if necessary) in the list of releases: https://github.com/exercism/cli/releases (I'm not sure where the exercism.exe gets put, but uninstalling the CLI should be as simple as deleting the exe)

@rpottsoh
Copy link
Member

@kytrinyx thanks for the tip about where to find old releases. It wasn't too bad to get Go up and working, the readme.md for the cli repo was sufficient. I found main.go and had Go build main.go which yielded main.exe in the same folder. My initial build ended up being of the master branch code so upgrade didn't work. Once I managed to get the updated code from the better-upgrade branch copied from my local copy of the repo to where Go is expecting the code to be, the upgrade feature worked fine, after building `main.go' again.

Interestingly Upgrade preserves the name of the EXE that it is upgrading; the resulting EXE after the upgrade was also called main.exe instead of exercism.exe.

I confirmed my build of the cli actually worked (prior to the upgrade) by listing available exercises from a couple different tracks.

Is Upgrade patching the EXE or just replacing it?

@Tonkpils
Copy link
Contributor Author

@rpottsoh So, if I remember correctly, what it's actually doing, to get around Windows restrictions of deleting the binary, is to create a new binary, moving the old one to a hidden file, then renaming the new binary. There's an option to patch the exe but I didn't look to deep into it as to how it worked.

@rpottsoh
Copy link
Member

rpottsoh commented Jun 28, 2017 via email

@kytrinyx
Copy link
Member

@Tonkpils I'll make a release today with this change. Thanks for taking the time to figure this one out!

@kytrinyx kytrinyx merged commit 04488c0 into master Jun 30, 2017
@kytrinyx kytrinyx deleted the better-upgrade branch June 30, 2017 13:30
@Tonkpils
Copy link
Contributor Author

Great! I'll be on the lookout for any feedback and improve on it if necessary! Thanks for taking care of the release 🎉

@kytrinyx
Copy link
Member

kytrinyx commented Jul 1, 2017

I forgot to release yesterday. I'll do it today!

@kytrinyx
Copy link
Member

kytrinyx commented Jul 1, 2017

Released! PR is open in homebrew: Homebrew/homebrew-core#15197

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.

windows: website tells me to run exercism upgrade but it doesn't work, exercism.exe in use

3 participants