Skip to content

Commit

Permalink
v0.1.0: hosts configurables
Browse files Browse the repository at this point in the history
  • Loading branch information
juampi92 committed Aug 14, 2015
1 parent 3bad3fc commit 87c7633
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ With [npm](http://npmjs.org) do:

* `init ( opc )`
* `pathToJson: ''` from repo main folder to package.json (only subfolders. Can't go backwards)
* `async: true` Currently not sync supported.
* `silent: false` Does not trigger events
* `autoupdate: false` if true, all stages run one after the other. Else, you need to force the stages with the force methods
* `check_git: true` Checks if the .git folder exists, so its a dev and doesnt download the proyect.
* `jsonhost: 'raw.githubusercontent.com'` URL of raw remote package.json
* `contenthost: 'codeload.github.com'` URL of full remote zip

* `on ( event, callback )` Sets the events

Expand Down
16 changes: 14 additions & 2 deletions auto-updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ module.exports = function(config) {
* @default false
*/
this.opt.check_git = (options.check_git) ? true : false;
/**
* @attribute jsonhost
* @type {String}
* @default 'raw.githubusercontent.com'
*/
this.opt.jsonhost = options.jsonhost || 'raw.githubusercontent.com';
/**
* @attribute contenthost
* @type {String}
* @default 'codeload.github.com'
*/
this.opt.contenthost = options.contenthost || 'codeload.github.com';
};

/**
Expand All @@ -66,7 +78,7 @@ module.exports = function(config) {
AutoUpdater.forceDownloadUpdate = function() {
var self = this;
this._remoteDownloadUpdate(this.updateName, {
host: 'codeload.github.com',
host: this.opt.contenthost,
path: this.jsons.client['auto-updater'].repo + '/zip/' + this.jsons.client['auto-updater'].branch
},
function(existed) {
Expand Down Expand Up @@ -141,7 +153,7 @@ module.exports = function(config) {


this._remoteDownloader({
host: 'raw.githubusercontent.com',
host: this.opt.jsonhost,
path: path
}, function(data) {
self.jsons.remote = JSON.parse(data);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "auto-updater",
"description": "Automatically updates your client version when is outdated by the repository",
"version": "0.0.7",
"version": "0.1.0",
"author": {
"name": "@Juampi_92",
"url": "https://github.com/juampi92"
Expand Down

0 comments on commit 87c7633

Please sign in to comment.