-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add data and rewrite generate script
- Loading branch information
1 parent
42da848
commit bc09c71
Showing
17 changed files
with
666 additions
and
557 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- stable | ||
|
||
script: | ||
- npm run lint | ||
- npm test |
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 @@ | ||
#!/usr/bin/env node | ||
'use strict' | ||
|
||
const Gauge = require('gauge') | ||
const gen = require('../generate') | ||
const API = require('ipfs-api') | ||
|
||
function handleNoApi () { | ||
console.error('No ipfs daemon running. Please start one') | ||
process.exit(1) | ||
} | ||
|
||
// -- CLI interaction | ||
|
||
const ipfs = new API() | ||
|
||
ipfs.id() | ||
.then((id) => { | ||
if (!id) handleNoApi() | ||
}, handleNoApi) | ||
.then(() => { | ||
const gauge = new Gauge() | ||
let length = 0 | ||
let counter = 0 | ||
|
||
gen.progress.on('progress', (event) => { | ||
if (event.type === 'node') { | ||
length = event.length | ||
} | ||
|
||
if (event.type === 'put') { | ||
counter++ | ||
gauge.show('Uploading', (counter / (length / 32))) | ||
} | ||
|
||
if (event.status === 'start' && event.type !== 'put') { | ||
gauge.show(event.type) | ||
} | ||
}) | ||
|
||
gauge.show('Starting', 0.0001) | ||
return gen.main(ipfs) | ||
}) | ||
.then((hash) => { | ||
console.log('Finished with root hash %s', hash) | ||
process.exit(0) | ||
}) | ||
.catch((err) => { | ||
console.error(err.stack) | ||
process.exit(1) | ||
}) |
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
Oops, something went wrong.