docker run --rm -it -v ${PWD}:/usr/src -w /usr/src ruby:3.2.1 sh -c 'gem install rails:"~>7.0.4" && rails new --database=postgresql <app_name>'cdinto project directory
| #!/bin/bash | |
| # Execute tests (Minitest, Brakeman) before committing; aborts push if any | |
| # test fails. | |
| # By ggaona | |
| # Execute brakeman | |
| echo "[Brakeman]" | |
| bundle exec brakeman --color | |
| # Docker alternative |
| #!/bin/bash | |
| # Execute Rubocop before committing; aborts commit if any offense is found. | |
| # By ggaona | |
| # Get files to be analyzed (all staged files with '.rb' or '.rake' extension; | |
| # ignores 'schema.rb', migrations and deleted files) | |
| STAGED_FILES=$(git diff --name-status --cached | grep -E '\.rb|\.rake' | grep -Ev 'D|schema.rb|migrate') | |
| # Get total count of files to be analyzed |
| #!/bin/bash | |
| # Backup multiple MySQL databases (in same host) via `mysqldump`. | |
| # By ggaona | |
| # | |
| # Requirements: | |
| # | |
| # + mysqldump | |
| # + MySQL password provided in '.my.cnf' file; example file: | |
| # |