Created
June 23, 2025 10:38
-
-
Save pedrocarmona/cc1b2a42382f312f1cc031116cc1f292 to your computer and use it in GitHub Desktop.
Init repo for prototypes or interviews
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setopt interactive_comments | |
# Option 1: | |
# bundle gem calculator | |
# Option 2: | |
mkdir calculator | |
cd calculator | |
rbenv local 3.4.4 | |
bundle init | |
git init | |
echo "\n.DS_Store" >> .gitignore | |
echo "# README\n\n- TODO:" >> README.md | |
git add .ruby-version Gemfile Gemfile.lock .gitignore README.md git commit -m "setup: initialize repo" | |
bundle add rspec-rails -g development,test | |
bundle exec rspec --init echo "spec/examples.txt" >> .gitignore | |
git add .rspec spec/spec_helper.rb Gemfile Gemfile.lock .gitignore | |
git commit -m "test: init rspec" | |
bundle add rubocop-rails-omakase -g development,test | |
echo "inherit_gem: { rubocop-rails-omakase: rubocop.yml }" >> .rubocop.yml | |
git commit -m "lint: init omakase" | |
mkdir lib | |
echo "class Calculator\n def sum(a, b)\n a + b\n end\nend\n" >> lib/calculator.rb | |
echo "require 'calculator'\n\nRSpec.describe 'Calculator' do\n subject(:calculator) { Calculator.new }\n describe 'sum' do\n it 'sums 2 arguments' do\n result = calculator.sum(2, 3)\n expect(result).to eq(5)\n end\n end\nend\n" >> spec/calculator_spec.rb | |
bundle exec rspec | |
bundle exec rubocop -A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment