#!/usr/bin/env bash

ruby_archive="jruby-bin-$ruby_version.tar.gz"
ruby_src_dir="jruby-$ruby_version"
ruby_mirror="${ruby_mirror:-http://jruby.org.s3.amazonaws.com/downloads}"
ruby_url="${ruby_url:-$ruby_mirror/$ruby_version/$ruby_archive}"

#
# Install JRuby into $install_dir.
#
function install_ruby()
{
	log "Installing jruby $ruby_version ..."
	cp -R "$src_dir/$ruby_src_dir" "$install_dir" || return $?
}

#
# Post-install tasks.
#
function post_install()
{
	log "Symlinking bin/ruby to bin/jruby ..."
	ln -fs jruby "$install_dir/bin/ruby" || return $?

	if ! command -v java >/dev/null; then
		warn "In order to use JRuby you must install OracleJDK:"
		warn "  http://www.oracle.com/technetwork/java/javase/downloads/index.html"
	fi
}

#!/usr/bin/env bash

ruby_archive="jruby-bin-$ruby_version.tar.gz"
ruby_src_dir="jruby-$ruby_version"
ruby_mirror="${ruby_mirror:-https://s3.amazonaws.com/jruby.org/downloads}"
ruby_url="${ruby_url:-$ruby_mirror/$ruby_version/$ruby_archive}"

#
# Install JRuby into $install_dir.
#
function install_ruby()
{
	log "Installing jruby $ruby_version ..."
	cp -R "$src_dir/$ruby_src_dir" "$install_dir" || return $?
}

#
# Post-install tasks.
#
function post_install()
{
	log "Symlinking bin/ruby to bin/jruby ..."
	ln -fs jruby "$install_dir/bin/ruby" || return $?

	if ! command -v java >/dev/null; then
		warn "In order to use JRuby you must install OracleJDK:"
		warn "  http://www.oracle.com/technetwork/java/javase/downloads/index.html"
	fi
}

Use the secure S3 bucket for JRuby downloads
Use the secure S3 bucket for JRuby downloads

The JRuby team recently
[tweeted](https://twitter.com/jruby/status/525726366533443584) that Ruby
installers should switch to using a new secure link over HTTPS to
download JRuby artifacts. This patch switches the Ruby mirror to the new
URL!

Signed-off-by: David Celis <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@davidcel.is>
