-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: dont call spawn cb more than once on error * fix: add flag to signal callback was already called * docs: adding TODO * chore: fix deps semvers * test: skip inProc for add-retrieve until js-ipfs 0-29 * feat: let js-ipfs create a repo for itself, no need to import ipfs-repo * Revert "feat: let js-ipfs create a repo for itself, no need to import ipfs-repo" This reverts commit 42597c1. * fix: use once to call cb once * test: skip in proc tests untill js-ipfs 0.29 release is out * chore: use 8.11.1 for circle * feat: detect inited repo, remove ipfs-repo * fix: remove TODOs
- Loading branch information
Showing
10 changed files
with
113 additions
and
115 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
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
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,24 @@ | ||
/* global self */ | ||
'use strict' | ||
|
||
const hat = require('hat') | ||
const Dexie = require('dexie') | ||
|
||
exports.createTempRepoPath = function createTempPathRepo () { | ||
return '/ipfs-' + hat() | ||
} | ||
|
||
exports.removeRepo = function removeRepo (repoPath) { | ||
Dexie.delete(repoPath) | ||
} | ||
|
||
exports.repoExists = function repoExists (repoPath, cb) { | ||
const db = new Dexie(repoPath) | ||
db.open(repoPath) | ||
.then((store) => { | ||
const table = store.table(repoPath) | ||
return table | ||
.count((cnt) => cb(null, cnt > 0)) | ||
.catch(cb) | ||
}).catch(cb) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,29 @@ | ||
'use strict' | ||
|
||
const os = require('os') | ||
const path = require('path') | ||
const hat = require('hat') | ||
const rimraf = require('rimraf') | ||
const fs = require('fs') | ||
|
||
exports.removeRepo = function removeRepo (dir) { | ||
try { | ||
fs.accessSync(dir) | ||
} catch (err) { | ||
// Does not exist so all good | ||
return | ||
} | ||
|
||
return rimraf.sync(dir) | ||
} | ||
|
||
exports.createTempRepoPath = function createTempRepo () { | ||
return path.join(os.tmpdir(), '/ipfs-test-' + hat()) | ||
} | ||
|
||
exports.repoExists = function (repoPath, cb) { | ||
fs.access(`${repoPath}/config`, (err) => { | ||
if (err) { return cb(null, false) } | ||
cb(null, true) | ||
}) | ||
} |
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