aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-06-24 12:57:09 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-06-24 12:57:09 +0200
commit47b3d9ba7039221becf2c5abc47d3f1f8ad26952 (patch)
tree089f51f01e1e590668156580ed46fb692fc14696
parent14c737fe6fab5198fa6998685ba81c0754b2355c (diff)
downloadbugzilla-triage-47b3d9ba7039221becf2c5abc47d3f1f8ad26952.tar.gz
Make URL for JSON file configurable (fixes #9)0.4
-rw-r--r--.hgignore8
-rw-r--r--Makefile15
-rw-r--r--TODO2
-rw-r--r--lib/bzpage.js14
-rw-r--r--lib/main.js17
-rw-r--r--package.json4
6 files changed, 44 insertions, 16 deletions
diff --git a/.hgignore b/.hgignore
index 3b99b0a..f34ad97 100644
--- a/.hgignore
+++ b/.hgignore
@@ -1,4 +1,6 @@
-.*~
-tmp/.*
+syntax: glob
+*~
+tmp/*
.project/*
-.settings/* \ No newline at end of file
+.settings/*
+*.xpi
diff --git a/Makefile b/Makefile
index e2ffc0d..e273aca 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,14 @@
+WEBDIR=/home/matej/Dokumenty/website
+
all: install
-install:
- rsync -avz jsons/RH_Data-packages.json \
- /home/matej/Dokumenty/website/ceplovi.cz/matej/progs/data/
+install: local-install
+ websync
+
+local-install: bugzilla-triage.xpi
+ rsync -av jsons/RH_Data-packages.json \
+ $(WEBDIR)/ceplovi.cz/matej/progs/data/
+ rsync -av bugzilla-triage.xpi $(WEBDIR)/fedorapeople/scripts/
+
+bugzilla-triage.xpi:
+ cfx xpi
diff --git a/TODO b/TODO
deleted file mode 100644
index 424e12c..0000000
--- a/TODO
+++ /dev/null
@@ -1,2 +0,0 @@
-- jetpack.storage.simple.sync() equivalent
-- officially sanctioned method of inheritance
diff --git a/lib/bzpage.js b/lib/bzpage.js
index 1a43191..eac54af 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -12,6 +12,7 @@ var TriagedDistro = 13;
var NumberOfFrames = 7;
var bugURL = "https://bugzilla.redhat.com/show_bug.cgi?id=";
var BSTPrefNS = "bugzilla-triage.setting.";
+exports.BSTPrefNS = BSTPrefNS;
// ====================================================================================
// BZPage's methods
@@ -97,11 +98,16 @@ BZPage.prototype.getBugId = function getBugId () {
*/
BZPage.prototype.getInstalledPackages = function getInstalledPackages(cfg) {
var installedPackages = {};
+ var prefName = BSTPrefNS+"enabledPacks";
+ var enabledPackages = [];
if (cfg.gJSONData && ("commentPackages" in cfg.gJSONData)) {
- // TODO: Temporary hack ... should be replaced by a proper configuration
- // when replacement for jetpack.storage.settings lands
- var enabledPackages = cfg.gJSONData.configData.enabledPacks.split(/[, ]/);
+ if (preferences.isSet(prefName)) {
+ enabledPackages = preferences.get(prefName,"").split(/[, ]/);
+ } else {
+ preferences.set(prefName,"");
+ }
+
enabledPackages.forEach(function (pkg, idx, arr) {
if (pkg in cfg.gJSONData.commentPackages) {
installedPackages[pkg] = cfg.gJSONData.commentPackages[pkg];
@@ -744,4 +750,4 @@ BZPage.prototype.getCCList = function getCCList () {
};
// exports.BZPage = apiUtils.publicConstructor(BZPage);
-exports.BZPage = BZPage; \ No newline at end of file
+exports.BZPage = BZPage;
diff --git a/lib/main.js b/lib/main.js
index 7cd9a9c..f40dcd1 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -16,7 +16,10 @@ var logger = require("logger");
var myStorage = require("simple-storage").storage;
var browser = require("tab-browser");
var urlMod = require("url");
-var JSONURL = "http://matej.ceplovi.cz/progs/data/RH_Data-packages.json";
+var preferences = require("preferences-service");
+var BSTPrefNS = require("bzpage").BSTPrefNS;
+// Use my JSON for now before it is fixed for general public
+var JSONURLDefault = "http://matej.ceplovi.cz/progs/data/RH_Data-packages.json";
var TriagedDistro = 13;
var NumberOfFrames = 7;
@@ -91,7 +94,17 @@ function skipThisPage(doc) {
}
function initialize(callback) {
- util.loadJSON(JSONURL, function(parsedData) {
+ var prefName = BSTPrefNS+"JSONURL";
+ var url = "";
+
+ if (preferences.isSet(prefName)) {
+ url = preferences.get(prefName);
+ } else {
+ url = JSONURLDefault;
+ preferences.set(prefName, JSONURLDefault);
+ }
+
+ util.loadJSON(url, function(parsedData) {
config.gJSONData = parsedData;
var keys = "", key = "";
diff --git a/package.json b/package.json
index 78ede26..7550a42 100644
--- a/package.json
+++ b/package.json
@@ -7,5 +7,5 @@
"description": "Additional buttons and other function helping in the triage on bugzilla",
"author": "Matej Cepl (http://matej.ceplovi.cz)",
"license": "MIT/X11 (http://opensource.org/licenses/mit-license.php)",
- "version": "0.3"
-} \ No newline at end of file
+ "version": "0.4"
+}