Skip to content

Instantly share code, notes, and snippets.

@mm53bar
Created November 21, 2019 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mm53bar/3deeb4fc9684ef7f595c465b528f8481 to your computer and use it in GitHub Desktop.
Save mm53bar/3deeb4fc9684ef7f595c465b528f8481 to your computer and use it in GitHub Desktop.
Makefile for a Rails app
.PHONY: serve live-reload db-reset db-setup db-migrate init deps compile bundle yarn clean
serve: init deps compile db-setup db-migrate
rails server
live-reload: yarn
./bin/webpack-dev-server --host 127.0.0.1
db-reset:
bundle exec rake db:reset
db-setup: .make.db-setup
db-migrate: .make.db-migrate
init: .make.init
deps: bundle yarn
compile: .make.webpacker
bundle: .make.bundle
yarn: .make.yarn
clean:
rm .make.*
.make.webpacker: $(shell find app/javascript -type f)
./bin/webpack
touch .make.webpacker
.make.db-setup: .make.bundle
bundle exec rake db:setup
touch .make.db-setup
.make.db-migrate: .make.bundle $(shell find db/migrate -type f)
bundle exec rails db:migrate
touch .make.db-migrate
.make.bundle: Gemfile
bundle
touch .make.bundle
.make.yarn: package.json
yarn
touch .make.yarn
.make.init:
gem install bundler
touch .make.init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment