watermarkchurch / wcc-contentful

An alternative to Contentful's contentful.rb ruby client, contentful_model, and contentful_rails gems all in one.
MIT License
2 stars 1 forks source link

`validate_models!` should be in a rake task #40

Closed gburgett closed 4 years ago

gburgett commented 6 years ago

Currently, the initialization template drops WCC::Contentful.validate_models! in the initializer wcc-contentful.rb. This means it gets run during every task that requires the Rails environment, not just rails server.
i.e. rails console, rake db:migrate etc. will fail if model validation fails.

Realistically, we want this to be a built-in-test that runs on deployments, after Contentful migrations have happened. This means it should be executed by Heroku inside bin/release, not on app startup.

Create a rake task that validates the models, and then update the sample bin/release such that it inserts the following commands before rake db:migrate:

$DIR/contentful migrate -y
bundle exec rake wcc:contentful validate  # or whatever you want to name it