Added Ruby gems script
Necessary to provide a single source of truth for installing Ruby dependencies. This used to be managed by the Ruby Setup project but that project is being deprecated in favor of this project.
This commit is contained in:
17
bin/install_ruby_gems
Executable file
17
bin/install_ruby_gems
Executable file
@@ -0,0 +1,17 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# Installs Ruby gems.
|
||||
|
||||
set -o nounset
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_ruby_gems"
|
||||
|
||||
if [[ -x "$SCRIPT_PATH" ]]; then
|
||||
install_ruby
|
||||
"$SCRIPT_PATH"
|
||||
else
|
||||
printf "WARNING: Ruby gems install script does not exist or is not executable.\n"
|
||||
fi
|
||||
1
bin/run
1
bin/run
@@ -39,6 +39,7 @@ while true; do
|
||||
printf " m: Install Mac App Store software.\n"
|
||||
printf " a: Install application software.\n"
|
||||
printf " x: Install application software extensions.\n"
|
||||
printf " rg: Install Ruby gems.\n"
|
||||
printf " rc: Install Rust crates.\n"
|
||||
printf " d: Apply default settings.\n"
|
||||
printf " s: Setup installed software.\n"
|
||||
|
||||
@@ -188,6 +188,19 @@ install_program() {
|
||||
}
|
||||
export -f install_program
|
||||
|
||||
# Installs Ruby.
|
||||
# Parameters: None.
|
||||
install_ruby() {
|
||||
local version="$(cat $HOME/.ruby-version | tr -d '\n')"
|
||||
|
||||
if [[ ! -x "$(command -v ruby)" && -n $(ruby --version | grep --quiet "$version") ]]; then
|
||||
$(get_homebrew_bin_root)/ruby-install "ruby-$version"
|
||||
chruby "$version"
|
||||
gem update --system && gem update
|
||||
fi
|
||||
}
|
||||
export -f install_ruby
|
||||
|
||||
# Installs Rust.
|
||||
# Parameters: None.
|
||||
install_rust() {
|
||||
|
||||
@@ -22,6 +22,8 @@ process_option() {
|
||||
bin/install_applications;;
|
||||
'x')
|
||||
bin/install_extensions;;
|
||||
'rg')
|
||||
bin/install_ruby_gems;;
|
||||
'rc')
|
||||
bin/install_rust_crates;;
|
||||
'd')
|
||||
@@ -37,6 +39,7 @@ process_option() {
|
||||
bin/install_app_store
|
||||
bin/install_applications
|
||||
bin/install_extensions
|
||||
bin/install_ruby_gems
|
||||
bin/install_rust_crates
|
||||
bin/apply_default_settings
|
||||
bin/setup_software
|
||||
@@ -50,6 +53,7 @@ process_option() {
|
||||
verify_app_store_applications
|
||||
verify_applications
|
||||
verify_extensions
|
||||
verify_ruby_gems
|
||||
verify_rust_crates;;
|
||||
'C')
|
||||
caffeinate_machine;;
|
||||
|
||||
@@ -127,6 +127,23 @@ verify_path() {
|
||||
}
|
||||
export -f verify_path
|
||||
|
||||
# Checks for missing Ruby gems.
|
||||
verify_ruby_gems() {
|
||||
local gems="$(gem list --no-versions)"
|
||||
|
||||
printf "\nChecking Ruby gems...\n"
|
||||
|
||||
while read line; do
|
||||
if [[ "$line" == "gem install"* ]]; then
|
||||
local gem=$(printf "$line" | awk '{print $3}')
|
||||
verify_listed_application "$gem" "${gems[*]}"
|
||||
fi
|
||||
done < "$MAC_OS_CONFIG_PATH/bin/install_ruby_gems"
|
||||
|
||||
printf "Ruby gems check complete.\n"
|
||||
}
|
||||
export -f verify_ruby_gems
|
||||
|
||||
# Checks for missing Rust crates.
|
||||
verify_rust_crates() {
|
||||
printf "\nChecking Rust crates...\n"
|
||||
|
||||
Reference in New Issue
Block a user