Ruby
Instale e gerencie Ruby localmente (Windows, macOS, Linux) usando instaladores ou gerenciadores de versão; use Bundler para dependências.
🧾 Visão Geral
Ruby é usado para bots, APIs (Sinatra) e frameworks completos (Rails). A instalação local permite gerenciar gems e testar antes de fazer o upload.
📥 Instalação (escolha uma)
Baixe o Ruby+Devkit mais recente (x64) de https://rubyinstaller.org/downloads/
Execute o instalador (habilite MSYS2 quando solicitado).
Deixe o script pós-instalação terminar (configuração da toolchain).
Verifique e instale bundler
ruby -v
gem -v
gem install bundler
bundler -vInicialize projeto (opcional)
bundle init
bundle installsudo apt update
sudo apt install -y ruby-full build-essential
ruby -v
gem -v
gem install bundlersudo dnf install -y ruby ruby-devel @development-tools
ruby -v
gem -v
gem install bundlersudo pacman -S --needed ruby base-devel
ruby -v
gem -v
gem install bundlerDependências (exemplo Debian):
sudo apt update
sudo apt install -y build-essential libssl-dev libreadline-dev zlib1g-dev \
libyaml-dev libffi-dev libgdbm-dev libncurses5-dev libsqlite3-devInstalar rbenv + ruby-build:
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
rbenv install 3.3.0
rbenv global 3.3.0
ruby -v
gem install bundlerbrew update
brew install ruby
echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
ruby -v
gem -v
gem install bundlerbrew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
source ~/.zshrc
rbenv install 3.3.0
rbenv global 3.3.0
ruby -v
gem install bundler✅ Verificação
ruby -v
gem -v
bundler -vTodos os comandos devem mostrar versões.
💎 Gerenciando Gems
Inicializar
bundle initAdicionar ao Gemfile
gem "httparty"Instalar / atualizar
bundle install
bundle update httpartyExecutar script com ambiente bloqueado
bundle exec ruby app.rb🔄 Atualização
Ruby (rbenv)
rbenv install <version> && rbenv global <version>
Todas gems
bundle update
Uma gem
bundle update <name>
Bundler
gem install bundler
🗃 Comandos Comuns
gem list
gem install <name>
gem uninstall <name>
bundle init
bundle install
bundle update
bundle exec ruby main.rbLast updated