skuid-grunt - push all pages changed in source control?

I’d like to be able to write a single command that would cause skuid-grunt to skuid-push all of the pages that are changed in source control to multiple targets. Any ideas?

In your video, you mention wanting to push files in that are in the list of unstaged files. Think of this as pushing the working state of your desk to production in real-life. At least in the case of my desk, that’s a no-no. You’re very likely going to want to not only stage those files, but commit them as some item of work, at which point you can employ git post-commit hooks to automatically run tasks such as a skuid-grunt push on the files changed in that commit using the commands listed in the url below.


Haha. Yes, you’re correct. I want to stage and commit the files, and then run skuid-grunt push. Thanks! I’ll see if I can dig through these.

Andreas (or anyone else)–

I’m having some trouble figuring out how/where I can link my skuid-push task to a post-commit hook so that I only push the files that were changed in the commit.

I found grunt-githooks, which seems nice.

I’ve added this to my grunt config:

githooks: {<br>&nbsp; &nbsp; &nbsp; skuidpages: {<br>&nbsp; &nbsp; &nbsp; &nbsp; 'post-commit': 'skuid-push',<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }

But I feel like I’m fumbling around in the dark here.
How can I specify which files I push?

Ideally, I’d like to recurse through the committed skuidpages and for each one set the grunt.option(‘module’) parameter and run skuid-push.

It looks from the documentation like there aren’t any arguments passed to a post-commit. But even if there were, how would I use them?

Can anyone point me in the right direction?

Looks like I can do something like this with grunt-githooks:

<br>githooks: {<br>&nbsp; &nbsp; &nbsp; skuidpages: {<br>&nbsp; &nbsp; &nbsp; &nbsp; 'post-commit': {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; taskNames:'skuid-push',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; args: '--module='+grunt.option('module')<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }

The challenge is still getting the list of pages involved in the commit.

I reccomend the following resource on setting up your git post-commit hook:

  • note that you can make this a (local) client-side config or a config on your remote

And the page I linked to earlier says the following:

When writing scripts around git, you should try to stick to the plumbing commands — their format is less likely to change and easier to parse. Here is a command which outputs the names of the paths which changed in a commit:

git diff-tree -r --name-only --no-commit-id That aside, you may wish to examine the index, as it contains timestamps about when the files were staged, which might give you an extra edge; however, I don’t believe there is a way to access this information.

And so, putting it all together, you want a git post-commit hook that runs a grunt task that fetches the list of files that were changed that “sets the grunt.option(‘module’) parameter and run[s] skuid-push” for each one of the pages (or all of them as a batch task).

Hopefully that solves your workflow issue!

Thanks, Andreas. I had read your link, but I was having difficulty fitting the pieces together. Apparently, sourcetree and grunt-githooks don’t play well together, so my githooks won’t run unless I run the commit from the command line.

For posterity, here’s my grunt githooks config:

‘githooks’: {
      skuidpages: {
        ‘post-commit’: ‘post-commit-skuidpages’

simple as that. The complicated part is the tasks themselves. I’m sure there’s a better way to write these, but this works. The first task will stage and commit all changed files. This will launch run

//Git & Githooks Tasks
  grunt.registerTask(‘commit’, ‘Stage and Commit changes.’, function(message){
    if (!message) {‘Include your commit message int he form commit:“message”’);
    var execSync = require(‘child_process’).execSync;
    var message = ‘“”’ + message + ‘“”’;
    var output = execSync('git commit -a -m ‘+ message);
  grunt.registerTask(‘post-commit-skuidpages’, function(){
    var execSync = require(‘child_process’).execSync;
    var paths = String(execSync(‘git diff-tree -r --name-only --no-commit-id master’)).split(’
        if (path.startsWith(‘skuidpages’)) {
      function(){return true;}

Ah yes, that true! Some tools like Github Desktop, and well, SourceTree now, don’t play well with git hooks. I can only recommend the official git tools Git Kraken also reportedly works with some git hooks, though not all and is worth a try as its quite a nice git client