2 XObject = imports.XObject.XObject;
3 XMLHttpRequest = imports.XMLHttpRequest.XMLHttpRequest;
4 Netrc = imports.Netrc.Netrc;
5 Date = imports.Date.Date;
13 * => Tasks.notify(commit)
23 commitRepo : false, // the DB version of repo info..
26 notify : function(commit)
29 // ignore the notification.. we are currently checking what the current
34 this.lastCommit = commit;
41 // have we got the status in the last 15 mins..
42 // we should not need to get it again... - it's probably not changed.
43 if (this.curTask && !this.curTask.hasExpired()) {
47 // do the request to get the task..
48 var r = new XMLHttpRequest({
49 onreadystatechange : function() {
51 if (this.status != 4) {
56 var res = JSON.parse(this.responseText);
58 //print(JSON.stringify(res,null,4))
59 //print([ res.success , res.data.length ]);
60 _this.curTask = (res.success && res.data.length) ? (new Task(res.data[0])) : false;
61 print(JSON.stringify(_this.curTask,null,4));
66 var netrc = Netrc.forHost('git.roojs.com');
69 "http://roojs.com/admin.php/Roo/cash_invoice_entry?_current_task=1"
70 ,true, netrc.login, netrc.password );
71 //print("SEding request");
76 verifyCommit : function()
78 // using curTask + lastCommit decide what to do.
88 repoProject: function(repo)
91 var r = new XMLHttpRequest({
92 onreadystatechange : function() {
94 if (this.status != 4) {
99 var res = JSON.parse(this.responseText);
101 //print(JSON.stringify(res,null,4))
102 //print([ res.success , res.data.length ]);
103 _this.commitRepo = (res.success && res.data.length) ? currRepores.data[0] : false;
104 print(JSON.stringify(_this.commit))
105 _this.verifyCommit();
109 var netrc = Netrc.forHost('git.roojs.com');
112 "http://roojs.com/admin.php/Roo/mtrack_repo?name=" + repo.name
113 ,true, netrc.login, netrc.password );
114 //print("SEding request");
131 Task = XObject.define(
134 if (typeof(cfg) != 'object') {
135 print("CFG not oboject?");
138 XObject.extend(this,cfg);
140 // fix up the values.
141 this.action_datetime = Date.parseDate(this.action_dt,'Y-m-d H:i:s');
142 // print("ACT DT: " + this.action_dt);
148 * This is similar to the cash_invoice_entry data..
151 action_dt: '', //"2012-11-23 11:00:00"
152 description: '', //"QA on new site"
153 qtyvalue: 0, //"2.25"
155 hasExpired : function()
158 var exp = this.action_datetime.add(Date.HOUR, this.qtyvalue);
159 return (new Date()) > exp;
174 //-------------- testing
175 Gtk = imports.gi.Gtk;