Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

organize code, add feature to init/start daemon if needed #42

Merged
merged 2 commits into from
Feb 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ipscend

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) ![](https://img.shields.io/badge/coverage-%3F-yellow.svg?style=flat-square) [![Dependency Status](https://david-dm.org/diasdavid/ipscend.svg?style=flat-square)](https://david-dm.org/diasdavid/ipscend) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)

> Quick and simple deploy tool to host Native Web Applications and Static Web Pages in IPFS
> Web Application publishing, simple and distributed with IPFS

## Usage

Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "ipscend",
"version": "0.1.9",
"description": "Quick and simple deploy tool to host Native Web Applications and Static Web Pages in IPFS",
"bin": "bin.js",
"description": "Web Application publishing, simple and distributed with IPFS ",
"bin": {
"ipscend": "src/cli/bin.js"
},
"scripts": {
"lint": "standard",
"test": "echo \"Error: no test specified\" && exit 1"
Expand All @@ -25,7 +27,8 @@
"homepage": "https://github.com/diasdavid/ipscend",
"dependencies": {
"asking": "^0.1.2",
"ipfs-api": "^2.13.0",
"ipfs-api": "^2.13.1",
"ipfsd-ctl": "^0.8.1",
"ndjson-aggregator": "^0.1.2",
"node-static": "^0.7.7",
"open": "0.0.5",
Expand Down
6 changes: 3 additions & 3 deletions bin.js → src/cli/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ var ronin = require('ronin')

var cli = ronin(__dirname)

cli.autoupdate(function () {
cli.run()
})
// cli.autoupdate(() => {
cli.run()
// })
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions src/cli/commands/ipfs/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const fs = require('fs')
const ipfsd = require('ipfsd-ctl')
const os = require('os')

var Command = require('ronin').Command
module.exports = Command.extend({
desc: 'Start your a local IPFS node',
run: () => {
const repoPath = process.env.IPFS_PATH || os.homedir() + '/.ipfs'
var init = false
try {
fs.statSync(repoPath)
// TODO check if it is right repo version, if not, inform the user
// how to migrate
} catch (err) {
init = true
console.log('no IPFS repo found, going to start a new one')
}

ipfsd.disposable({
repoPath: repoPath,
init: init
}, (err, node) => {
if (err) {
return console.log(err)
}
console.log('starting IPFS daemon (this might take some seconds)')
node.startDaemon((err) => {
if (err) {
return console.log('failed to start a daemon')
}
console.log('IPFS daemon has started, you can now publish with ipscend')
process.on('SIGINT', () => {
console.log('Got interrupt signal(SIGINT), shutting down.')
node.stopDaemon(() => {
process.exit(0)
})
})
})
})
}
})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.