Last active
January 16, 2022 07:03
-
-
Save smapira/cc6a50f82cea034b07f02088c06b65dd to your computer and use it in GitHub Desktop.
Makefile for new rails project
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
# curl https://gist.githubusercontent.com/smapira/cc6a50f82cea034b07f02088c06b65dd/raw --output Makefile | |
## ============================== | |
## database organizations | |
## ============================== | |
drop-db: | |
bundle exec rails db:environment:set RAILS_ENV=development && bundle exec rake db:drop | |
create-db: | |
bundle exec rake db:create | |
migrate-db: | |
bundle exec rake db:migrate_custom | |
import-seed: | |
bundle exec rake db:seed | |
drop-db-spring: | |
bundle exec rails db:environment:set RAILS_ENV=development && bundle exec spring rake db:drop | |
create-db-spring: | |
bundle exec spring rake db:create | |
migrate-db-spring: | |
bundle exec spring rake db:migrate_custom | |
import-seed-spring: | |
bundle exec spring rake db:seed | |
import-seed-ken-all: | |
bundle exec rake ken_all:import:silent | |
drop-db-production: | |
RAILS_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1 bundle exec rake db:drop | |
create-db-production: | |
RAILS_ENV=production bundle exec rake db:create | |
migrate-db-production: | |
RAILS_ENV=production bundle exec rake db:migrate_custom | |
import-seed-production: | |
RAILS_ENV=production bundle exec rake db:seed | |
import-seed-ken-all-production: | |
RAILS_ENV=production bundle exec rake ken_all:import:silent | |
drop-db-test: | |
RAILS_ENV=test bundle exec rake db:drop | |
create-db-test: | |
RAILS_ENV=test bundle exec rake db:create | |
drop-db-test-spring: | |
RAILS_ENV=test bundle exec spring rake db:drop | |
create-db-test-spring: | |
RAILS_ENV=test bundle exec spring rake db:create | |
migrate-db-test: | |
RAILS_ENV=test bundle exec rake db:migrate_custom | |
dump-seed: | |
bundle exec rake db:seed:dump | |
import-seed-test: | |
RAILS_ENV=test bundle exec rake db:seed | |
migrate-db-test-spring: | |
RAILS_ENV=test bundle exec spring rake db:migrate_custom | |
import-seed-test-spring: | |
RAILS_ENV=test bundle exec spring rake db:seed | |
## ============================== | |
## installations | |
## ============================== | |
fetch-rubocop: | |
curl https://gist.githubusercontent.com/smapira/d07bd6464241cc559bef1548895b9af0/raw --output .rubocop.yml | |
fetch-makefile: | |
curl https://gist.githubusercontent.com/gambala/4874e2b41a52ac043a274a61f5d7726b --output Makefile | |
fetch-gemfile: | |
curl https://gist.githubusercontent.com/smapira/2dbc861e4212a2f86c3e0d09a7c6de27/raw --output Gemfile | |
fetch-ignore: | |
curl https://gist.githubusercontent.com/smapira/a687e254eb10aa521cd1201c657af814/raw --output .gitignore | |
fetch-ci: | |
mkdir .circleci | |
curl https://gist.githubusercontent.com/smapira/b95f4cce9a78e9e256d2cb58f8c44084/raw --output .circleci/config.yml | |
install-bundle: | |
bundle install --path vendor/bundle --jobs 4 | |
install-spec: | |
bundle exec rails generate rspec:install | |
install-annotate: | |
bundle exe rails generate annotate:install | |
install-bullet: | |
bundle exec rails generate bullet:install | |
install-rack-profiler: | |
bundle exec rails generate rack_profiler:install | |
install-delayed-job: | |
bundle exec rails generate delayed_job:active_record | |
## ============================== | |
## executions | |
## ============================== | |
lint: | |
bundle exec rubocop -A -c .rubocop.yml | |
lint-spring: | |
bundle exec spring rubocop -A -c .rubocop.yml | |
mailcatcher: | |
bundle exec mailcatcher && open http://localhost:1080/ | |
run-console: | |
bundle exec rails console | |
run-server: | |
RAILS_ENV=production bundle exec rails s -b 0.0.0.0 -p 3000 -d | |
terminate-server: | |
kill -9 $(cat tmp/pids/server.pid) | |
run-listen: | |
bundle exec rake listen_information:xml | |
run-spring: | |
./bin/spring server | |
terminate-spring: | |
./bin/spring stop | |
convert-html-slim: | |
bundle exec html2slim app/views | |
convert-erb-slim: | |
bundle exec erb2slim app/views | |
open-letter-opener: | |
open http://0.0.0.0:3000/letter_opener | |
factory-model: | |
bundle exec rails g factory_bot:model Car name speed:integer | |
## ============================== | |
## audits | |
## ============================== | |
audit-security: | |
bundle exec brakeman | |
describe-route: | |
bundle exec annotate --routes | |
describe-annotate: | |
bundle exec annotate --delete && bundle exec annotate | |
audit-practices: | |
bundle exec rails_best_practices app/. | |
audit-schema: | |
bundle exec database_consistency | |
read-bullet-log: | |
tail -f log/bullet.log | |
## ============================== | |
## aliases | |
## ============================== | |
db-test: drop-db-test create-db-test migrate-db-test import-seed-test | |
db-test-spring: drop-db-test-spring create-db-test-spring migrate-db-test-spring import-seed-test-spring | |
configure: fetch-rubocop fetch-makefile fetch-gemfile fetch-ignore fetch-ci install-bundle configure-annotate | |
c: run-console | |
s: run-server | |
m: drop-db create-db migrate-db import-seed lint db-test | |
ms: drop-db-spring create-db-spring migrate-db-spring import-seed-spring db-test-spring | |
mp: drop-db-production create-db-production migrate-db-production import-seed-production |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment