Skip to content

Commit c7fcadc

Browse files
committed
refactor: bring grsync into this repo
Signed-off-by: Christian Stewart <[email protected]>
1 parent 37e85fa commit c7fcadc

File tree

7 files changed

+847
-1
lines changed

7 files changed

+847
-1
lines changed

builder/source_path.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77

88
log "github.com/sirupsen/logrus"
9-
rsync "github.com/zloylos/grsync"
9+
rsync "github.com/skiffos/skiff-core/grsync"
1010
)
1111

1212
// fetchSourceRsync copies from a local path to the destination.

grsync/.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: go
2+
3+
sudo: false
4+
5+
go:
6+
- "1.15"
7+
- "1.16"
8+
- "1.17"
9+
- tip
10+
11+
before_install:
12+
- go get -t -v ./...
13+
14+
script:
15+
- sh coverage.sh
16+
17+
after_success:
18+
- bash <(curl -s https://codecov.io/bash)

grsync/LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2024 Denis Hananein
4+
Copyright (c) 2018 Denis Hananein
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

grsync/UPSTREAM

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The upstream no longer exists: "github.com/zloylos/grsync"

grsync/matcher.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package grsync
2+
3+
import (
4+
"regexp"
5+
)
6+
7+
type matcher struct {
8+
regExp *regexp.Regexp
9+
}
10+
11+
func (m matcher) Match(data string) bool {
12+
return m.regExp.Match([]byte(data))
13+
}
14+
15+
func (m matcher) Extract(data string) string {
16+
const submatchCount = 1
17+
matches := m.regExp.FindAllStringSubmatch(data, submatchCount)
18+
if len(matches) == 0 || len(matches[0]) < 2 {
19+
return ""
20+
}
21+
22+
return matches[0][1]
23+
}
24+
25+
func (m matcher) ExtractAllStringSubmatch(data string, submatchCount int) [][]string {
26+
return m.regExp.FindAllStringSubmatch(data, submatchCount)
27+
}
28+
29+
func newMatcher(regExpString string) *matcher {
30+
return &matcher{
31+
regExp: regexp.MustCompile(regExpString),
32+
}
33+
}

0 commit comments

Comments
 (0)