Пример #1
0
const http = require('http');
const os = require('os');

const express = require('express');
const io = require('socket.io');
const writejson = require('writejson');
const readjson = require('readjson');
const {promisify} = require('util');

process.env.NODE_ENV = 'development';

const cloudcmd = require('../server/cloudcmd');
const {assign} = Object;

const pathConfig = os.homedir() + '/.cloudcmd.json';
const currentConfig = readjson.sync.try(pathConfig);

module.exports = before;

function before(options, fn = options) {
    const {
        config,
        plugins,
        modules,
    } = options;
    
    const app = express();
    const server = http.createServer(app);
    const after = (cb) => {
        if (currentConfig)
            writejson.sync(pathConfig, currentConfig);
Пример #2
0
#!/usr/bin/env node

'use strict';

const path = require('path');
const readjson = require('readjson');

const HOME = require('os').homedir();

const cwd = process.cwd();
const name = 'runny.json';
const current = path.join(cwd, name);
const home = path.join(HOME, '.' + name);

const options     =
    readjson.sync.try(current) ||
    readjson.sync.try(home)    ||
    {};

const argv = process.argv;
const args = require('minimist')(argv.slice(2), {
        string: [
            'command',
            'directories'
        ],
        boolean: [
            'version',
            'help',
            'save',
            'save-here'
        ],