*
*
*/
-GI = imports.gi.GIRepository;
+<<<<<<< HEAD
+GI = imports.gi.GIRepository
+GLib = imports.gi.GLib;
+
+// we add this in, as it appears to get lost sometimes if we set it using the ENV. variable in builder.sh
+GI.IRepository.prepend_search_path(GLib.get_home_dir() + '/.Builder/girepository-1.1');
+
Gio = imports.gi.Gio;
-GLib = imports.gi.GLib;
Gtk = imports.gi.Gtk;
Notify = imports.gi.Notify;
+=======
+var GI = imports.gi.GIRepository;
+var Gio = imports.gi.Gio;
+var GLib = imports.gi.GLib;
+var Gtk = imports.gi.Gtk;
+var Notify = imports.gi.Notify;
+>>>>>>> e9aa44647c32a34dfa368f7594ed72579c912bc3
-Spawn = imports.Spawn;
-Git = imports.Git;
-StatusIcon = imports.StatusIcon.StatusIcon;
-Monitor = imports.Monitor.Monitor;
+var Spawn = imports.Spawn;
+var Git = imports.Git;
+var StatusIcon = imports.StatusIcon.StatusIcon;
+var Monitor = imports.Monitor.Monitor;
//File = imports[__script_path__+'/../introspection-doc-generator/File.js'].File
Gtk.init (null, null);
-
+
var gitlive = GLib.get_home_dir() + "/gitlive";
if (!GLib.file_test(gitlive, GLib.FileTest.IS_DIR)) {
queue : [],
queueRunning : false,
- nqv : false, // temp var while I switch to queued version.
-
+
start: function() {
var _this = this;
this.lastAdd = new Date();
body : gitlive + "\nMonitoring " + this.monitors.length + " Directories"
});
- notification.set_timeout(500);
+ notification.set_timeout(2000);
notification.show();
},
/**
var success = [];
var failure = [];
var repos = [];
+ var done = [];
cmds.forEach(function(cmd) {
+ // prevent duplicate calls..
+ if (done.indexOf(cmd.join(',')) > -1) {
+ return;
+ }
+ done.push(cmd.join(','));
+
if (repos.indexOf(cmd[0]) < 0) {
repos.push(cmd[0]);
+ Git.run(cmd[0] , 'pull'); // pull before we push!
}
var sp = Git.run.apply(Git,cmd);
});
-
// push upstream.
repos.forEach(function(r) {
var sp = Git.run(r , 'push', { all: true } );
});
- notification.set_timeout(500);
+ notification.set_timeout(2000);
notification.show();
}
if (failure.length) {
});
- notification.set_timeout(500);
+ notification.set_timeout(5000); // show errros for longer
notification.show();
}
this.queueRunning = false;
[ src.gitpath, 'commit', src.vpath, { message: src.vpath} ]
);
- if (this.nqv) {
-
- Git.run(src.gitpath, 'add', src.vpath);
- var sp = Git.run(src.gitpath, 'commit', { all: true, message: src.vpath});
- Git.run(src.gitpath , 'push', { all: true } );
- notify(src.name,"CHANGED", sp);
- }
+
return;
}
this.lastAdd = new Date();
);
- if (this.nqv) {
- var sp = Git.run(src.gitpath, 'commit', { all: true, message: src.vpath});
- Git.run(src.gitpath , 'push', '--all' );
- notify(src.name,"CHANGED", sp);
- }
+
},
onDeleted : function(src)
[ src.gitpath, 'commit', { all: true, message: src.vpath} ]
);
- if (!this.nqv) {
- return;
- }
-
- var sp = Git.run(src.gitpath,'rm' , src.vpath);
- Git.run(src.gitpath , 'push', { all: true } );
- if (sp.status !=0) {
- notify(src.name,"DELETED", sp);
- return;
- }
- sp = Git.run(src.gitpath,'commit' ,{ all: true, message: src.vpath});
- Git.run(src.gitpath , 'push',{ all: true });
- notify(src.name,"DELETED", sp);
- return;
+
},
onCreated : function(src)
[ src.gitpath, 'commit' , { all: true, message: src.vpath} ]
);
- if (!this.nqv) {
- return;
- }
- var sp = Git.run(src.gitpath, 'add', src.vpath);
- Git.run(src.gitpath , 'push', { all: true } );
-
- if (sp.status !=0) {
- notify(src.path,"CREATED", sp);
- return;
- }
- //uh.call(fm,f,of, event_type);
- sp = Git.run(src.gitpath,'commit' , { all: true, message: src.vpath});
- Git.run(src.gitpath , 'push', { all: true } );
- notify(src.path,"CREATED", sp);
- return;
+
},
onAttributeChanged : function(src) {
this.queue.push(
[ src.gitpath, 'commit' , src.vpath, { message: src.vpath} ]
);
- if (!this.nqv) {
- return;
- }
- var sp = Git.run(src.gitpath, 'commit',{ all: true, message: src.vpath});
- Git.run(src.gitpath , 'push', { all: true } );
- notify(src.path,"ATTRIBUTE_CHANGED", sp);
- return;
+
},
[ src.gitpath, 'commit' , src.vpath, dest.vpath ,
{ message: 'MOVED ' + src.vpath +' to ' + dest.vpath} ]
);
-
- if (!this.nqv) {
- return;
- }
-
- var sp = Git.run(src.gitpath, 'mv', '-k', src.vpath, dest.vpath);
- if (sp.status !=0) {
- notify(dest.path,"MOVED", sp);
- return;
- }
- sp = Git.run(src.gitpath,'commit' , { all: true, message: 'MOVED ' + src.vpath +' to ' + dest.vpath} );
- Git.run(src.gitpath , 'push', { all: true } );
- notify(src.path,"MOVED", sp);
-
+
}
});
-
-
-function notify(fn, act , sp)
-{
- var sum = act + " " + fn;
-
- var notification = new Notify.Notification({
- summary: sum,
- body : sp
- });
-
- notification.set_timeout(500);
- notification.show();
-}
-
-
-
function errorDialog(data) {
//
// need a better icon...
-StatusIcon.init();
+
+StatusIcon.init();
+
+
Notify.init("gitlive");
+
monitor.add(GLib.get_home_dir() + "/gitlive");
monitor.start();
Gtk.main();