Skip to content

Commit

Permalink
update extensionURL
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Nov 9, 2014
1 parent 867b0e1 commit 7e7c689
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
ChromePet
=========

Report new extension version published on Chrome Web Store
A node.js command line app for reporting new extension version published on Chrome Web Store

## Quick Start

```
npm install -g chromepet
$ chromepet -u https://chrome.google.com/webstore/detail/zenhub-for-github/ogcgkffhplmphkaahpmffcafajaocjbd -v 1.0.3
```

#### Result
```
Publishing version: 1.0.3; Published version: 1.0.2; Not published yet
Publishing version: 1.0.3; Published version: 1.0.2; Not published yet
Publishing version: 1.0.3; Published version: 1.0.2; Not published yet
Publishing version: 1.0.3; Published version: 1.0.2; Not published yet
...
Publishing version: 1.0.3; Published version: 1.0.2; Not published yet
New version 1.0.3 is published! UserDownloads:9,823.
Total seconds: 1.132
```

## Module API

```
npm install chromepet
```
Expand All @@ -14,7 +35,7 @@ This file `example/zenhub.js` is to check if a new version of ZenHub Chrome Exte
var chromepet = require('chromepet');

chromepet({
extensionURL: 'https://chrome.google.com/webstore/detail/zenhub-for-github/ogcgkffhplmphkaahpmffcafajaocjbd/details',
extensionURL: 'https://chrome.google.com/webstore/detail/zenhub-for-github/ogcgkffhplmphkaahpmffcafajaocjbd',
publishingVersion: '1.0.3'
})
.watch()
Expand All @@ -26,7 +47,7 @@ chromepet({
});
```

Result:
#### Result
```
$ node example/zenhub.js
Publishing version: 1.0.3; Published version: 1.0.2; Not published yet
Expand Down Expand Up @@ -55,7 +76,7 @@ var manifest = require(manifestPath);
var publishingVersion = manifest.version;

chromepet({
extensionURL: 'https://chrome.google.com/webstore/detail/zenhub-for-github/ogcgkffhplmphkaahpmffcafajaocjbd/details',
extensionURL: 'https://chrome.google.com/webstore/detail/zenhub-for-github/ogcgkffhplmphkaahpmffcafajaocjbd',
publishingVersion: publishingVersion,
watchIntervalMS: 1000,
})
Expand All @@ -79,4 +100,3 @@ chromepet({

## Contributors
* [Leo Zhang](https://github.com/zhangchiqing)

2 changes: 1 addition & 1 deletion example/zenhub.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var manifest = require(manifestPath);
var publishingVersion = manifest.version;

chromepet({
extensionURL: 'https://chrome.google.com/webstore/detail/zenhub-for-github/ogcgkffhplmphkaahpmffcafajaocjbd/details',
extensionURL: 'https://chrome.google.com/webstore/detail/zenhub-for-github/ogcgkffhplmphkaahpmffcafajaocjbd',
publishingVersion: publishingVersion,
watchIntervalMS: 1000,
})
Expand Down
5 changes: 3 additions & 2 deletions src/chromepet.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var cheerio = require('cheerio');


var usage = function() {
return 'extensionURL cannot be empty';
return 'extensionURL cannot be empty. Example:\n' +
'https://chrome.google.com/webstore/detail/zenhub-for-github/ogcgkffhplmphkaahpmffcafajaocjbd';
};


Expand Down Expand Up @@ -49,7 +50,7 @@ ChromePet.prototype.watch = function() {
ChromePet.prototype._scrape = function() {
var me = this;

request(this.options.extensionURL, function(err, response, body) {
request(this.options.extensionURL + '/detail', function(err, response, body) {
if (err) {
return me.stopScraping(err);
}
Expand Down
4 changes: 2 additions & 2 deletions test/zenhub.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('chromepet', function() {
this.timeout(5000);
var counter = 0;
var pet = chromepet({
extensionURL: 'https://chrome.google.com/webstore/detail/zenhub-for-github/ogcgkffhplmphkaahpmffcafajaocjbd/details',
extensionURL: 'https://chrome.google.com/webstore/detail/zenhub-for-github/ogcgkffhplmphkaahpmffcafajaocjbd',
publishingVersion: '0.0.1',
watchIntervalMS: 1000,
});
Expand All @@ -29,7 +29,7 @@ describe('chromepet', function() {

it('should stop scraping when new version is published', function(done) {
chromepet({
extensionURL: 'https://chrome.google.com/webstore/detail/zenhub-for-github/ogcgkffhplmphkaahpmffcafajaocjbd/details',
extensionURL: 'https://chrome.google.com/webstore/detail/zenhub-for-github/ogcgkffhplmphkaahpmffcafajaocjbd',
publishingVersion: publishingVersion,
watchIntervalMS: 1000,
})
Expand Down

0 comments on commit 7e7c689

Please sign in to comment.