Skip to content

Instantly share code, notes, and snippets.

@waleo
waleo / ruby-2-5-9-install.sh
Last active January 23, 2024 22:45
How to install Ruby 2.5.9 on newer systems
# On Jan 23 2024, I had a very difficult time installing ruby 2.5.9 on my Manjaro Linux system using rbenv.
# I already had openssl 1.1 installed, yet I had difficulty getting rbenv to use the correct openssl.
# I also installed the latest version of ruby-build which did not seem to help
# This is what helped. I created a shell script with the following content, did chmod u+x and ran it:
# This was adapted from here for my Linux system: https://github.com/rbenv/ruby-build/issues/1691#issuecomment-777102931
export LDFLAGS="-L/lib/openssl-1.1"
export CPPFLAGS="-L/lib/openssl-1.1"
export PKG_CONFIG_PATH="/lib/openssl-1.1/pkgconfig"
# Some helpfuld sed commands for upgrading from Rails 2.3.18 to Rails 3.0.0.
# Not a complete list
# Written for OSX.
# Changelog:
# 2019/12/19: Initial commit
# DEPRECATED ENV VARS
sed -i '' -E "s|RAILS_ROOT|Rails.root.to_s|" app/**/*rb
sed -i '' -E "s|RAILS_ROOT|Rails.root.to_s|" config/*rb
sed -i '' -E "s|RAILS_ENV|Rails.env|" lib/**/*rake
@waleo
waleo / db_backup.cap
Created December 30, 2013 20:23
Capistrano 3 task for database backup
desc "Backup the database"
namespace :db do
task :backup do
on roles(:db) do |host|
backup_path = "#{fetch(:deploy_to)}/backups"
execute :mkdir, "-p #{backup_path}"
basename = 'database'
username, password, database, host = get_remote_database_config(fetch(:stage))
debug "#{username}, #{password}, #{database}"