Comparing version 0.2.0 to 0.2.1
@@ -5,3 +5,3 @@ { | ||
"description": "Build Google Chrome extensions with node.js", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"homepage": "https://github.com/jed/crx", | ||
@@ -8,0 +8,0 @@ "bin": { |
@@ -20,5 +20,5 @@ crx | ||
### ChromeExtension = require("crx") | ||
### crx = new ChromeExtension | ||
### crx = new ChromeExtension(attrs) | ||
This module exports the `ChromeExtension` constructor directly, which takes no arguments. | ||
This module exports the `ChromeExtension` constructor directly, which can take an optional attribute object, which is used to extend the instance. | ||
@@ -33,5 +33,5 @@ ### crx.load(path, callback) | ||
### crx.generateUpdateXML(url) | ||
### crx.generateUpdateXML() | ||
Returns a Buffer containing the update.xml file used for autoupdate, as specified for `update_url` in the manifest. | ||
Returns a Buffer containing the update.xml file used for autoupdate, as specified for `update_url` in the manifest. In this case, the instance must have a property called `codebase`. | ||
@@ -47,7 +47,7 @@ ### crx.destroy() | ||
, ChromeExtension = require("crx") | ||
, crx = new ChromeExtension | ||
, updateUrl = "http://localhost/update.xml" | ||
, crx = new ChromeExtension( | ||
codebase: "http://localhost:8000/myFirstExtension.crx" | ||
privateKey: fs.readFileSync(__dirname + "/key.pem") | ||
}) | ||
crx.privateKey = fs.readFileSync(__dirname + "/key.pem") | ||
crx.load(__dirname + "/myFirstExtension", function(err) { | ||
@@ -59,3 +59,3 @@ if (err) throw err | ||
var updateXML = this.generateUpdateXML(updateUrl) | ||
var updateXML = this.generateUpdateXML() | ||
@@ -62,0 +62,0 @@ fs.writeFile(__dirname + "/update.xml", updateXML) |
@@ -9,3 +9,5 @@ var fs = require("fs") | ||
module.exports = new function() { | ||
function ChromeExtension() { | ||
function ChromeExtension(attrs) { | ||
for (var name in attrs) this[name] = attrs.name | ||
this.path = join("/tmp", "crx-" + (Math.random() * 1e17).toString(36)) | ||
@@ -173,4 +175,4 @@ } | ||
this.generateUpdateXML = function(url) { | ||
if (!url) throw new Error("No URL provided for update.xml.") | ||
this.generateUpdateXML = function() { | ||
if (!this.codebase) throw new Error("No URL provided for update.xml.") | ||
@@ -182,3 +184,3 @@ return this.updateXML = | ||
" <app appid='" + this.generateAppId() + "'>\n" + | ||
" <updatecheck codebase='" + url + "' version='" + this.manifest.version + "' />\n" + | ||
" <updatecheck codebase='" + this.codebase + "' version='" + this.manifest.version + "' />\n" + | ||
" </app>\n" + | ||
@@ -185,0 +187,0 @@ "</gupdate>" |
@@ -5,5 +5,5 @@ var fs = require("fs") | ||
, crx = new ChromeExtension | ||
, updateUrl = "http://localhost/update.xml" | ||
crx.privateKey = fs.readFileSync(__dirname + "/key.pem") | ||
crx.codebase = "http://localhost:8000/myFirstExtension.crx" | ||
@@ -16,3 +16,3 @@ crx.load(__dirname + "/myFirstExtension", function(err) { | ||
var updateXML = this.generateUpdateXML(updateUrl) | ||
var updateXML = this.generateUpdateXML() | ||
@@ -19,0 +19,0 @@ fs.writeFile(__dirname + "/update.xml", updateXML) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17389
236