merge with develop

This commit is contained in:
Eduard Heimbuch
2020-06-29 11:46:10 +02:00
5 changed files with 23 additions and 11 deletions

View File

@@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Checkboxes can now be 'indeterminate' ([#1215](https://github.com/scm-manager/scm-manager/pull/1215))
### Fixed
- Fixed installation of debian packages on distros without preinstalled `at` ([#1216](https://github.com/scm-manager/scm-manager/issues/1216) and [#1217](https://github.com/scm-manager/scm-manager/pull/1217))
## [2.1.1] - 2020-06-23
### Fixed
- Wait until recommended java installation is available for deb packages ([#1209](https://github.com/scm-manager/scm-manager/pull/1209))

View File

@@ -40,4 +40,4 @@ sudo systemctl enable scm-server
# we start scm-manager after 5 seconds
# this is required, because if we install scm-manager with recommend java
# java is not fully setup if we ran our postint script
echo "sleep 5; sudo systemctl start scm-server" | at now
nohup sh -c "sleep 5; systemctl start scm-server" >/dev/null 2>&1 &

View File

@@ -43,7 +43,7 @@ ENV CACHE_DIR=/var/cache/scm/work
COPY . /
RUN set -x \
&& apk add --no-cache python2 bash \
&& apk add --no-cache python2 bash ca-certificates \
&& addgroup -S -g 1000 scm \
&& adduser -S -s /bin/false -G scm -h ${SCM_HOME} -D -H -u 1000 scm \
&& mkdir -p ${SCM_HOME} ${CACHE_DIR} \

View File

@@ -26,16 +26,20 @@ import { regExpPattern } from "./remarkCommitLinksParser";
describe("Remark Commit Links RegEx Tests", () => {
it("should match simple names", () => {
expect("namespace/name@1a5s4w8a".match(regExpPattern)).toBeTruthy();
const regExp = new RegExp(regExpPattern, "g");
expect("namespace/name@1a5s4w8a".match(regExp)).toBeTruthy();
});
it("should match complex names", () => {
expect("hitchhiker/heart-of-gold@c7237cb60689046990dc9dc2a388a517adb3e2b2".match(regExpPattern)).toBeTruthy();
const regExp = new RegExp(regExpPattern, "g");
expect("hitchhiker/heart-of-gold@c7237cb60689046990dc9dc2a388a517adb3e2b2".match(regExp)).toBeTruthy();
});
it("should replace match", () => {
expect("Prefix namespace/name@42 suffix".replace(regExpPattern, "replaced")).toBe("Prefix replaced suffix");
const regExp = new RegExp(regExpPattern, "g");
expect("Prefix namespace/name@42 suffix".replace(regExp, "replaced")).toBe("Prefix replaced suffix");
});
it("should match groups", () => {
const match = regExpPattern.exec("namespace/name@42");
const regExp = new RegExp(regExpPattern, "g");
const match = regExp.exec("namespace/name@42");
expect(match).toBeTruthy();
if (match) {
expect(match[1]).toBe("namespace");
@@ -44,15 +48,18 @@ describe("Remark Commit Links RegEx Tests", () => {
}
});
it("should match multiple links in text", () => {
const regExp = new RegExp(regExpPattern, "g");
const text = "Prefix hitchhiker/heart-of-gold@42 some text hitchhiker/heart-of-gold@21 suffix";
const matches = [];
let match = regExpPattern.exec(text);
let match = regExp.exec(text);
while (match !== null) {
matches.push(match[0]);
match = regExpPattern.exec(text);
match = regExp.exec(text);
}
console.log(matches)
expect(matches[0]).toBe("hitchhiker/heart-of-gold@42");
expect(matches[1]).toBe("hitchhiker/heart-of-gold@21");
});

View File

@@ -31,19 +31,21 @@ import { TFunction } from "i18next";
const namePartRegex = nameRegex.source.substring(1, nameRegex.source.length - 1);
// Visible for testing
export const regExpPattern = new RegExp(`(${namePartRegex})\\/(${namePartRegex})@([\\w\\d]+)`, "g");
export const regExpPattern = `(${namePartRegex})\\/(${namePartRegex})@([\\w\\d]+)`;
function match(value: string): RegExpMatchArray[] {
const regExp = new RegExp(regExpPattern, "g");
const matches = [];
let m = regExpPattern.exec(value);
let m = regExp.exec(value);
while (m) {
matches.push(m);
m = regExpPattern.exec(value);
m = regExp.exec(value);
}
return matches;
}
export const createTransformer = (t: TFunction): MdastPlugin => {
return (tree: MarkdownAbstractSyntaxTree) => {
visit(tree, "text", (node: MarkdownAbstractSyntaxTree, index: number, parent: MarkdownAbstractSyntaxTree) => {
if (parent.type === "link" || !node.value) {