By making the template idempotent, it makes it possible to iterate and continue adding optional features to the template, with downstream users being able to benefit from these improvements by re-running it against their project.
This change makes it possible to run the template against an existing project. It will skip over any already applied changes:
$ rails new --skip-bundle --skip-jbuilder --skip-test --skip-action-text --skip-action-mailer --skip-action-mailbox \
-m rails-template/template.rb test-project
$ cd test-project
$ bin/rails app:template LOCATION=../rails-template/template.rb
run bundle install from "."
identical Procfile.dev
identical bin/dev
run chmod +x bin/dev from "."
identical app/assets/config/manifest.js
identical package.json
remove app/assets/stylesheets/application.css
identical app/assets/stylesheets/application.scss
identical app/javascript/application.js
identical app/views/layouts/application.html.erb
exist app/assets/builds
run yarn from "."
$ git status
On branch main
nothing to commit, working tree clean
A follow-up PR will document this feature and add a bin/template script to newly bootstrapped projects to make it easy to re-run the template.
By making the template idempotent, it makes it possible to iterate and continue adding optional features to the template, with downstream users being able to benefit from these improvements by re-running it against their project.
This change makes it possible to run the template against an existing project. It will skip over any already applied changes:
A follow-up PR will document this feature and add a
bin/template
script to newly bootstrapped projects to make it easy to re-run the template.