Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion complete/completion_oaf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ F__helpscript=1
if [ $# -gt 0 ]; then
FFOUND=0
for arg in "$@"; do
if [ "$arg" = "${!#}" ]; then FFOUND=1; break; fi
if [ "$arg" = "" ]; then FFOUND=1; break; fi
# -e single option
if [ "$arg" = "-e" ]; then FFOUND=1; F__e=0; fi
# -c single option
Expand Down
290 changes: 145 additions & 145 deletions complete/completion_oafp.sh

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion complete/completion_opack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ F__cred=1
if [ $# -gt 0 ]; then
FFOUND=0
for arg in "$@"; do
if [ "$arg" = "${!#}" ]; then FFOUND=1; break; fi
if [ "$arg" = "" ]; then FFOUND=1; break; fi
# info single option
if [ "$arg" = "info" ]; then FFOUND=1; F_info=0; fi
# search single option
Expand Down
73 changes: 42 additions & 31 deletions js/openaf.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ var __flags = ( typeof __flags != "undefined" && "[object Object]" == Object.pro
OJOB_CHECK_JOB_REMOVAL : false,
OJOB_CHECK_JOB_CHANGES : false,
OJOB_ARGS_FROM_ENVS : false,
OPACK_REMOTE_DB_CACHE_TTL : 60000,
OAF_CLOSED : false,
OAF_PRECOMPILE_LEVEL : 2,
OAF_ERRSTACK : true, // If true $err will print the stack trace
Expand Down Expand Up @@ -3313,49 +3314,59 @@ const addOPackRemoteDB = function(aURL) {
* <odoc>
* <key>getOPackRemoteDB() : Array</key>
* Returns an Array of maps. Each map element is an opack package description registered in the OpenAF central repository.
* Results are cached using $cache for __flags.OPACK_REMOTE_DB_CACHE_TTL milliseconds (default: 60000).
* </odoc>
*/
const getOPackRemoteDB = function() {
var packages = {};
var __opacksEnv = getEnv("OAF_OPACKS");
var _cache = $cache("__openaf_getOPackRemoteDB")
.fn((k) => {
var packages = {};
var _sources = clone(k.sources);
var _zip;

plugin("ZIP")
var zip
plugin("ZIP");

// Check for OAF_OPACKS environment variable
// If it exists, add the remote opack repositories
if (isString(getEnv("OAF_OPACKS"))) {
getEnv("OAF_OPACKS").split(",").forEach(url => addOPackRemoteDB(url) )
}
for(var i in __opackCentral) {
if (!noHomeComms && __opackCentral[i].toLowerCase().startsWith("http")) {
try {
var _stream = $rest({ connectionTimeout: 1500 }).get2Stream(__opackCentral[i])
//http = new HTTP(, "GET", "", {}, true, 1500);
//zip = new ZIP(http.responseBytes());
zip = new ZIP(af.fromInputStream2Bytes(_stream))
packages = merge(packages, af.fromJson(af.fromBytes2String(zip.getFile(OPACKCENTRALJSON))))
} catch(e) {
// Continue to next
} finally {
if (isDef(zip)) zip.close()
}
} else if (io.fileExists(__opackCentral[i]) && io.fileInfo(__opackCentral[i]).isDirectory) {
if (io.fileExists(__opackCentral[i] + "/" + PACKAGESJSON_CENTRALDB)) {
for(var i in _sources) {
if (!k.noHomeComms && _sources[i].toLowerCase().startsWith("http")) {
try {
zip = new ZIP(io.readFileBytes(__opackCentral[i] + "/" + PACKAGESJSON_CENTRALDB))
packages = merge(packages, af.fromJson(af.fromBytes2String(zip.getFile(OPACKCENTRALJSON))))
var _stream = $rest({ connectionTimeout: 1500 }).get2Stream(_sources[i]);
_zip = new ZIP(af.fromInputStream2Bytes(_stream));
packages = merge(packages, af.fromJson(af.fromBytes2String(_zip.getFile(OPACKCENTRALJSON))));
} catch(e) {
// Continue to next
} finally {
if (isDef(zip)) zip.close()
if (isDef(_zip)) _zip.close();
}
} else if (io.fileExists(_sources[i]) && io.fileInfo(_sources[i]).isDirectory) {
if (io.fileExists(_sources[i] + "/" + PACKAGESJSON_CENTRALDB)) {
try {
_zip = new ZIP(io.readFileBytes(_sources[i] + "/" + PACKAGESJSON_CENTRALDB));
packages = merge(packages, af.fromJson(af.fromBytes2String(_zip.getFile(OPACKCENTRALJSON))));
} finally {
if (isDef(_zip)) _zip.close();
}
}
}
}

return packages;
})
.ttl(_$(__flags.OPACK_REMOTE_DB_CACHE_TTL, "__flags.OPACK_REMOTE_DB_CACHE_TTL").isNumber().default(60000))
.create();

var _sources = clone(__opackCentral);

// Check for OAF_OPACKS environment variable
// If it exists, add the remote opack repositories
if (isString(__opacksEnv)) {
_sources = _sources.concat(__opacksEnv.split(","));
}

//if (isUnDef(http)) return packages;

//packages = af.fromJson(af.fromBytes2String(zip.getFile(OPACKCENTRALJSON)));
//if (!isUnDef(zip)) zip.close();
return packages;
return _cache.get({
noHomeComms: noHomeComms,
sources: _sources.sort()
});
}

/**
Expand Down
27 changes: 18 additions & 9 deletions js/owrap.format.js
Original file line number Diff line number Diff line change
Expand Up @@ -4940,15 +4940,14 @@ OpenWrap.format.prototype.withMD = function(aString, defaultAnsi, aLineWidth, aB
__owWithMdCache = _withMdPatterns
}

// pre process code blocks

// remove html
// TODO: .replace(/<\/?(code|pre>)[^>]*>/g, "```"). ?
if (__flags.WITHMD.htmlFilter)
res = res.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script\s*>/gi, "").replace(/<[^>]*>/g, "").replace(/&nbsp;/g, " ")

// single line
res = res.replace(/```+(.+?)```+/mg, ansiColor(__colorFormat.md.codeBlock.text, " $1 "))
// pre process code blocks before html filtering, so literal XML/HTML samples
// inside fenced code blocks are not stripped as markup.
var inlineCodeBlocks = []
res = res.replace(/```+(.+?)```+/mg, (m, code) => {
var idx = inlineCodeBlocks.length
inlineCodeBlocks.push(ansiColor(__colorFormat.md.codeBlock.text, " " + code + " "))
return "```INLINE$" + idx + "```"
})

// multi line
var cblocks = res.match(/```+\w*( +|\n)((.|\n)+?)( +|\n)```+/mg)
Expand All @@ -4965,6 +4964,11 @@ OpenWrap.format.prototype.withMD = function(aString, defaultAnsi, aLineWidth, aB
res = res.replace(b, "```$$" + i + "```")
})

// remove html outside fenced code blocks
// TODO: .replace(/<\/?(code|pre>)[^>]*>/g, "```"). ?
if (__flags.WITHMD.htmlFilter)
res = res.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script\s*>/gi, "").replace(/<[^>]*>/g, "").replace(/&nbsp;/g, " ")

var _repBoldItalic = _withMdPatterns.repBoldItalic + da
var _repBold = _withMdPatterns.repBold + da
var _repItalic = _withMdPatterns.repItalic + da
Expand Down Expand Up @@ -5067,6 +5071,11 @@ OpenWrap.format.prototype.withMD = function(aString, defaultAnsi, aLineWidth, aB
res = res.replace("```$" + i + "```", ow.format.withSideLine(b.replace(/```+\w*( +|\n)((.|\n)+?)( +|\n)```+/mg, "$2").replace(/\\n/g, "\\\\n"), _aSize, __colorFormat.md.codeBlock.line, _withColor(__colorFormat.md.codeBlock.text, aBgColor), _sideLineThemes[__colorFormat.md.codeBlock.theme]))
})
}
if (inlineCodeBlocks.length > 0) {
inlineCodeBlocks.forEach((b, i) => {
res = res.replace("```INLINE$" + i + "```", b)
})
}

// table render
if (res.indexOf("|") >= 0) {
Expand Down
Binary file added lib/commons-io-2.22.0.jar
Binary file not shown.
Binary file removed lib/commons-net-3.12.0.jar
Binary file not shown.
Binary file added lib/commons-net-3.13.0.jar
Binary file not shown.
Binary file renamed lib/dnsjava-3.6.4.jar → lib/dnsjava-3.6.5.jar
Binary file not shown.
Binary file removed lib/gson-2.13.2.jar
Binary file not shown.
Binary file added lib/gson-2.14.0.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed lib/jsch-2.28.1.jar → lib/jsch-2.28.2.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed lib/slf4j-nop-2.0.17.jar
Binary file not shown.
Binary file added lib/slf4j-nop-2.0.18.jar
Binary file not shown.
28 changes: 28 additions & 0 deletions pom-check.oafp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Usage : oafp -f pom-check.oafp.yaml
# Description: Check for updates of maven dependencies in pom.xml
#
file: pom.xml
path: project.dependencies.dependency
out : json
pipe:
in : json
out : json
sql : | #sql
SELECT * WHERE update = true ORDER BY update, groupId, artifactId
oaf : | #js
ow.loadJava()
var m = new ow.java.maven()
return pForEach(data, d => {
try {
d.onlineVersion = m.getLatestVersionString(d.groupId + "." + d.artifactId)
if (d.version != d.onlineVersion) {
d.update = true
} else {
d.update = false
}
} catch(e) {
}
return d
})
pipe :
out : ctable
Loading
Loading