Skip to content

Commit

Permalink
Change name to kopyat
Browse files Browse the repository at this point in the history
  • Loading branch information
karagenc committed Jul 31, 2024
1 parent d349261 commit d201494
Show file tree
Hide file tree
Showing 42 changed files with 160 additions and 160 deletions.
10 changes: 5 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
**/.vscode
**/__debug_bin*
/kopyaship
/kopyaship.exe
/kopyaship-*
/kopyaship.lock
/kopyaship.yml
/kopyat
/kopyat.exe
/kopyat-*
/kopyat.lock
/kopyat.yml
/tmp
**/test_ifile*
**/test_txtfile*
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.vscode
__debug_bin*
/kopyaship
/kopyaship.exe
/kopyaship-*
/kopyaship.lock
/kopyaship.yml
/kopyat
/kopyat.exe
/kopyat-*
/kopyat.lock
/kopyat.yml
/tmp
test_ifile*
*.out
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ all: generate build

generate:
go run ./scripts/generate.go
statik -f -src=. -include=kopyaship_example.yml -dest=./internal
statik -f -src=. -include=kopyat_example.yml -dest=./internal

build:
go build -ldflags '-s -w' ./cmd/kopyaship
go build -ldflags '-s -w' ./cmd/kopyat

test:
go test -v -buildmode=default -race ./...
Expand All @@ -16,9 +16,9 @@ test-coverage:
go test -buildmode=default -coverprofile coverage.out -covermode=atomic ./...

install:
mv kopyaship $(PREFIX)
mv kopyat $(PREFIX)

clean:
rm -f kopyaship kopyaship.exe ifile/test_ifile_* ifile/test_txtfile_*
rm -f kopyat kopyat.exe ifile/test_ifile_* ifile/test_txtfile_*

.PHONY: build generate test test-coverage install clean
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# kopyaship
# kopyat

The name kopyaship comes from 2 words: kopya (Turkish for "copy") and ship -> copyship. It is pronounced as copiaship.
The name kopyat comes from 2 words: kopya (Turkish for "copy") and cat -> copycat.

## Config

- Paths in config are relative to the config file. Exception to this are backup base path and backup paths. They must be absolute in order for ifile to be generated without problems.

### Environment variables

- `KOPYASHIP_CONFIG`
- `KOPYASHIP_STATE_DIR`
- `KOPYASHIP_SCRIPT`
- `KOPYAT_CONFIG`
- `KOPYAT_STATE_DIR`
- `KOPYAT_SCRIPT`
- Set to `1` only inside Go hooks.

### Hooks (Scripts)
Expand All @@ -19,7 +19,7 @@ The name kopyaship comes from 2 words: kopya (Turkish for "copy") and ship -> co
package x
// ^ package name can be anything, including main.

import "github.com/tomruk/kopyaship"
import "github.com/karagenc/kopyat"

func init() {

Expand Down
6 changes: 3 additions & 3 deletions cmd/kopyaship/api.go → cmd/kopyat/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"runtime"
"strings"

"github.com/karagenc/finddirs-go"
"github.com/karagenc/kopyat/internal/utils"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/tomruk/finddirs-go"
"github.com/tomruk/kopyaship/internal/utils"
)

const apiSocketFileName = "api.socket"
Expand Down Expand Up @@ -53,7 +53,7 @@ func newHTTPClient() (*httpClient, error) {
// Unix socket is supported on Windows 10 Insider Build 17063 and later.
// For older versions, fall back to HTTP.
if listen == "ipc" && runtime.GOOS == "windows" {
tempSocketDir, err := os.MkdirTemp("", "kopyaship_*")
tempSocketDir, err := os.MkdirTemp("", "kopyat_*")
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/kopyaship/backup.go → cmd/kopyat/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"fmt"
"os"

"github.com/karagenc/kopyat/internal/backup"
_ctx "github.com/karagenc/kopyat/internal/scripting/ctx"
"github.com/karagenc/kopyat/internal/utils"
"github.com/spf13/cobra"
"github.com/tomruk/kopyaship/internal/backup"
_ctx "github.com/tomruk/kopyaship/internal/scripting/ctx"
"github.com/tomruk/kopyaship/internal/utils"
"golang.org/x/sync/errgroup"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kopyaship/doctor.go → cmd/kopyat/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"path/filepath"

"github.com/fatih/color"
"github.com/karagenc/kopyat/internal/utils"
"github.com/spf13/cobra"
"github.com/tomruk/kopyaship/internal/utils"
)

var doctorCmd = &cobra.Command{
Expand Down
4 changes: 2 additions & 2 deletions cmd/kopyaship/hooks.go → cmd/kopyat/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"strings"

"github.com/tomruk/kopyaship/internal/scripting"
"github.com/tomruk/kopyaship/internal/scripting/ctx"
"github.com/karagenc/kopyat/internal/scripting"
"github.com/karagenc/kopyat/internal/scripting/ctx"
"golang.org/x/sync/errgroup"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kopyaship/ifile.go → cmd/kopyat/ifile.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"os"
"path/filepath"

"github.com/karagenc/kopyat/internal/ifile"
"github.com/spf13/cobra"
"github.com/tomruk/kopyaship/internal/ifile"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions cmd/kopyaship/init.go → cmd/kopyat/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"fmt"

"github.com/karagenc/kopyat/internal/backup"
"github.com/karagenc/kopyat/internal/backup/provider"
"github.com/spf13/cobra"
"github.com/tomruk/kopyaship/internal/backup"
"github.com/tomruk/kopyaship/internal/backup/provider"
)

var initCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/kopyaship/log.go → cmd/kopyat/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"runtime"

"github.com/tomruk/kopyaship/internal/utils"
"github.com/karagenc/kopyat/internal/utils"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
Expand Down
28 changes: 14 additions & 14 deletions cmd/kopyaship/main.go → cmd/kopyat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
"syscall"

gochoice "github.com/TwiN/go-choice"
"github.com/karagenc/finddirs-go"
_config "github.com/karagenc/kopyat/internal/config"
"github.com/karagenc/kopyat/internal/utils"
"github.com/rakyll/statik/fs"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tomruk/finddirs-go"
_config "github.com/tomruk/kopyaship/internal/config"
"github.com/tomruk/kopyaship/internal/utils"
"go.uber.org/zap"

_ "github.com/tomruk/kopyaship/internal/statik"
_ "github.com/karagenc/kopyat/internal/statik"
)

var (
Expand All @@ -31,7 +31,7 @@ var (

debugLog *zap.Logger

rootCmd = &cobra.Command{Use: "kopyaship"}
rootCmd = &cobra.Command{Use: "kopyat"}
)

func main() { rootCmd.Execute() }
Expand Down Expand Up @@ -79,7 +79,7 @@ func init() {
exists, extractErr := extractConfigInteractive()
if !exists {
utils.Red.Print("Error: ")
fmt.Printf("%v: in addition to that, example config is not found within executable. consider fetching it from https://github.com/tomruk/kopyaship\n", err)
fmt.Printf("%v: in addition to that, example config is not found within executable. consider fetching it from https://github.com/karagenc/kopyat\n", err)
exit(exitErrAny)
} else if extractErr != nil {
errPrintln(extractErr)
Expand Down Expand Up @@ -143,7 +143,7 @@ func extractConfigInteractive() (exists bool, err error) {
if err != nil {
return false, err
}
exampleFile, err := statikFS.Open("/kopyaship_example.yml")
exampleFile, err := statikFS.Open("/kopyat_example.yml")
if err != nil {
return false, err
}
Expand All @@ -168,7 +168,7 @@ func extractConfigInteractive() (exists bool, err error) {
systemAppDirs.ConfigDir,
}...)
dir, _, err := gochoice.Pick(
"Where to store the config file, kopyaship.yml?\nPick:",
"Where to store the config file, kopyat.yml?\nPick:",
dirs,
)
if err != nil {
Expand All @@ -179,23 +179,23 @@ func extractConfigInteractive() (exists bool, err error) {
if err != nil {
return true, err
}
err = os.WriteFile(filepath.Join(dir, "kopyaship.yml"), example, 0644)
err = os.WriteFile(filepath.Join(dir, "kopyat.yml"), example, 0644)
if err != nil {
return true, err
}
utils.Success.Println("Config written. Make sure you've fully read and edited it before running kopyaship")
utils.Success.Println("Config written. Make sure you've fully read and edited it before running kopyat")
return true, nil
}

func initStateDir(systemWide bool, userStateDir, systemStateDir string) (err error) {
stateDir = os.Getenv("KOPYASHIP_STATE_DIR")
stateDir = os.Getenv("KOPYAT_STATE_DIR")
if stateDir == "" {
if systemWide {
stateDir = systemStateDir
} else {
stateDir = userStateDir
}
err = os.Setenv("KOPYASHIP_STATE_DIR", stateDir)
err = os.Setenv("KOPYAT_STATE_DIR", stateDir)
if err != nil {
return err
}
Expand All @@ -204,14 +204,14 @@ func initStateDir(systemWide bool, userStateDir, systemStateDir string) (err err
}

func initCacheDir(systemWide bool, userCacheDir, systemCacheDir string) (err error) {
cacheDir = os.Getenv("KOPYASHIP_CACHE")
cacheDir = os.Getenv("KOPYAT_CACHE")
if cacheDir == "" {
if systemWide {
cacheDir = systemCacheDir
} else {
cacheDir = userCacheDir
}
err = os.Setenv("KOPYASHIP_CACHE", cacheDir)
err = os.Setenv("KOPYAT_CACHE", cacheDir)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/kopyaship/ping.go → cmd/kopyat/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"io"

"github.com/karagenc/kopyat/internal/utils"
"github.com/spf13/cobra"
"github.com/tomruk/kopyaship/internal/utils"
)

var pingCmd = &cobra.Command{
Expand Down
4 changes: 2 additions & 2 deletions cmd/kopyaship/run_script.go → cmd/kopyat/run_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"strings"

"github.com/karagenc/kopyat/internal/scripting"
_ctx "github.com/karagenc/kopyat/internal/scripting/ctx"
"github.com/spf13/cobra"
"github.com/tomruk/kopyaship/internal/scripting"
_ctx "github.com/tomruk/kopyaship/internal/scripting/ctx"
)

var runScript = &cobra.Command{
Expand Down
14 changes: 7 additions & 7 deletions cmd/kopyaship/service.go → cmd/kopyat/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ import (
"time"

"github.com/gofrs/flock"
"github.com/karagenc/kopyat/internal/ifile"
"github.com/karagenc/kopyat/internal/utils"
"github.com/kardianos/service"
"github.com/labstack/echo/v4"
"github.com/spf13/cobra"
"github.com/tomruk/kopyaship/internal/ifile"
"github.com/tomruk/kopyaship/internal/utils"
"go.uber.org/zap"
)

var serviceCmd = &cobra.Command{
Use: "service",
Run: func(cmd *cobra.Command, args []string) {
config := &service.Config{
Name: "kopyaship",
DisplayName: "Kopyaship service",
Name: "kopyat",
DisplayName: "Kopyat service",
}

svc := &svc{}
Expand Down Expand Up @@ -162,14 +162,14 @@ var lockFile = func() string {
case "windows":
lockDir = os.Getenv("PROGRAMDATA")
if lockDir == "" {
lockDir = "C:/ProgramData/kopyaship"
lockDir = "C:/ProgramData/kopyat"
}
case "plan9":
lockDir = "/lib/kopyaship"
lockDir = "/lib/kopyat"
default: // unix
lockDir = "/var/lock"
}
return filepath.Join(lockDir, "kopyaship_service.lock")
return filepath.Join(lockDir, "kopyat_service.lock")
}()

func (s *svc) initLock() error {
Expand Down
6 changes: 3 additions & 3 deletions cmd/kopyaship/watch_job.go → cmd/kopyat/watch_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"path/filepath"

"github.com/jedib0t/go-pretty/v6/table"
"github.com/karagenc/kopyat/internal/ifile"
"github.com/karagenc/kopyat/internal/scripting/ctx"
"github.com/karagenc/kopyat/internal/utils"
"github.com/labstack/echo/v4"
"github.com/spf13/cobra"
"github.com/tomruk/kopyaship/internal/ifile"
"github.com/tomruk/kopyaship/internal/scripting/ctx"
"github.com/tomruk/kopyaship/internal/utils"
"golang.org/x/sync/errgroup"
)

Expand Down
4 changes: 2 additions & 2 deletions context.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kopyaship
package kopyat

import "github.com/tomruk/kopyaship/internal/scripting/ctx"
import "github.com/karagenc/kopyat/internal/scripting/ctx"

type (
Context = ctx.Context
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: '3'

services:
kopyaship:
kopyat:
build:
dockerfile: docker/build.Dockerfile
volumes:
- ./kopyaship.yml:/etc/kopyaship.yml
- ./kopyat.yml:/etc/kopyat.yml
4 changes: 2 additions & 2 deletions docker/build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ RUN apk --no-cache add \
ca-certificates tzdata \
&& update-ca-certificates

COPY --from=build /src/kopyaship /usr/local/bin
COPY --from=build /src/kopyat /usr/local/bin

ENTRYPOINT [ "kopyaship", "service" ]
ENTRYPOINT [ "kopyat", "service" ]
Loading

0 comments on commit d201494

Please sign in to comment.