Skip to content

Instantly share code, notes, and snippets.

@alissonviegas
Last active October 19, 2022 18:19
Show Gist options
  • Save alissonviegas/539fa32a0f0bc6249ba7a06a0dfd60a8 to your computer and use it in GitHub Desktop.
Save alissonviegas/539fa32a0f0bc6249ba7a06a0dfd60a8 to your computer and use it in GitHub Desktop.
Preparando o ambiente (pt-BR)

Preparação do ambiente de desenvolvimento das stacks utilizadas neste projeto.

Fonte: https://gorails.com/setup/ubuntu

Ruby on Rails

Instalando dependências:

sudo apt install curl
curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt-get update
sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn

Instalando Ruby com rbenv:

cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

rbenv install 3.1.0
rbenv global 3.1.0

ruby -v

Instalando Bundler:

gem install bundler

Instalando Rails:

gem install rails
rbenv rehash
rails -v

PostgreSQL

Instalando Postgres:

sudo apt install postgresql-11 libpq-dev

Criando usuário:

sudo -u postgres createuser <username> -s

Para que iniciar o serviço automaticamente, insira a linha abaixo no arquivo ~/.bashrc:

if ! pgrep -x 'postgres' >/dev/null; then
  sudo service postgresql start
fi

Redis

Instalando Redis:

sudo apt-get install redis

Para que iniciar o serviço automaticamente, insira a linha abaixo no arquivo ~/.bashrc:

redis-server --daemonize yes

Git/GitHub

Configurações globais do git:

git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR@EMAIL.com"
git config --global credential.helper store

Gerando chave SSH:

ssh-keygen -t rsa -b 4096 -C "YOUR@EMAIL.com"
cat ~/.ssh/id_rsa.pub

Copie a chave gerada por esse último comando. Acesse https://github.com/settings/ssh/new, informe um título, cole o id_rsa e clique em Add SSH key.

Testando o acesso:

ssh -T git@github.com

Você deve receber uma mensagem como esta:

Hi username! You've successfully authenticated, but GitHub does not provide shell access.

Acesse https://github.com/settings/tokens/new, defina uma nota, selecione o tempo de expiração e marque o checkbox repo. Em seguida clique em Generate token. O token gerado deve ser salvo local seguro e de acesso rápido, pois será solicitado em todos pull requests.

Brakeman

gem install brakeman

SimpleCov

Para abrir o coverage/index.html no browser do Windows, via terminal WSL, siga as instruções desta issue:
wslutilities/wslu#214 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment