Sha256: 0267fce12059ec55aa89d32b94778fe5455dd908a4516da667fca5951f03e0bf

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

set -ue

SHADOW_PUPPET_VERSION="0.3.2"
MANIFEST_VERSION="0.1.2"

trap "echo FAILED" EXIT

# ensure_gem GEM [VERSION]
function ensure_gem()
{
	if [ $# -eq 2 ]; then
		# name + version
		if ! gem list $1 | grep -q "$1 (\([^,]*, \)*${2//./\\.}\(, [^,]*\)*)$"; then
			echo installing $1 -v$2
			gem install --no-ri --no-rdoc $1 -v$2
		fi
	else
		# name only
		if ! gem list $1 | grep -q "^$1 ";then
			echo installing $1
			gem install --no-ri --no-rdoc $1
		fi
	fi
}

function use_system_ruby() {
	if [ -e /usr/local/rvm ]; then
		echo RVM: Switch to system ruby
		set +eu
		. /usr/local/rvm/scripts/rvm
		rvm use system
		set -eu
	fi
}

function run_recipe() {
	echo "Mix: [recipe: $RECIPE, node: ${NODE:-}, roles: ${ROLES:-}]"

	# rvm substitutes cd with its scripts/cd which accesses unbound variables
	set +u
	cd /var/lib/blender/recipes
	set -u

	ruby -rrubygems <<-RUBY
gem 'server-blender-manifest', '$MANIFEST_VERSION'
require 'blender/manifest'
Blender::Manifest.run("${SHADOW_PUPPET_VERSION}") || exit(1)
RUBY
}

use_system_ruby
ensure_gem shadow_puppet $SHADOW_PUPPET_VERSION
ensure_gem ruby-debug
ensure_gem server-blender-manifest $MANIFEST_VERSION
if run_recipe; then
	echo
	echo "Your mix is ready. Have fun!"
else
	echo
	echo "Mix failed. Check error messages above for details"
fi

trap - EXIT

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
server-blender-0.0.22 files/mix.sh
server-blender-0.0.21 files/mix.sh