Skip to content

Commit

Permalink
Following changes:
Browse files Browse the repository at this point in the history
 * Refactored code
 * Replaced Travis with Github Actions
 * Increased file sample size and improved file path logic
 * Improved doc
 * Go version upgrade and library upgrades
  • Loading branch information
m-manu committed May 15, 2022
1 parent ae27647 commit 0335451
Show file tree
Hide file tree
Showing 17 changed files with 339 additions and 184 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17
- name: Build code
run: go build
- name: Test code
Expand Down
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
FROM golang:1.16.3-alpine3.13 as builder
FROM golang:1.17-alpine3.14 as builder

RUN apk --no-cache add build-base

WORKDIR /opt/rsync-sidekick

ADD . ./
COPY ./go.mod ./go.sum ./

RUN go mod download -x

COPY . .

RUN go build

FROM alpine:3.13
RUN go test ./...

FROM alpine:3.14

RUN apk --no-cache add bash rsync

Expand Down
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@ This propagates following changes from _source directory_ to _destination direct
Note:

* This tool **does not delete** any files or folders (under any circumstances) -- that's why safe-to-use 😌
* Your files are just _moved around_
* Now, if you're uncomfortable with this tool even moving your files around, there is a `-shellscript` option, that just generates a script for you to read and run (think of it like a `--dry-run` option)
* Your files are just _moved around_
* Now, if you're uncomfortable with this tool even moving your files around, there is a `-shellscript` option, that
just generates a script for you to read and run (think of it like a `--dry-run` option)
* This tool **does not** actually **transfer** files -- that's for `rsync` to do 🙂
* Since you'd run `rsync` after this tool is run, any changes that this tool couldn't propagate would just be propagated by `rsync`
* So the most that you might lose is some time with `rsync` doing more work than it could have -- Which is likely still much less than not using this tool at all 😄
* Since you'd run `rsync` after this tool is run, any changes that this tool couldn't propagate would just be propagated
by `rsync`
* So the most that you might lose is some time with `rsync` doing more work than it could have -- Which is likely
still much less than not using this tool at all 😄

## How to install?

1. Install Go **1.16**
1. Install Go version at least **1.17**
* On Ubuntu: `snap install go`
* On Mac: `brew install go`
* For anything else: [Go downloads page](https://golang.org/dl/)
Expand Down Expand Up @@ -58,7 +61,9 @@ rsync -av /Users/manu/Photos/ /Volumes/Portable/Photos/
```

## Command line options

Running `rsync-sidekick -help` displays following information:

```
usage:
rsync-sidekick <flags> [source-dir] [destination-dir]
Expand Down Expand Up @@ -95,5 +100,6 @@ and sometimes are dangerous! `rsync-sidekick` is reliable alternative to all the

### How will I benefit from using this tool?

Using `rsync-sidekick` before `rsrync` makes your backup process significantly faster than using only `rsync`. Sometimes
this performance benefit can even be 100x😲, if the only changes at your _source directory_ are the 3 types mentioned earlier in this article.
Using `rsync-sidekick` before `rsrync` makes your backup process significantly faster than using only `rsync`. Sometimes
this performance benefit can even be 100x😲, if the only changes at your _source directory_ are the 3 types mentioned
earlier in this article.
6 changes: 6 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
Propagates file renames, movements and timestamp changes before rsync runs
Visit: https://github.com/m-manu/rsync-sidekick/
*/
package main
23 changes: 23 additions & 0 deletions entity/string_set.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package entity

// StringSet is a set of string elements
type StringSet map[string]struct{}

// StringSetOf creates a set with given elements
func StringSetOf(s ...string) StringSet {
set := make(StringSet, len(s))
for i := 0; i < len(s); i++ {
set[s[i]] = struct{}{}
}
return set
}

// NewStringSet creates a set of given size
func NewStringSet(size int) StringSet {
return make(StringSet, size)
}

// Add adds element to set
func (set StringSet) Add(e string) {
set[e] = struct{}{}
}
29 changes: 0 additions & 29 deletions filesutil/utils.go

This file was deleted.

10 changes: 8 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
module github.com/m-manu/rsync-sidekick

go 1.16
go 1.17

require (
github.com/stretchr/testify v1.7.0
golang.org/x/text v0.3.6
golang.org/x/text v0.3.7
)

require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
Loading

0 comments on commit 0335451

Please sign in to comment.