Guest User

Untitled

a guest
Oct 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #! /usr/bin/env bash
  2.  
  3. . /home/runner/.bash_profile
  4.  
  5. ruby_version=${1:-"2.5.3"}
  6. gem_version=${2:-"2.7.6"}
  7. ruby_archive="$ruby_version.tar.gz"
  8. ruby_install_path="/home/runner/.rbenv/versions/$ruby_version"
  9.  
  10. echo "*****************************************"
  11. echo "Setting up Ruby $ruby_version"
  12. echo "*****************************************"
  13.  
  14. if ! [ -d $ruby_install_path ]; then
  15. if ! [ -e $SEMAPHORE_CACHE_DIR/$ruby_archive ]; then
  16. cd /home/runner/.rbenv/plugins/ruby-build && git pull && cd -
  17. CFLAGS='-fPIC' rbenv install $ruby_version
  18. (cd $SEMAPHORE_CACHE_DIR && tar -cf $ruby_archive -C $ruby_install_path .)
  19. else
  20. echo "Ruby $ruby_version installation archive found in cache. Unpacking..."
  21. (cd $SEMAPHORE_CACHE_DIR && mkdir $ruby_install_path && tar xf $ruby_archive -C $ruby_install_path)
  22. fi
  23. else
  24. echo "Ruby $ruby_version already installed. Skipping setup..."
  25. fi
  26.  
  27. echo "Activating Ruby $ruby_version"
  28. rbenv global $ruby_version
  29.  
  30. if ! [ $gem_version = "$(gem --version)" ]; then
  31. echo "Updating RubyGems to version $gem_version"
  32. gem update --system $gem_version --no-ri --no-rdoc
  33. fi
  34.  
  35. echo "Installing bundler..."
  36. gem install bundler --no-ri --no-rdoc
  37.  
  38. echo "Setup complete."
  39. echo "-----------------------------------------------"
  40. echo "Details:"
  41. echo "$(ruby --version)"
  42. echo "$(bundle --version)"
  43. echo "RubyGems version: $(gem --version)"
Add Comment
Please, Sign In to add comment