Browse Source

Migrate to GitLab

master
Trevor Slocum 1 year ago
parent
commit
2e08a42ac9
24 changed files with 71 additions and 125 deletions
  1. +0
    -27
      .builds/amd64_freebsd.yml
  2. +0
    -27
      .builds/amd64_linux_alpine.yml
  3. +2
    -2
      .gitignore
  4. +8
    -0
      .gitlab-ci.yml
  5. +7
    -7
      README.md
  6. +3
    -3
      cmd/netris-server/main.go
  7. +8
    -10
      cmd/netris/gui.go
  8. +4
    -4
      cmd/netris/gui_init.go
  9. +2
    -2
      cmd/netris/gui_input.go
  10. +1
    -1
      cmd/netris/gui_test.go
  11. +4
    -4
      cmd/netris/gui_title.go
  12. +3
    -3
      cmd/netris/main.go
  13. +6
    -7
      go.mod
  14. +11
    -15
      go.sum
  15. +2
    -2
      goreleaser.yml
  16. +1
    -1
      pkg/game/command.go
  17. +1
    -1
      pkg/game/conn.go
  18. +2
    -2
      pkg/game/game.go
  19. +1
    -1
      pkg/game/player.go
  20. +1
    -1
      pkg/game/server.go
  21. +1
    -1
      pkg/game/ssh/server.go
  22. +1
    -1
      pkg/game/ssh/server_windows.go
  23. +1
    -1
      pkg/mino/matrix.go
  24. +1
    -2
      pkg/mino/mino.go

+ 0
- 27
.builds/amd64_freebsd.yml View File

@ -1,27 +0,0 @@
arch: amd64
environment:
PROJECT_DIR: '~/go/src/git.sr.ht/~tslocum'
PROJECT_NAME: 'netris'
CGO_ENABLED: '0'
GO111MODULE: 'on'
image: freebsd/latest
packages:
- go
sources:
- https://git.sr.ht/~tslocum/netris
tasks:
- setup: |
mkdir -p $PROJECT_DIR
mv $PROJECT_NAME $PROJECT_DIR/$PROJECT_NAME
- deps: |
cd $PROJECT_DIR/$PROJECT_NAME
go mod download
- test: |
cd $PROJECT_DIR/$PROJECT_NAME
go test ./...
- build-client: |
cd $PROJECT_DIR/$PROJECT_NAME/cmd/netris
go build
- build-server: |
cd $PROJECT_DIR/$PROJECT_NAME/cmd/netris-server
go build

+ 0
- 27
.builds/amd64_linux_alpine.yml View File

@ -1,27 +0,0 @@
arch: x86_64
environment:
PROJECT_DIR: '~/go/src/git.sr.ht/~tslocum'
PROJECT_NAME: 'netris'
CGO_ENABLED: '0'
GO111MODULE: 'on'
image: alpine/edge
packages:
- go
sources:
- https://git.sr.ht/~tslocum/netris
tasks:
- setup: |
mkdir -p $PROJECT_DIR
mv $PROJECT_NAME $PROJECT_DIR/$PROJECT_NAME
- deps: |
cd $PROJECT_DIR/$PROJECT_NAME
go mod download
- test: |
cd $PROJECT_DIR/$PROJECT_NAME
go test ./...
- build-client: |
cd $PROJECT_DIR/$PROJECT_NAME/cmd/netris
go build
- build-server: |
cd $PROJECT_DIR/$PROJECT_NAME/cmd/netris-server
go build

+ 2
- 2
.gitignore View File

@ -1,6 +1,6 @@
.idea/
dist/
*.sh
vendor/
cmd/netris-server/netris-server
*.sh
cmd/netris/netris
cmd/netris-server/netris-server

+ 8
- 0
.gitlab-ci.yml View File

@ -0,0 +1,8 @@
stages:
- test
test:
image: golang:latest
stage: test
script:
- go test -v ./...

+ 7
- 7
README.md View File

@ -1,6 +1,6 @@
# netris
[![GoDoc](https://godoc.org/git.sr.ht/~tslocum/netris?status.svg)](https://godoc.org/git.sr.ht/~tslocum/netris)
[![builds.sr.ht status](https://builds.sr.ht/~tslocum/netris.svg)](https://builds.sr.ht/~tslocum/netris)
[![GoDoc](https://godoc.org/gitlab.com/tslocum/netris?status.svg)](https://godoc.org/gitlab.com/tslocum/netris)
[![CI status](https://gitlab.com/tslocum/netris/badges/master/pipeline.svg)](https://gitlab.com/tslocum/netris/commits/master)
[![Donate](https://img.shields.io/liberapay/receives/rocketnine.space.svg?logo=liberapay)](https://liberapay.com/rocketnine.space)
Multiplayer Tetris clone
@ -28,26 +28,26 @@ Windows and Linux binaries are available.
### Compile
```
GO111MODULE=on go get git.sr.ht/~tslocum/netris/...
GO111MODULE=on go get gitlab.com/tslocum/netris/...
```
## Configure
See [CONFIGURATION.md](https://man.sr.ht/~tslocum/netris/CONFIGURATION.md)
See [CONFIGURATION.md](https://gitlab.com/tslocum/netris/blob/master/CONFIGURATION.md)
## How to Play
See [GAMEPLAY.md](https://man.sr.ht/~tslocum/netris/GAMEPLAY.md)
See [GAMEPLAY.md](https://gitlab.com/tslocum/netris/blob/master/GAMEPLAY.md)
## Support
Please share suggestions/issues [here](https://todo.sr.ht/~tslocum/netris).
Please share issues/suggestions [here](https://gitlab.com/tslocum/netris/issues).
## Libraries
The following libraries are used to build netris:
* [cview](https://git.sr.ht/~tslocum/cview) - User interface
* [cview](https://gitlab.com/tslocum/cview) - User interface
* [tcell](https://github.com/gdamore/tcell) - User interface
* [ssh](https://github.com/gliderlabs/ssh) - SSH server
* [pty](https://github.com/creack/pty) - Pseudo-terminal interface


+ 3
- 3
cmd/netris-server/main.go View File

@ -10,9 +10,9 @@ import (
"syscall"
"time"
"git.sr.ht/~tslocum/netris/pkg/event"
"git.sr.ht/~tslocum/netris/pkg/game"
"git.sr.ht/~tslocum/netris/pkg/game/ssh"
"gitlab.com/tslocum/netris/pkg/event"
"gitlab.com/tslocum/netris/pkg/game"
"gitlab.com/tslocum/netris/pkg/game/ssh"
)
var (


+ 8
- 10
cmd/netris/gui.go View File

@ -10,11 +10,11 @@ import (
"sync"
"time"
"git.sr.ht/~tslocum/cview"
"git.sr.ht/~tslocum/netris/pkg/event"
"git.sr.ht/~tslocum/netris/pkg/game"
"git.sr.ht/~tslocum/netris/pkg/mino"
"github.com/gdamore/tcell"
"gitlab.com/tslocum/cview"
"gitlab.com/tslocum/netris/pkg/event"
"gitlab.com/tslocum/netris/pkg/game"
"gitlab.com/tslocum/netris/pkg/mino"
)
var (
@ -42,8 +42,7 @@ var (
multiplayerMatrixSize int
screenPadding int
screenW, screenH int
newScreenW, newScreenH int
screenW, screenH int
nickname = "Anonymous"
nicknameDraft string
@ -97,13 +96,12 @@ func resetPlayerSettingsForm() {
// BS 1: 10x10
// BS 2: 20x20
// BS 3: 40x40
func handleResize(screen tcell.Screen) {
newScreenW, newScreenH = screen.Size()
if newScreenW == screenW && newScreenH == screenH {
func handleResize(width int, height int) {
if width == screenW && height == screenH {
return
}
screenW, screenH = newScreenW, newScreenH
screenW, screenH = width, height
if !fixedBlockSize {
if screenW >= 106 && screenH >= 46 {


+ 4
- 4
cmd/netris/gui_init.go View File

@ -4,11 +4,11 @@ import (
"log"
"unicode"
"git.sr.ht/~tslocum/cview"
"git.sr.ht/~tslocum/netris/pkg/event"
"git.sr.ht/~tslocum/netris/pkg/game"
"git.sr.ht/~tslocum/netris/pkg/mino"
"github.com/gdamore/tcell"
"gitlab.com/tslocum/cview"
"gitlab.com/tslocum/netris/pkg/event"
"gitlab.com/tslocum/netris/pkg/game"
"gitlab.com/tslocum/netris/pkg/mino"
)
func initGUI(skipTitle bool) (*cview.Application, error) {


+ 2
- 2
cmd/netris/gui_input.go View File

@ -7,9 +7,9 @@ import (
"runtime/pprof"
"strings"
"git.sr.ht/~tslocum/netris/pkg/event"
"git.sr.ht/~tslocum/netris/pkg/game"
"github.com/gdamore/tcell"
"gitlab.com/tslocum/netris/pkg/event"
"gitlab.com/tslocum/netris/pkg/game"
)
type Keybinding struct {


+ 1
- 1
cmd/netris/gui_test.go View File

@ -4,7 +4,7 @@ import (
"fmt"
"testing"
"git.sr.ht/~tslocum/netris/pkg/mino"
"gitlab.com/tslocum/netris/pkg/mino"
)
func TestRenderMatrix(t *testing.T) {


+ 4
- 4
cmd/netris/gui_title.go View File

@ -6,10 +6,10 @@ import (
"strconv"
"time"
"git.sr.ht/~tslocum/cview"
"git.sr.ht/~tslocum/netris/pkg/event"
"git.sr.ht/~tslocum/netris/pkg/game"
"git.sr.ht/~tslocum/netris/pkg/mino"
"gitlab.com/tslocum/cview"
"gitlab.com/tslocum/netris/pkg/event"
"gitlab.com/tslocum/netris/pkg/game"
"gitlab.com/tslocum/netris/pkg/mino"
)
const (


+ 3
- 3
cmd/netris/main.go View File

@ -17,10 +17,10 @@ import (
"syscall"
"time"
"git.sr.ht/~tslocum/netris/pkg/event"
"git.sr.ht/~tslocum/netris/pkg/game"
"git.sr.ht/~tslocum/netris/pkg/mino"
"github.com/mattn/go-isatty"
"gitlab.com/tslocum/netris/pkg/event"
"gitlab.com/tslocum/netris/pkg/game"
"gitlab.com/tslocum/netris/pkg/mino"
)
var (


+ 6
- 7
go.mod View File

@ -1,17 +1,16 @@
module git.sr.ht/~tslocum/netris
module gitlab.com/tslocum/netris
go 1.13
require (
git.sr.ht/~tslocum/cview v0.2.2-0.20200103004846-1207c71f9f20
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect
github.com/creack/pty v1.1.9
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
github.com/gdamore/tcell v1.3.0
github.com/gliderlabs/ssh v0.2.2
github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
github.com/mattn/go-isatty v0.0.11
github.com/mattn/go-runewidth v0.0.7 // indirect
golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876
golang.org/x/sys v0.0.0-20200103143344-a1369afcdac7 // indirect
github.com/mattn/go-isatty v0.0.12
github.com/mattn/go-runewidth v0.0.8 // indirect
gitlab.com/tslocum/cview v1.4.1-0.20200122232819-5f880bc2c7e6
golang.org/x/crypto v0.0.0-20200117160349-530e935923ad
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 // indirect
)

+ 11
- 15
go.sum View File

@ -1,6 +1,3 @@
git.sr.ht/~tslocum/cview v0.2.2-0.20200103004846-1207c71f9f20 h1:bEvYUKm++WdkbJXhxeYpwNr55jBmTfQ8TRLMKxaCHzE=
git.sr.ht/~tslocum/cview v0.2.2-0.20200103004846-1207c71f9f20/go.mod h1:92oD1V0TlLtAeJUruA+p5/P6sVL0p8TMMosPwqz0/gM=
github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
@ -14,31 +11,30 @@ github.com/gdamore/tcell v1.3.0 h1:r35w0JBADPZCVQijYebl6YMWWtHRqVEGt7kL2eBADRM=
github.com/gdamore/tcell v1.3.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM=
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4=
github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s=
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0=
github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
gitlab.com/tslocum/cview v1.4.1-0.20200122232819-5f880bc2c7e6 h1:C0UWplFR3t8+7Wj3M194fMIESyiN2jQBaukstRwRETk=
gitlab.com/tslocum/cview v1.4.1-0.20200122232819-5f880bc2c7e6/go.mod h1:QbxliYQa2I32UJH2boP54jq6tnWlgm6yViaFXKGDfuM=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876 h1:sKJQZMuxjOAR/Uo2LBfU90onWEf1dF4C+0hPJCc9Mpc=
golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200117160349-530e935923ad h1:Jh8cai0fqIK+f6nG0UgPW5wFk8wmiMhM3AyciDBdtQg=
golang.org/x/crypto v0.0.0-20200117160349-530e935923ad/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191018095205-727590c5006e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200103143344-a1369afcdac7 h1:/W9OPMnnpmFXHYkcp2rQsbFUbRlRzfECQjmAFiOyHE8=
golang.org/x/sys v0.0.0-20200103143344-a1369afcdac7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=


+ 2
- 2
goreleaser.yml View File

@ -8,7 +8,7 @@ builds:
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X git.sr.ht/~tslocum/netris/pkg/game.Version={{.Version}}
- -s -w -X gitlab.com/tslocum/netris/pkg/game.Version={{.Version}}
goos:
- darwin
- freebsd
@ -22,7 +22,7 @@ builds:
binary: netris-server
main: ./cmd/netris-server
ldflags:
- -s -w -X git.sr.ht/~tslocum/netris/pkg/game.Version={{.Version}}
- -s -w -X gitlab.com/tslocum/netris/pkg/game.Version={{.Version}}
goos:
- darwin
- freebsd


+ 1
- 1
pkg/game/command.go View File

@ -4,7 +4,7 @@ import (
"strconv"
"time"
"git.sr.ht/~tslocum/netris/pkg/mino"
"gitlab.com/tslocum/netris/pkg/mino"
)
type Command int


+ 1
- 1
pkg/game/conn.go View File

@ -9,7 +9,7 @@ import (
"sync"
"time"
"git.sr.ht/~tslocum/netris/pkg/event"
"gitlab.com/tslocum/netris/pkg/event"
)
const ConnTimeout = 30 * time.Second


+ 2
- 2
pkg/game/game.go View File

@ -10,9 +10,9 @@ import (
"sync"
"time"
"git.sr.ht/~tslocum/netris/pkg/event"
"gitlab.com/tslocum/netris/pkg/event"
"git.sr.ht/~tslocum/netris/pkg/mino"
"gitlab.com/tslocum/netris/pkg/mino"
)
const (


+ 1
- 1
pkg/game/player.go View File

@ -4,7 +4,7 @@ import (
"regexp"
"time"
"git.sr.ht/~tslocum/netris/pkg/mino"
"gitlab.com/tslocum/netris/pkg/mino"
)
const (


+ 1
- 1
pkg/game/server.go View File

@ -10,7 +10,7 @@ import (
"sync"
"time"
"git.sr.ht/~tslocum/netris/pkg/event"
"gitlab.com/tslocum/netris/pkg/event"
)
const (


+ 1
- 1
pkg/game/ssh/server.go View File

@ -14,9 +14,9 @@ import (
"time"
"unsafe"
"git.sr.ht/~tslocum/netris/pkg/game"
"github.com/creack/pty"
"github.com/gliderlabs/ssh"
"gitlab.com/tslocum/netris/pkg/game"
gossh "golang.org/x/crypto/ssh"
)


+ 1
- 1
pkg/game/ssh/server_windows.go View File

@ -2,7 +2,7 @@
package ssh
import "git.sr.ht/~tslocum/netris/pkg/game"
import "gitlab.com/tslocum/netris/pkg/game"
// SSH server is unsupported on Windows


+ 1
- 1
pkg/mino/matrix.go View File

@ -9,7 +9,7 @@ import (
"sync"
"time"
"git.sr.ht/~tslocum/netris/pkg/event"
"gitlab.com/tslocum/netris/pkg/event"
)
const (


+ 1
- 2
pkg/mino/mino.go View File

@ -253,9 +253,8 @@ func (m Mino) Flatten() Mino {
}
newMino := make(Mino, len(m))
copy(newMino, m)
for i := 0; i < len(m); i++ {
newMino[i] = rotateFunc(newMino[i])
newMino[i] = rotateFunc(m[i])
}
return newMino


Loading…
Cancel
Save