UNPKG

thisdotrob-calvin-cljs

Version:

a minimalistic build tool for clojurescript in clojurescript

70 lines (62 loc) 2.87 kB
// Compiled by ClojureScript 1.9.293 {:target :nodejs} goog.provide('thisdotrob.huckleberry.os'); goog.require('cljs.core'); goog.require('cljs.nodejs'); goog.require('cljs.core.async'); goog.require('clojure.set'); goog.require('clojure.string'); thisdotrob.huckleberry.os.path = cljs.nodejs.require.call(null,"path"); thisdotrob.huckleberry.os.fs = cljs.nodejs.require.call(null,"fs"); thisdotrob.huckleberry.os.xml2js = cljs.nodejs.require.call(null,"xml2js"); thisdotrob.huckleberry.os.request = cljs.nodejs.require.call(null,"request"); thisdotrob.huckleberry.os.HOME_DIR = cljs.nodejs.process.env.HOME; thisdotrob.huckleberry.os.SEPARATOR = thisdotrob.huckleberry.os.path.sep; thisdotrob.huckleberry.os.make_http_request = (function thisdotrob$huckleberry$os$make_http_request(cout,url){ thisdotrob.huckleberry.os.request.get(({"url": url, "encoding": null}),(function (error,response,body){ if((cljs.core.not.call(null,error)) && (cljs.core._EQ_.call(null,(200),response.statusCode))){ return cljs.core.async.put_BANG_.call(null,cout,body); } else { return null; } })); return cout; }); thisdotrob.huckleberry.os.read_file = (function thisdotrob$huckleberry$os$read_file(cout,fpath){ thisdotrob.huckleberry.os.fs.readFile(fpath,"utf-8",(function (err,data){ if(cljs.core.truth_(err)){ return null; } else { return cljs.core.async.put_BANG_.call(null,cout,data); } })); return cout; }); thisdotrob.huckleberry.os.create_dir_fully = (function thisdotrob$huckleberry$os$create_dir_fully(dir_path){ if(!(clojure.string.blank_QMARK_.call(null,dir_path))){ try{return thisdotrob.huckleberry.os.fs.mkdirSync([cljs.core.str(dir_path)].join('')); }catch (e26845){var e = e26845; thisdotrob.huckleberry.os.create_dir_fully.call(null,thisdotrob.huckleberry.os.path.dirname(dir_path)); return thisdotrob.huckleberry.os.fs.mkdirSync([cljs.core.str(dir_path)].join('')); }} else { return null; } }); thisdotrob.huckleberry.os.create_conditionally = (function thisdotrob$huckleberry$os$create_conditionally(dir_path){ try{return thisdotrob.huckleberry.os.fs.statSync(dir_path); }catch (e26850){var e = e26850; return thisdotrob.huckleberry.os.create_dir_fully.call(null,dir_path); }}); thisdotrob.huckleberry.os.write_file = (function thisdotrob$huckleberry$os$write_file(file_path,content){ thisdotrob.huckleberry.os.create_conditionally.call(null,thisdotrob.huckleberry.os.path.dirname(file_path)); thisdotrob.huckleberry.os.fs.writeFileSync(file_path,content); return true; }); thisdotrob.huckleberry.os.parse_xml = (function thisdotrob$huckleberry$os$parse_xml(xmlstring){ var x = cljs.core.async.chan.call(null); thisdotrob.huckleberry.os.xml2js.parseString(xmlstring,((function (x){ return (function (p1__26855_SHARP_,p2__26854_SHARP_){ return cljs.core.async.put_BANG_.call(null,x,p2__26854_SHARP_); });})(x)) ); return cljs.core.async.poll_BANG_.call(null,x); });