@atomist/clj-editors
Version:
editor functions that use rewrite-clj and other important things from the clojurescript ecosystem
51 lines (48 loc) • 3.65 kB
JavaScript
// Compiled by ClojureScript 1.10.238 {:target :nodejs}
goog.provide('atomist.fingerprint');
goog.require('cljs.core');
goog.require('rewrite_clj.zip');
goog.require('http.util');
goog.require('cljs_node_io.core');
goog.require('cljs_node_io.file');
goog.require('goog.crypt.Sha256');
goog.require('goog.crypt');
goog.require('cljs.pprint');
goog.require('atomist.cljs_log');
goog.require('cljs.reader');
atomist.fingerprint.string__GT_bytes = (function atomist$fingerprint$string__GT_bytes(s){
return goog.crypt.stringToUtf8ByteArray(s);
});
atomist.fingerprint.digest = (function atomist$fingerprint$digest(hasher,bytes){
hasher.update(bytes);
return hasher.digest();
});
/**
* convert bytes to hex
*/
atomist.fingerprint.bytes__GT_hex = (function atomist$fingerprint$bytes__GT_hex(bytes_in){
return goog.crypt.byteArrayToHex(bytes_in);
});
atomist.fingerprint.sha_256 = (function atomist$fingerprint$sha_256(s){
return atomist.fingerprint.bytes__GT_hex.call(null,atomist.fingerprint.digest.call(null,(new goog.crypt.Sha256()),atomist.fingerprint.string__GT_bytes.call(null,s)));
});
atomist.fingerprint.dependencies = (function atomist$fingerprint$dependencies(zipper){
return rewrite_clj.zip.right.call(null,rewrite_clj.zip.find_next_value.call(null,rewrite_clj.zip.down.call(null,zipper),new cljs.core.Keyword(null,"dependencies","dependencies",1108064605)));
});
atomist.fingerprint.project_dependencies = (function atomist$fingerprint$project_dependencies(f){
return cljs.core.map.call(null,(function (p1__22746_SHARP_){
return cljs.core.conj.call(null,cljs.core.rest.call(null,p1__22746_SHARP_),[cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.first.call(null,p1__22746_SHARP_))].join(''));
}),cljs.core.sort_by.call(null,cljs.core.comp.call(null,cljs.core.name,cljs.core.first),rewrite_clj.zip.sexpr.call(null,atomist.fingerprint.dependencies.call(null,rewrite_clj.zip.of_string.call(null,cljs_node_io.core.slurp.call(null,f))))));
});
atomist.fingerprint.get_version = (function atomist$fingerprint$get_version(f){
return cljs.core.nth.call(null,cljs.reader.read_string.call(null,cljs_node_io.core.slurp.call(null,f)),(2));
});
atomist.fingerprint.get_name = (function atomist$fingerprint$get_name(f){
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.nth.call(null,cljs.reader.read_string.call(null,cljs_node_io.core.slurp.call(null,f)),(1)))].join('');
});
atomist.fingerprint.run = (function atomist$fingerprint$run(f){
return cljs.core.conj.call(null,cljs.core.conj.call(null,cljs.core.PersistentVector.EMPTY,(function (){var deps = cljs.core.into.call(null,cljs.core.PersistentVector.EMPTY,atomist.fingerprint.project_dependencies.call(null,f));
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"name","name",1843675177),"clojure-project-deps",new cljs.core.Keyword(null,"data","data",-232669377),deps,new cljs.core.Keyword(null,"abbreviation","abbreviation",-2106594275),"lein-deps",new cljs.core.Keyword(null,"version","version",425292698),"0.0.1"], null);
})()),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"name","name",1843675177),"project-coordinates",new cljs.core.Keyword(null,"data","data",-232669377),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"name","name",1843675177),atomist.fingerprint.get_name.call(null,f),new cljs.core.Keyword(null,"version","version",425292698),atomist.fingerprint.get_version.call(null,f)], null),new cljs.core.Keyword(null,"abbreviation","abbreviation",-2106594275),"coords",new cljs.core.Keyword(null,"version","version",425292698),"0.0.1"], null));
});
//# sourceMappingURL=fingerprint.js.map