This repository has been archived by the owner on Mar 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(syncer): add version to operadirver name
- Loading branch information
Showing
4 changed files
with
109 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/**! | ||
* mirrors - sync/Operadriver.js | ||
* | ||
* Copyright(c) cnpm and other contributors. | ||
* MIT Licensed | ||
* | ||
* Authors: | ||
* fengmk2 <fengmk2@gmail.com> (http://fengmk2.com) | ||
* dead_horse <dead_horse@qq.com> | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var util = require('util'); | ||
var GithubSyncer = require('./github'); | ||
|
||
module.exports = OperadriverSyncer; | ||
|
||
function OperadriverSyncer(options) { | ||
if (!(this instanceof OperadriverSyncer)) { | ||
return new OperadriverSyncer(options); | ||
} | ||
GithubSyncer.call(this, options); | ||
} | ||
|
||
util.inherits(OperadriverSyncer, GithubSyncer); | ||
|
||
var proto = OperadriverSyncer.prototype; | ||
|
||
proto.formatAssetItem = function (fullname, asset) { | ||
// "browser_download_url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v0.2.0/operadriver_mac64.zip" | ||
var version = asset.browser_download_url.split('/'); | ||
version = version[version.length - 2]; | ||
var name = asset.name; | ||
if (name.indexOf(version) === -1) { | ||
name = name.replace('_', '_' + version + '_'); | ||
} | ||
console.log(name, asset, fullname) | ||
return { | ||
name: name, | ||
date: asset.updated_at || asset.created_at, | ||
size: asset.size, | ||
type: 'file', | ||
downloadURL: asset.browser_download_url, | ||
parent: fullname | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters