alan-mj-lin / Sporeas

TJC projection webapp for service use.
1 stars 0 forks source link

Easy setup (PC+Mac) #88

Closed hchiam closed 4 years ago

hchiam commented 4 years ago

for issue #87 : auto install python packages

setup-sporeas-mac.command for Mac (just double click)

setup-sporeas-pc.ps1 for PC (right click and choose to run with powershell)

An alternate for PC would be NSIS. I've used NSIS a little bit at my previous work, but it's hard for me to develop now since I'm on a Mac.

hchiam commented 4 years ago

we'll have to improve the documentation for the first step that triggers the automation: maybe a separate readme file to tell you to run the setup .ps1 or .command file.

Also, on windows, you might have to do the right-click step twice. There's also a message about running powershell scripts.

alan-mj-lin commented 4 years ago

@hchiam I can tell you that the powershell doesn't work as expected. I tested by uninstalling python and once with python already installed.

A few concerns:

hchiam commented 4 years ago

@alan-mj-lin

I think you'll have to continue working on this and edit the .ps1 file, as it's hard for me to test on a pc. Feel free to take over the easy-setup branch and this PR.

alan-mj-lin commented 4 years ago

@hchiam can you test things on the mac side tho?

hchiam commented 4 years ago

@alan-mj-lin i think i found some of the problems

hchiam commented 4 years ago

@alan-mj-lin try testing it again. I suggest seeing if it works at all before you uninstall python. I tested on mac.

alan-mj-lin commented 4 years ago

@hchiam so i figured out whats wrong with it. Your code assumes Sporeas is always going to be under ~/Desktop directory. So I made an edit to just never cd anywhere because it seems when you right-click and run with powershell, it runs in that directory anyway. All the directory errors I was seeing is now gone.

alan-mj-lin commented 4 years ago

@hchiam you should put an exit clause in there somewhere so when all the setup is done and the app is running the powershell instance should exit and close

hchiam commented 4 years ago

@alan-mj-lin Can you re-confirm that you got rid of both cd lines and it worked? Removing the second cd seems to fail for me.

Also, if I add an exit clause to close powershell, the app will stop running. The .ps1 file already doubles as the app startup file. Unless you want a separate .ps1 file just for running the app.

alan-mj-lin commented 4 years ago

@hchiam well, you can just get your powershell script to run startup.vbs and the app will run in the background. startup.vbs is a windows specific script as well.

hchiam commented 4 years ago

@alan-mj-lin That's doable. I found this SO article: https://stackoverflow.com/questions/46597891/calling-vbscript-from-powershell-is-this-right-way-to-do-it

But it looks like startup.vbs and startup.bat use hardcoded paths. Can I change the paths or do you need them that way? Otherwise I can create separate vbs and bat files.

hchiam commented 4 years ago

At this point I think it's better if you change the file paths in the .vbs and .bat files, because I can't test that on mac anymore.

alan-mj-lin commented 4 years ago

@hchiam function goToScriptFolder errors out because $MyInvocation.MyCommand.Path returns null

hchiam commented 4 years ago

Hmmmmm I thought $MyInvocation.MyCommand.Definition was backwards compatible: https://stackoverflow.com/questions/5466329/whats-the-best-way-to-determine-the-location-of-the-current-powershell-script/5466355#5466355

Try commenting-out that line and un-comment the line below it to use $PSScriptRoot instead:

function goToScriptFolder {
  # cd $MyInvocation.MyCommand.Path
  cd $PSScriptRoot
}
alan-mj-lin commented 4 years ago

@hchiam can i commit to this branch?

hchiam commented 4 years ago

@alan-mj-lin yup, go ahead and take over this branch. :)

alan-mj-lin commented 4 years ago

@hchiam can you confirm that everything works on the mac side of things?

hchiam commented 4 years ago

for @alan-mj-lin:

for @hchiam: (mac only)

alan-mj-lin commented 4 years ago

@hchiam requirements.txt is just there in case we install our necessary python modules and realize we need additional modules for this app to work. So that requirements.txt is just a snapshot of what I in full in case we need to refer to it.

hchiam commented 4 years ago

@alan-mj-lin i tested everything on the mac side of things. [EDIT: I think I'll test one more time on someone else's mac]

i also made edits to both the pc file and the mac file, and i added a couple "stop" files. You can see what i changed for PC here (edits) and here (new file)

alan-mj-lin commented 4 years ago

@hchiam are you still making changes or is this ready now?

hchiam commented 4 years ago

@alan-mj-lin I don't expect any more changes, but I'm trying to get hold of the same mac so I can test from scratch. I'll try to get back to you on this tomorrow.

alan-mj-lin commented 4 years ago

@hchiam you broke the windows setup i think

alan-mj-lin commented 4 years ago

@hchiam fixed it

hchiam commented 4 years ago

@alan-mj-lin no that was intentional - otherwise now the backup instructions steps don't match

hchiam commented 4 years ago

because i've had the automatic download fail on another computer. So I added a link to the instructions (https://sporeas.surge.sh) to manually download the file. But then I realized the different names could be confusing, so I changed the name back to the original python-3.7.7-amd64.exe, so the user knows it's the same file that they're checking exists or is downloaded already.

I think the real bug was i didn't think to include the -OutFile parameter. I'll do that for now while I test the mac.

alan-mj-lin commented 4 years ago

@hchiam any final changes?

hchiam commented 4 years ago

@alan-mj-lin nothing else for pc. But the manual install isn't working on the other person's mac. Weird. I have another option I can try and then I give up. I'll try it on my mac again, but I need to figure out how to uninstall python3 and pip3 properly/completely.

hchiam commented 4 years ago

@alan-mj-lin OK, no more changes for mac. Let's say we can't support anything before macOS 10.9: