Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better system for updating Rticles Document templates that are bundled with the app #445

Open
chrismear opened this issue Aug 18, 2013 · 1 comment

Comments

@chrismear
Copy link
Member

Rticles Documents that are used as templates by One Click Orgs are currently shipped with the app as YAML files. Rails' seed.db is used to load these documents into the database for subsequent use by the app as templates.

If the YAML file is updated, the administrator of an instance of OCO needs to manually re-run the DB seed task in order for the template in the database to be updated to the latest version.

It would be better if this process was automated somehow.

@chrismear
Copy link
Member Author

I don't think rake db:seed is really supposed to be run multiple times on a single database. So using it to update our Document is inappropriate. We can still use it for initially preparing the database when it is created, but updates should be handled elsewhere.

Two possible places: a custom script invoked by our Capistrano deployment recipe (this would take care of deploys, but wouldn't help a developer keep their development environment up-to-date when pulling in the latest code); at runtime, check if the document in DB matches the document on disk in the YAML file, and update if necessary (no manual interaction required, but would set off a potentially slow operation in production).

How can we check if the document in DB is out-of-date compared to the YAML version? Manual versioning (e.g. the developer changes the title attribute of the document when the document changes) is an easy option to implement. More sophisticated might be to store a hash of the YAML file with the Document record in the DB, and use that to check if the YAML has been changed since the Document record was created.

@chrismear chrismear added this to the coop milestone Feb 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant