aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-06-12 10:14:00 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-06-12 10:14:00 +0200
commit8915ed6b738fd605ab15798784c0c688b107855b (patch)
tree07744f4fab2710511f4114cdb9e638ed53eafd8e
parentb7d1189321fdcaee248d59573e53fdf2a6a2d1d9 (diff)
downloadbugzilla-triage-8915ed6b738fd605ab15798784c0c688b107855b.tar.gz
Even more simplification
-rw-r--r--lib/bzpage.js8
-rw-r--r--lib/main.js1
-rw-r--r--lib/rhbzpage.js12
-rw-r--r--lib/util.js5
-rw-r--r--tests/test-util.js2
5 files changed, 19 insertions, 9 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index 8395ba9..fb242d2 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -10,14 +10,12 @@ var simpleStorage = require("simple-storage");
// BZPage's methods
var BZPage = exports.BZPage = function BZPage(doc, config) {
- console.log("doc = " + doc.title);
- console.log("config = " + config);
-
// initialize dynamic properties
this.doc = doc;
console.log("Now we are inside!");
};
-BZPage.prototype.getBugId = function getBugId () {
- return util.getBugNo(this.doc.location.href);
+BZPage.prototype.getURL = function getURL () {
+ console.log("url = " + this.doc.location.href);
+ return this.doc.location.href;
};
diff --git a/lib/main.js b/lib/main.js
index 986670f..b298829 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -16,6 +16,7 @@ var util = require("util");
var file = require("file");
var myStorage = require("simple-storage").storage;
var browser = require("tab-browser");
+var JSONURL = "http://matej.ceplovi.cz/progs/data/RH_Data-packages.json";
var config = {};
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index 407d383..70186c9 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -15,10 +15,18 @@ var RHBugzillaPage = exports.RHBugzillaPage = function RHBugzillaPage(doc, confi
console.log("location = " + this.doc.location);
- this.bugId = this.getBugId();
+ //this.bugId = this.getBugId();
+ this.bugId = util.getBugNo(this.doc.location.href);
+ console.log("doc = " + this.doc.location);
console.log("bug number = " + this.bugId);
+ console.log("this = " + this);
+ console.log("prototype = " + this.prototype);
+ console.log("constructor = " + this.constructor);
+ console.log("this.getURL = " + this.getURL);
+ //this.bugId = this.getBugId();
+ console.log("bug URL = " + this.getURL());
console.log("Now we are outside!");
}; // END OF RHBugzillaPage CONSTRUCTOR
-RHBugzillaPage.prototype = util.heir(BZPage);
+RHBugzillaPage.prototype = util.heir(BZPage.prototype);
RHBugzillaPage.prototype.constructor = RHBugzillaPage;
diff --git a/lib/util.js b/lib/util.js
index b019022..e14fcb1 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -30,7 +30,7 @@ var urlMod = require("url");
*/
exports.heir = function heir(p) {
function f() {};
- f.prototype = p.prototype;
+ f.prototype = p.prototype;
return new f();
};
@@ -38,6 +38,9 @@ exports.heir = function heir(p) {
var getBugNo = exports.getBugNo = function getBugNo(url) {
var re = new RegExp(".*id=([0-9]+).*$");
var bugNo = null;
+ if (!url) {
+ throw new Error("Missing URL value!");
+ }
var reResult = re.exec(url);
if (reResult[1]) {
bugNo = reResult[1];
diff --git a/tests/test-util.js b/tests/test-util.js
index 70f5218..98bd435 100644
--- a/tests/test-util.js
+++ b/tests/test-util.js
@@ -41,7 +41,7 @@ exports.ensureHeir = function (test) {
// http://en.wikipedia.org/wiki/Deirdre :)
fedlimid = new Father("mac Daill");
naoise = new Son("Usnech", "Deirdre");
-
+
test.assertEqual(fedlimid.getFamily(), "mac Daill",
"checking creation of new simple object");