File Operations

Chmod file

File.chmod(0600, file)

Resource: https://stackoverflow.com/questions/22707040/change-permissions-of-file-in-ruby

Move file without fileutils

File.rename source_path, target_path

Resource: https://stackoverflow.com/questions/403239/how-do-i-move-a-file-with-ruby

Fix extensions not built errors

Run this command:

gem pristine --all

Resource: https://stackoverflow.com/questions/48339706/ignoring-gems-because-its-extensions-are-not-built

Multiline comments

=begin
stuff
=end

Resource: https://stackoverflow.com/questions/2989762/multi-line-comments-in-ruby

Install specific version of a gem

Install the bcrypt_pbkdf package that came before version 2.0.

gem install bcrypt_pbkdf -v '<2.0'

Don’t install docs with gem by default

echo 'gem: --no-document' >> ~/.gemrc

Resource: https://stackoverflow.com/questions/1381725/how-to-make-no-ri-no-rdoc-the-default-for-gem-install


RVM

Install rvm and ruby

VER=3.2.1
gpg --keyserver keyserver.ubuntu.com \
    --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable --ruby
rvm install ruby-"${VER}"

Install specific ruby version and use by default

VER=3.2.1
rvm install $VER
rvm use $VER --default