Closed mttjohnson closed 6 years ago
@jasonvarga Is this something you could consider adding? It would be great if Spock would detect not only changed but also deleted pages, collections etc. As well it would be awesome if we could have assets to commit as well. My goal is to always have the same content in development as in production.
We are also interested in this feature :)
🖖
Spock 2.0 should do it! 🎉
My intention for using the spock addon was for the purpose of using Git to automatically commit and push any changes up to a repo for change management purposes, and in trying to set this up I found a few things I had to adjust to make it work the way I wanted, and thought I'd let anyone else know in the event anyone else is wanting to use it for the same purpose.
I found that the
git add {{ full_path }}
command didn't work correctly, so I switched to trying to usegit add .
and found that while that added new files and updated existing ones, it did not remove any of the deleted files. I found that I could usegit add --all
in order to also catch any deleted files.After finding something that would catch deleted files for the git command when the events fired I quickly found while testing that the event wasn't getting triggered when pages were deleted, which I felt was worth trying to catch. I found that I could add
PageDeleted::class => 'run'
to the$events
array inSpockListener.php
but that it had a few issues with the code later in thecommands()
function that referenced properties on$this->data
passed in from the event. Since I wasn't using any of the properties on$this->data
I just went ahead and commented those lines out and was able to get it to catch deletions and commit them whenever they happened also.SpockListener.php
spock.yml
I'd be curious to know if anyone else has come up with any better way of managing changes in the control panel to automatically get put back into a git repo for change management purposes.
We'd like to be able to use this so we have one site as a staging/development site to prepare content and changes, test it, get it approved, and then be able to issue pull requests to take a specific commit or branch (develop) over into production (master) on a separate environment.