Trigger a git commit for static site generator

I build a small static site generator: just PUT markdown from a textarea
to a git versioned file and post-commit markdown.sh (and little bit
templating) to html for nginx.

The only thing I miss the commit triggerd by nginx after the PUT.

I tried it with shell ect^1 and even netcat :wink: but nothing worked
really nice.

Is there an easy way to commit via nginx?

thx
klml

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,229477,229477#msg-229477

This *might *work (and can be dangerous IMO):

x="tail -f /usr/local/nginx/logs/access.log |grep PUT |sed 's/["]//g' |awk {'print $5'}"; while x=“PUT”; do git commit -m “Hello Igor”; done

Your logs would have to be formated like this:

8.8.8.8 foo.bar.netdna-cdn.com [08/Aug/2012:22:41:23 +0000] "PUT …
4.2.2.2 bar.foo.netdna-cdn.com [08/Aug/2012:22:41:23 +0000] "PUT …

Regards,

Justin D. http://www.twitter.com/jdorfman

NetDNA http://www.netdna.com
The Science of Acceleration

Hi Justin,

thank you for this answer

… (and can be dangerous IMO):
x="`tail -f /usr/local/nginx/logs/access.log |grep PUT |sed ‘s/["]//g’
|awk

using tail on logs for this is very freaky;) but its a thinkable
approach.

To get only PUT requests I used an extra PUT log in the nginx config:

    if ($request_method = PUT) {
        access_log /var/log/nginx/accessPUT.log;
    }

so I dont need to grep.

Unfortunately I dont “get over” the forced tail

x="tail -f /var/log/nginx/accessPUT.log";
c=“PUT” //to start an endless loop
while c=“PUT”; //
do
echo $x;
#~ git commit -m “Hello Igor”;
done

gave me noting, I expected the lines from the log.

At the moment I use, not-out-of-the-box;(, inotifywait but this works :wink:
But I will think more about tail

http://stackoverflow.com/questions/420143/making-git-auto-commit

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,229477,229546#msg-229546

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs