Skip to content

Commit

Permalink
Merge pull request #22 from axone-protocol/chore/prepare-v2
Browse files Browse the repository at this point in the history
Chore/prepare v2
  • Loading branch information
ccamel authored Nov 25, 2024
2 parents eec929d + 0a9bd04 commit b16f8f9
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 18 deletions.
4 changes: 2 additions & 2 deletions cmd/1pl/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package main

import (
"fmt"
"github.com/axone-protocol/prolog"
"github.com/axone-protocol/prolog/engine"
"github.com/axone-protocol/prolog/v2"
"github.com/axone-protocol/prolog/v2/engine"
"io"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/1pl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (

"golang.org/x/crypto/ssh/terminal"

"github.com/axone-protocol/prolog"
"github.com/axone-protocol/prolog/engine"
"github.com/axone-protocol/prolog/v2"
"github.com/axone-protocol/prolog/v2/engine"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions examples/call_go_from_prolog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"net/http"

"github.com/axone-protocol/prolog"
"github.com/axone-protocol/prolog/engine"
"github.com/axone-protocol/prolog/v2"
"github.com/axone-protocol/prolog/v2/engine"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/dcg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"flag"
"fmt"

"github.com/axone-protocol/prolog"
"github.com/axone-protocol/prolog/v2"
)

// This example explains how to parse a simple English sentence with DCG (Definite Clause Grammar).
Expand Down
2 changes: 1 addition & 1 deletion examples/embed_prolog_into_go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"

"github.com/axone-protocol/prolog"
"github.com/axone-protocol/prolog/v2"
)

// http://www.cse.unsw.edu.au/~billw/dictionaries/prolog/cut.html
Expand Down
4 changes: 2 additions & 2 deletions examples/hanoi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"flag"
"fmt"

"github.com/axone-protocol/prolog"
"github.com/axone-protocol/prolog/engine"
"github.com/axone-protocol/prolog/v2"
"github.com/axone-protocol/prolog/v2/engine"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/initialization/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
_ "embed"
"os"

"github.com/axone-protocol/prolog"
"github.com/axone-protocol/prolog/v2"
)

//go:embed hello.pl
Expand Down
4 changes: 2 additions & 2 deletions examples/sandboxing/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package main

import (
"fmt"
"github.com/axone-protocol/prolog/engine"
"github.com/axone-protocol/prolog/v2/engine"

"github.com/axone-protocol/prolog"
"github.com/axone-protocol/prolog/v2"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/axone-protocol/prolog
module github.com/axone-protocol/prolog/v2

go 1.23

Expand Down
2 changes: 1 addition & 1 deletion interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os"
"strings"

"github.com/axone-protocol/prolog/engine"
"github.com/axone-protocol/prolog/v2/engine"
)

//go:embed bootstrap.pl
Expand Down
2 changes: 1 addition & 1 deletion interpreter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"
"time"

"github.com/axone-protocol/prolog/engine"
"github.com/axone-protocol/prolog/v2/engine"
"github.com/stretchr/testify/assert"
)

Expand Down
29 changes: 29 additions & 0 deletions scripts/bump-module.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -eo pipefail

major_version=$(cut -d. -f1 < version)

if [ "${major_version}" -gt 1 ]; then
module_name=$(go mod edit -json | jq -r '.Module.Path')
module_name_unversioned=$(echo "${module_name}" | sed -E 's|/v[0-9]+$||')
module_name_versioned="${module_name_unversioned}/v${major_version}"
echo "🔬 major version detected, updating module path to ${module_name_versioned}"

go mod edit -module "${module_name_versioned}"
echo "✅ module name updated to ${module_name_versioned} in go.mod"

if [ "$(uname)" = "Darwin" ]; then
find . -type f -name "*.go" -exec \
sed -i '' "s|\"${module_name}|\"${module_name_versioned}|g" {} \;
else
find . -type f -name "*.go" -exec \
sed -i "s|\"${module_name}|\"${module_name_versioned}|g" {} \;
fi
echo "✅ packages updated to ${module_name_versioned} in source files"

echo "🧹 cleaning up go.sum"
go mod tidy
else
echo "🙅version is not greater than 1, no need to update module path"
fi
2 changes: 1 addition & 1 deletion solutions.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"reflect"
"strings"

"github.com/axone-protocol/prolog/engine"
"github.com/axone-protocol/prolog/v2/engine"
)

// ErrClosed indicates the Solutions are already closed and unable to perform the operation.
Expand Down
2 changes: 1 addition & 1 deletion solutions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/axone-protocol/prolog/engine"
"github.com/axone-protocol/prolog/v2/engine"

"github.com/stretchr/testify/assert"
)
Expand Down
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.0.0

0 comments on commit b16f8f9

Please sign in to comment.