zotero-unit.js (2350B)
1 "use strict"; 2 /* 3 ***** BEGIN LICENSE BLOCK ***** 4 5 Copyright © 2012 Center for History and New Media 6 George Mason University, Fairfax, Virginia, USA 7 http://zotero.org 8 9 This file is part of Zotero. 10 11 Zotero is free software: you can redistribute it and/or modify 12 it under the terms of the GNU Affero General Public License as published by 13 the Free Software Foundation, either version 3 of the License, or 14 (at your option) any later version. 15 16 Zotero is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU Affero General Public License for more details. 20 21 You should have received a copy of the GNU Affero General Public License 22 along with Zotero. If not, see <http://www.gnu.org/licenses/>. 23 24 ***** END LICENSE BLOCK ***** 25 */ 26 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); 27 28 function ZoteroUnit() { 29 this.wrappedJSObject = this; 30 } 31 ZoteroUnit.prototype = { 32 /* nsICommandLineHandler */ 33 handle:function(cmdLine) { 34 this.tests = cmdLine.handleFlagWithParam("test", false); 35 this.noquit = cmdLine.handleFlag("noquit", false); 36 this.makeTestData = cmdLine.handleFlag("makeTestData", false); 37 this.noquit = !this.makeTestData && this.noquit; 38 this.runTests = !this.makeTestData; 39 this.bail = cmdLine.handleFlag("bail", false); 40 this.startAt = cmdLine.handleFlagWithParam("startAtTestFile", false); 41 this.stopAt = cmdLine.handleFlagWithParam("stopAtTestFile", false); 42 this.grep = cmdLine.handleFlagWithParam("grep", false); 43 this.timeout = cmdLine.handleFlagWithParam("ZoteroTestTimeout", false); 44 }, 45 46 dump:function(x) { 47 dump(x); 48 }, 49 50 contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=zotero-unit", 51 classDescription: "Zotero Unit Command Line Handler", 52 classID: Components.ID("{b8570031-be5e-46e8-9785-38cd50a5d911}"), 53 service: true, 54 _xpcom_categories: [{category:"command-line-handler", entry:"m-zotero-unit"}], 55 QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler, 56 Components.interfaces.nsISupports]) 57 }; 58 59 60 var NSGetFactory = XPCOMUtils.generateNSGetFactory([ZoteroUnit]);