3 * let's see if we can pull a list of tickets from the tracker..
7 GI = imports.gi.GIRepository
8 GLib = imports.gi.GLib;
10 // we add this in, as it appears to get lost sometimes if we set it using the ENV. variable in builder.sh
11 GI.IRepository.prepend_search_path(GLib.get_home_dir() + '/.Builder/girepository-1.1');
13 Soup = imports.gi.Soup ;
16 File = imports['../File.js'].File;
20 parseNetrc : function()
23 // very basic parsing - only support single line version..
24 var lines = File.read(GLib.get_home_dir() + '/.netrc').split(/\n/);
26 lines.forEach(function(l) {
27 if (!l.match(/^machine/)) {
30 var ar = l.split(/\s+/);
31 // assume machine XXX login XXX password XXXX
32 t.machines[ar[1]] = { login : ar[3], password: ar[5]}
38 fetchBugs : function(url)
41 var ar = url.split('/');
42 print(JSON.stringify(ar, null, 4));
43 var auth = new Soup.Auth()
44 var session = new Soup.SessionSync();
45 session.signal.authenticate.connect(function(sess, msg, auth, rt) {
46 //print("authenticate?");
48 Tickets.machines[ar[2]].login,
49 Tickets.machines[ar[2]].password
52 var request = new Soup.Message({
54 uri:new Soup.URI.c_new(url)
56 var status = session.send_message(request);
58 var data = request.response_body.data;
59 return JSON.parse(data).data;
68 //print ( JSON.stringify(Tickets.machines) );
73 //Tickets.fetchBugs("http://www.roojs.com/mtrack/index.php/Gitlive/web.hex");