Skip to content

Instantly share code, notes, and snippets.

@jordansissel
Created March 31, 2011 22:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jordansissel/897409 to your computer and use it in GitHub Desktop.
Save jordansissel/897409 to your computer and use it in GitHub Desktop.
An attempt to copy the current rvm instance into a monolithic package.
#!/usr/bin/env bash
set -e
builddir="build/monolithic"
mkdir -p $builddir
# Copy gems
for path in $(echo "$GEM_PATH" | tr ":" " "); do
echo "Copying $path"
rsync -a "$GEM_HOME/" $builddir/gem
done
# Copy ruby
echo "Copying $MY_RUBY_HOME"
rsync -a "$MY_RUBY_HOME/" $builddir/ruby
# Create a file for sourcing in shell to use this specific ruby
cat > "${builddir}/use_this_ruby.rc" <<END
name=\$BASH_SOURCE
[ -z "\$name" ] && name=\$0
dir=\$(dirname \$name)
[ "$dir" = "." ] && dir="\$PWD"
GEM_HOME=\$dir/gems
GEM_PATH=\$dir/gems
PATH=./\$dir/ruby/bin:${PATH}
export GEM_HOME
export GEM_PATH
export PATH
END
echo $builddir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment