1 |
|
2 | (function(){
|
3 | var Path, isThere, HOME, BASE_PATH, getExistingConfigFile, edit, out$ = typeof exports != 'undefined' && exports || this;
|
4 | Path = require('path');
|
5 | isThere = require('is-there');
|
6 | HOME = require('./utils').HOME;
|
7 | out$.BASE_PATH = BASE_PATH = Path.join(HOME, '.config', 'ramda-cli');
|
8 | out$.getExistingConfigFile = getExistingConfigFile = function(){
|
9 | var exts, i$, len$, ext, p;
|
10 | exts = ['.js', '.ls'];
|
11 | for (i$ = 0, len$ = exts.length; i$ < len$; ++i$) {
|
12 | ext = exts[i$];
|
13 | p = BASE_PATH + ext;
|
14 | if (isThere(p)) {
|
15 | return p;
|
16 | }
|
17 | }
|
18 | };
|
19 | out$.edit = edit = function(cb){
|
20 | var editor, that;
|
21 | editor = require('editor');
|
22 | if (that = getExistingConfigFile()) {
|
23 | return editor(that, cb);
|
24 | } else {
|
25 | return cb(new Error("No config file, create one at " + BASE_PATH + ".{js,ls}"));
|
26 | }
|
27 | };
|
28 | }).call(this);
|