re-apply changes from /tmp
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 1 Jun 2010 18:30:38 +0000 (20:30 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 1 Jun 2010 18:30:38 +0000 (20:30 +0200)
script/changes [new file with mode: 0755]

diff --git a/script/changes b/script/changes
new file mode 100755 (executable)
index 0000000..46ea6cc
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Storable;
+use Mojo::Client;
+
+my $url = 'http://localhost:3000/data/edit';
+my $max = 1;
+
+my $t = Mojo::Client->new;
+$t->max_redirects( 1 );
+
+foreach my $c ( glob '/tmp/changes/*.data.edit' ) {
+
+       print "# $c\n";
+
+       my $params = retrieve $c;
+
+       my $tx = $t->post_form( $url => $params->to_hash );
+       if ( my $res = $tx->success) { print $res->body }
+       else {
+               my ($code, $message) = $tx->error;
+               die "Error: $message";
+       }
+
+#      last if $max-- == 0;
+}