This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from ipfs/feat/version/api+cli+core+tests
version
- Loading branch information
Showing
60 changed files
with
272 additions
and
173 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
var Command = require('ronin').Command | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
|
||
module.exports = Command.extend({ | ||
desc: '', | ||
|
||
run: function (name) {} | ||
run: name => {} | ||
}) |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
var Command = require('ronin').Command | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
|
||
module.exports = Command.extend({ | ||
desc: '', | ||
|
||
run: function (name) {} | ||
run: name => {} | ||
}) |
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 |
---|---|---|
@@ -1,7 +1,18 @@ | ||
var Command = require('ronin').Command | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
const httpAPI = require('../../http-api') | ||
const debug = require('debug') | ||
const log = debug('cli:daemon') | ||
log.error = debug('cli:damon:error') | ||
|
||
module.exports = Command.extend({ | ||
desc: '', | ||
desc: 'Start a long-running daemon process', | ||
|
||
run: function (name) {} | ||
run: name => { | ||
httpAPI.start((err) => { | ||
if (err) { return log.error(err) } | ||
log('daemon started') | ||
}) | ||
} | ||
}) |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
var Command = require('ronin').Command | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
|
||
module.exports = Command.extend({ | ||
desc: '', | ||
|
||
run: function (name) {} | ||
run: name => {} | ||
}) |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
var Command = require('ronin').Command | ||
const Command = require('ronin').Command | ||
|
||
module.exports = Command.extend({ | ||
desc: '', | ||
|
||
run: function (name) {} | ||
run: name => {} | ||
}) |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
var Command = require('ronin').Command | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
|
||
module.exports = Command.extend({ | ||
desc: '', | ||
|
||
run: function (name) {} | ||
run: name => {} | ||
}) |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
var Command = require('ronin').Command | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
|
||
module.exports = Command.extend({ | ||
desc: '', | ||
|
||
run: function (name) {} | ||
run: name => {} | ||
}) |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
var Command = require('ronin').Command | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
|
||
module.exports = Command.extend({ | ||
desc: '', | ||
|
||
run: function (name) {} | ||
run: name => {} | ||
}) |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
var Command = require('ronin').Command | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
|
||
module.exports = Command.extend({ | ||
desc: '', | ||
|
||
run: function (name) {} | ||
run: name => {} | ||
}) |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
var Command = require('ronin').Command | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
|
||
module.exports = Command.extend({ | ||
desc: '', | ||
|
||
run: function (name) {} | ||
run: name => {} | ||
}) |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
var Command = require('ronin').Command | ||
'use strict' | ||
|
||
const Command = require('ronin').Command | ||
|
||
module.exports = Command.extend({ | ||
desc: '', | ||
|
||
run: function (name) {} | ||
run: name => {} | ||
}) |
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,40 @@ | ||
'use strict' | ||
|
||
const Hapi = require('hapi') | ||
const IPFS = require('../ipfs-core') | ||
const debug = require('debug') | ||
const log = debug('api') | ||
log.error = debug('api:error') | ||
|
||
exports = module.exports | ||
|
||
exports.start = callback => { | ||
// start IPFS and exports.ipfs = new IPFS() | ||
|
||
exports.ipfs = new IPFS() | ||
|
||
var server = exports.server = new Hapi.Server({ | ||
connections: { | ||
routes: { | ||
cors: true | ||
} | ||
} | ||
}) | ||
|
||
server.connection({ | ||
port: 9000 | ||
}) | ||
|
||
// load routes | ||
require('./routes/version.js') | ||
|
||
server.start(err => { | ||
if (err) { return callback(err) } | ||
log('server started: ' + server.info.uri) | ||
callback() | ||
}) | ||
} | ||
|
||
exports.stop = () => { | ||
|
||
} |
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 @@ | ||
exports.version = require('./version') |
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,14 @@ | ||
'use strict' | ||
|
||
const ipfs = require('./../index.js').ipfs | ||
const boom = require('boom') | ||
|
||
exports = module.exports | ||
|
||
exports.get = (request, reply) => { | ||
ipfs.version((err, version) => { | ||
if (err) { return reply(boom.badRequest(err)) } | ||
return reply(version) | ||
}) | ||
} | ||
|
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,10 @@ | ||
'use strict' | ||
|
||
const server = require('./../index.js').server | ||
const resources = require('./../resources') | ||
|
||
server.route({ | ||
method: 'GET', | ||
path: '/api/v0/version', | ||
handler: resources.version.get | ||
}) |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
var os = require('os') | ||
'use strict' | ||
|
||
const os = require('os') | ||
|
||
exports = module.exports | ||
|
||
|
Oops, something went wrong.