Changed MergeBranch.bjsMergeBranch.vala
[gitlive] / tests / tickets.js
index 81bc376..5577311 100644 (file)
@@ -3,8 +3,14 @@
  * let's see if we can pull a list of tickets from the tracker..
  *
  */
+
+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');
+
+Soup = imports.gi.Soup ;
 
 
 File = imports['../File.js'].File;
@@ -27,11 +33,42 @@ Tickets = {
         });
         
         
+    },
+    
+    fetchBugs : function(url)
+    {
+        Tickets.parseNetrc();
+        var ar = url.split('/');
+        print(JSON.stringify(ar, null, 4));
+        var auth = new Soup.Auth()
+        var session = new Soup.SessionSync();
+        session.signal.authenticate.connect(function(sess, msg, auth, rt) {
+            //print("authenticate?");
+            auth.authenticate(
+                    Tickets.machines[ar[2]].login,
+                    Tickets.machines[ar[2]].password
+            );
+        });
+        var request = new Soup.Message({
+                method:"GET",
+                uri:new Soup.URI.c_new(url)
+            });
+        var status = session.send_message(request); 
+        
+        var data = request.response_body.data;
+        return JSON.parse(data).data;
+        
     }
     
     
+    
 }
 
-Tickets.parseNetrc();
-print ( JSON.stringify(Tickets.machines) );
 
+//print ( JSON.stringify(Tickets.machines) );
+
+
+
+
+//Tickets.fetchBugs("http://www.roojs.com/mtrack/index.php/Gitlive/web.hex");
\ No newline at end of file