go-ipfs-dep
Advanced tools
Comparing version 0.4.3 to 0.4.4
{ | ||
"name": "go-ipfs-dep", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "Install the latest go-ipfs binary", | ||
@@ -8,7 +8,6 @@ "main": "src/index.js", | ||
"install": "node src/bin.js", | ||
"lint": "aegir-lint", | ||
"coverage": "aegir-coverage", | ||
"test": "tape test/*.js | tap-spec" | ||
}, | ||
"bin": { | ||
"ipfs": "go-ipfs/ipfs" | ||
}, | ||
"repository": { | ||
@@ -22,3 +21,4 @@ "type": "git", | ||
"request": "^2.75.0", | ||
"tar-fs": "^1.13.2" | ||
"tar-fs": "^1.13.2", | ||
"unzip": "^0.1.11" | ||
}, | ||
@@ -36,2 +36,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"rimraf": "^2.5.4", | ||
"tap-spec": "^4.1.1", | ||
@@ -38,0 +39,0 @@ "tape": "^4.6.0" |
#!/usr/bin/env node | ||
'use strict' | ||
require('./')() |
'use strict' | ||
var checkPlatform = require('./checkPlatform') | ||
var goenv = require('go-platform') | ||
var gunzip = require('gunzip-maybe') | ||
var path = require('path') | ||
var goenv = require('go-platform') | ||
var version = require('./../package.json').version | ||
var request = require('request') | ||
var gunzip = require('gunzip-maybe') | ||
var tarFS = require('tar-fs') | ||
var unzip = require('unzip') | ||
var version = require('./../package.json').version | ||
module.exports = function (callback) { | ||
callback = callback || noop | ||
checkPlatform(goenv) // make sure we can do this. | ||
// make sure we can do this. | ||
if (!checkPlatform.isSupportedArchitecture(goenv.GOARCH)) { | ||
throw new Error('no binary available for arch: ' + goenv.GOARCH) | ||
} | ||
const isWindows = checkPlatform.isWindows(goenv.GOOS) | ||
// hacky hack hack to work around unpublishability | ||
version = version.replace(/-[0-9]+/, '') | ||
var filename = 'ipfs_v' + version + '_' + goenv.GOOS + '-' + goenv.GOARCH + '.tar.gz' | ||
var url = 'http://dist.ipfs.io/go-ipfs/v' + version + '/go-' + filename | ||
const fileExtension = isWindows ? '.zip' : '.tar.gz' | ||
const fileName = 'ipfs_v' + version + '_' + goenv.GOOS + '-' + goenv.GOARCH + fileExtension | ||
const url = 'https://dist.ipfs.io/go-ipfs/v' + version + '/go-' + fileName | ||
const installPath = path.resolve(__dirname, '..') | ||
const fileStream = request.get(url) | ||
var installPath = path.resolve(__dirname, '..') | ||
request | ||
.get(url) | ||
.pipe(gunzip()) | ||
if (isWindows) { | ||
fileStream.pipe( | ||
unzip.Extract({ path: installPath }) | ||
.on('close', callback)) | ||
} else { | ||
fileStream.pipe(gunzip()) | ||
.pipe( | ||
@@ -30,22 +42,2 @@ tarFS | ||
) | ||
function checkPlatform (goenv) { | ||
switch (goenv.GOOS) { | ||
case 'darwin': | ||
case 'linux': | ||
case 'freebsd': | ||
break | ||
default: | ||
throw new Error('no binary available for os:' + goenv.GOOS) | ||
} | ||
switch (goenv.GOARCH) { | ||
case 'amd64': | ||
case '386': | ||
case 'arm': | ||
break | ||
default: | ||
throw new Error('no binary available for arch: ' + goenv.GOARCH) | ||
} | ||
} | ||
@@ -52,0 +44,0 @@ } |
@@ -6,2 +6,3 @@ 'use strict' | ||
var path = require('path') | ||
var rimraf = require('rimraf') | ||
@@ -12,4 +13,6 @@ var download = require('../src') | ||
t.plan(2) | ||
const dir = path.resolve(__dirname, '../go-ipfs') | ||
rimraf.sync(dir) | ||
download(function () { | ||
fs.stat(path.resolve(__dirname, '../go-ipfs'), function (err, stats) { | ||
fs.stat(dir, function (err, stats) { | ||
t.error(err, 'ipfs bin should stat without error') | ||
@@ -16,0 +19,0 @@ t.ok(stats, 'ipfs was downloaded') |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
6252
10
73
5
3
+ Addedunzip@^0.1.11
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbinary@0.3.0(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbuffers@0.1.1(transitive)
+ Addedchainsaw@0.1.0(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfstream@0.1.31(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedgraceful-fs@3.0.12(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedmatch-stream@0.0.2(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addednatives@1.1.6(transitive)
+ Addedover@0.0.5(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpullstream@0.4.1(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedslice-stream@1.0.0(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedtraverse@0.3.9(transitive)
+ Addedunzip@0.1.11(transitive)