UNPKG

mina

Version:

Lightweight deployer for node development, inspired by mina and minco

34 lines (28 loc) 772 B
// Generated by CoffeeScript 1.8.0 (function() { var default_options, fs, mandatory_keys; fs = require("fs"); mandatory_keys = ["server", "server_dir", "repo", "run_cmd"]; default_options = { shared_dirs: [], branch: "master", prerun: [] }; exports.parse = function(path) { var config, key, raw, _i, _len; raw = fs.readFileSync(path, "UTF-8"); config = JSON.parse(raw); for (_i = 0, _len = mandatory_keys.length; _i < _len; _i++) { key = mandatory_keys[_i]; if (config[key] == null) { throw new Error("Missing option: " + key); } } for (key in default_options) { if (config[key] == null) { config[key] = default_options[key]; } } return config; }; }).call(this);