Skip to content
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

Should download the VM as well #2

Open
cdlm opened this issue Jan 19, 2018 · 3 comments
Open

Should download the VM as well #2

cdlm opened this issue Jan 19, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@cdlm
Copy link
Owner

cdlm commented Jan 19, 2018

No description provided.

cdlm added a commit that referenced this issue Jan 20, 2018
Not a really realistic assumption, but I'm not keen on downloading VMs all over
the place. We'll see.

See #2
@cdlm
Copy link
Owner Author

cdlm commented Jan 20, 2018

I'm not fond of getting a VM for each project directory… I modified Fari to try running pharo-ui assuming it's somewhere in the PATH, because that's the normal thing to expect. If you do install VMs from zeroconf, you can export $PHARO=./pharo-ui, either globally or with direnv. I'll probably implement some middleground (fall back to ./pharo-ui if it's not in the PATH) but I'd prefer not adding code to download it.

@hernanmd What do you think?

@philippeback
Copy link

Can make an option in the script to download the VM. So, we get fari getvm vm70 and it would just do that.
The default option would be like "fari, do your thing"

@hernanmd
Copy link

I would love an option to download the VM if not present in the current directory. The thing is I suspect most people will not have the pharo-ui in the $PATH for diverse reasons : multiple pharo versions installed (is the pharo-ui script versioned?), workflows with 1 image per directory, avoiding to configure $PATH, etc.

Maybe something like:

IMAGENAME="Pharo.image"

# Returns 0 if command was found in the current system, 1 otherwise
command_exists () {
    type "$1" &> /dev/null ;
	return $?
}

check_downloader () {
	echo_line "Checking for wget or curl..."
	if command_exists wget ; then
		echo_nline "wget found..."
		DOWNLOAD_APP=wget
		DOWNLOAD_LIST_PARAMS="--no-check-certificate -O ${LIST_FILE}"
		DOWNLOAD_PHARO_PARAMS="-O-"
	elif command_exists curl ; then
			echo_nline "curl found..."
			DOWNLOAD_APP=curl
			DOWNLOAD_LIST_PARAMS="-o "$LIST_FILE
			DOWNLOAD_PHARO_PARAMS=""
		else
			echo_nline "I require wget or curl, but it's not installed. (brew install wget?) Aborting."
			exit 1
	fi
}

check_download_app () {
	echo -n "Checking Pharo installation already present..."
	if [ ! -f $IMAGENAME ]; then
		echo "not found"
		echo "Downloading Pharo..."
		exec $DOWNLOAD_APP $DOWNLOAD_PHARO_PARAMS get.pharo.org/$PHARO_VERSION+vm | bash
	else
		echo "found $IMAGENAME in the current directory"
	fi

	if [ ! -f pharo ]; then
		echo "Pharo not downloaded correctly, exiting"
		exit 1
	fi
}

@cdlm cdlm added the enhancement New feature or request label Jan 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants