Skip to content

Commit

Permalink
Merge pull request #60 from src-d/v1
Browse files Browse the repository at this point in the history
Merge v1 to master
  • Loading branch information
Miguel Molina authored Mar 2, 2017
2 parents 3d51ee1 + 47f4d67 commit ff715db
Show file tree
Hide file tree
Showing 24 changed files with 69 additions and 68 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can read more about the motivations behind building proteus in [this blog po
### Install

```
go get -v github.com/src-d/proteus/...
go get -v gopkg.in/src-d/proteus.v1/...
```

### Requirements
Expand Down
7 changes: 4 additions & 3 deletions cli/proteus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
"os/exec"
"path/filepath"

"github.com/src-d/proteus"
"github.com/src-d/proteus/protobuf"
"github.com/src-d/proteus/report"
"gopkg.in/src-d/proteus.v1"
"gopkg.in/src-d/proteus.v1/protobuf"
"gopkg.in/src-d/proteus.v1/report"

"gopkg.in/urfave/cli.v1"
)

Expand Down
4 changes: 2 additions & 2 deletions example/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
regenerate:
- make -C $(GOPATH)/src/github.com/src-d/proteus reinstall
- proteus -p github.com/src-d/proteus/example -f $(GOPATH)/src/github.com/src-d/proteus/example/protos --verbose
- make -C $(GOPATH)/src/gopkg.in/src-d/proteus.v1 reinstall
- proteus -p gopkg.in/src-d/proteus.v1/example -f $(GOPATH)/src/gopkg.in/src-d/proteus.v1/example/protos --verbose
2 changes: 1 addition & 1 deletion example/client/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package client

import (
"github.com/src-d/proteus/example"
"gopkg.in/src-d/proteus.v1/example"

"golang.org/x/net/context"
"google.golang.org/grpc"
Expand Down
8 changes: 4 additions & 4 deletions example/generated.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package example

import "time"

//go:generate proteus -p github.com/src-d/proteus/example -f $GOPATH/src/github.com/src-d/proteus/example/protos
//go:generate proteus -p gopkg.in/src-d/proteus.v1/example -f $GOPATH/src/gopkg.in/src-d/proteus.v1/example/protos

//proteus:generate
type Product struct {
Expand Down
2 changes: 1 addition & 1 deletion example/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package server
import (
"net"

"github.com/src-d/proteus/example"
"gopkg.in/src-d/proteus.v1/example"

"google.golang.org/grpc"
)
Expand Down
4 changes: 2 additions & 2 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"strings"

"github.com/src-d/proteus/example/client"
"github.com/src-d/proteus/example/server"
"gopkg.in/src-d/proteus.v1/example/client"
"gopkg.in/src-d/proteus.v1/example/server"
)

func ExampleProteus() {
Expand Down
2 changes: 1 addition & 1 deletion fixtures/bar.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package foo

import "github.com/src-d/proteus/fixtures/subpkg"
import "gopkg.in/src-d/proteus.v1/fixtures/subpkg"

// Bar ...
//proteus:generate
Expand Down
8 changes: 4 additions & 4 deletions proteus.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package proteus

import (
"github.com/src-d/proteus/protobuf"
"github.com/src-d/proteus/resolver"
"github.com/src-d/proteus/rpc"
"github.com/src-d/proteus/scanner"
"gopkg.in/src-d/proteus.v1/protobuf"
"gopkg.in/src-d/proteus.v1/resolver"
"gopkg.in/src-d/proteus.v1/rpc"
"gopkg.in/src-d/proteus.v1/scanner"
)

// Options are all the available options to configure proto generation.
Expand Down
2 changes: 1 addition & 1 deletion protobuf/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"path/filepath"

"github.com/src-d/proteus/report"
"gopkg.in/src-d/proteus.v1/report"
)

// Generator is in charge of generating the .proto files and write them
Expand Down
2 changes: 1 addition & 1 deletion protobuf/protobuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sort"
"strings"

"github.com/src-d/proteus/scanner"
"gopkg.in/src-d/proteus.v1/scanner"
)

// Package represents an unique .proto file with its own package definition.
Expand Down
4 changes: 2 additions & 2 deletions protobuf/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/gogo/protobuf/protoc-gen-gogo/generator"

"github.com/src-d/proteus/report"
"github.com/src-d/proteus/scanner"
"gopkg.in/src-d/proteus.v1/report"
"gopkg.in/src-d/proteus.v1/scanner"
)

// Transformer is in charge of converting scanned Go entities to protobuf
Expand Down
18 changes: 9 additions & 9 deletions protobuf/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"strings"
"testing"

"github.com/src-d/proteus/report"
"github.com/src-d/proteus/resolver"
"github.com/src-d/proteus/scanner"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"gopkg.in/src-d/proteus.v1/report"
"gopkg.in/src-d/proteus.v1/resolver"
"gopkg.in/src-d/proteus.v1/scanner"
)

func TestToLowerSnakeCase(t *testing.T) {
Expand Down Expand Up @@ -636,21 +636,21 @@ func (s *TransformerSuite) TestTransform() {
pkgs := s.fixtures()
pkg := s.t.Transform(pkgs[0])

s.Equal("github.com.srcd.proteus.fixtures", pkg.Name)
s.Equal("github.com/src-d/proteus/fixtures", pkg.Path)
s.Equal("gopkg.in.srcd.proteus.v1.fixtures", pkg.Name)
s.Equal("gopkg.in/src-d/proteus.v1/fixtures", pkg.Path)
s.Equal(NewStringValue("foo"), pkg.Options["go_package"])
s.Equal([]string{
"github.com/gogo/protobuf/gogoproto/gogo.proto",
"google/protobuf/timestamp.proto",
"github.com/src-d/proteus/fixtures/subpkg/generated.proto",
"gopkg.in/src-d/proteus.v1/fixtures/subpkg/generated.proto",
}, pkg.Imports)
s.Equal(1, len(pkg.Enums))
s.Equal(4, len(pkg.Messages))
s.Equal(0, len(pkg.RPCs))

pkg = s.t.Transform(pkgs[1])
s.Equal("github.com.srcd.proteus.fixtures.subpkg", pkg.Name)
s.Equal("github.com/src-d/proteus/fixtures/subpkg", pkg.Path)
s.Equal("gopkg.in.srcd.proteus.v1.fixtures.subpkg", pkg.Name)
s.Equal("gopkg.in/src-d/proteus.v1/fixtures/subpkg", pkg.Path)
s.Equal(NewStringValue("subpkg"), pkg.Options["go_package"])
s.Equal([]string{"github.com/gogo/protobuf/gogoproto/gogo.proto"}, pkg.Imports)
s.Equal(0, len(pkg.Enums))
Expand Down Expand Up @@ -764,7 +764,7 @@ func nullable(t scanner.Type) scanner.Type {
return t
}

const project = "github.com/src-d/proteus"
const project = "gopkg.in/src-d/proteus.v1"

func projectPath(pkg string) string {
return filepath.Join(project, pkg)
Expand Down
32 changes: 16 additions & 16 deletions protobuf/type_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ func TestTypeSet_Add(t *testing.T) {
ts := NewTypeSet()
assert.Equal(t, 0, ts.Len())

res := ts.Add("github.com/src-d/proteus/protobuf", "TypeSet")
res := ts.Add("gopkg.in/src-d/proteus.v1/protobuf", "TypeSet")
assert.True(t, res, "element was added")
assert.Equal(t, 1, ts.Len(), "contains one element")

res = ts.Add("github.com/src-d/proteus/protobuf", "Transformer")
res = ts.Add("gopkg.in/src-d/proteus.v1/protobuf", "Transformer")
assert.True(t, res, "another element in the same package can be added")
assert.Equal(t, 2, ts.Len(), "contains two elements")

res = ts.Add("github.com/src-d/proteus/protobuf", "TypeSet")
res = ts.Add("gopkg.in/src-d/proteus.v1/protobuf", "TypeSet")
assert.False(t, res, "adding an element twice returns false")
assert.Equal(t, 2, ts.Len(), "there is no new element")

res = ts.Add("github.com/src-d/proteus/resolver", "Resolver")
res = ts.Add("gopkg.in/src-d/proteus.v1/resolver", "Resolver")
assert.True(t, res, "adding an element in a new package")
assert.Equal(t, 3, ts.Len(), "a new element was added")
}
Expand All @@ -33,14 +33,14 @@ func ExampleTypeSet() {

// Returns whether the item was added or not. If false, it means the item was
// already there.
res := ts.Add("github.com/src-d/proteus/protobuf", "TypeSet")
res := ts.Add("gopkg.in/src-d/proteus.v1/protobuf", "TypeSet")
fmt.Println(res)

res = ts.Add("github.com/src-d/proteus/protobuf", "TypeSet")
res = ts.Add("gopkg.in/src-d/proteus.v1/protobuf", "TypeSet")
fmt.Println(res)
fmt.Println(ts.Len())

fmt.Println(ts.Contains("github.com/src-d/proteus/protobuf", "TypeSet"))
fmt.Println(ts.Contains("gopkg.in/src-d/proteus.v1/protobuf", "TypeSet"))
fmt.Println(ts.Len())
// Output: true
// false
Expand All @@ -53,18 +53,18 @@ func TestTypeSet_Contains(t *testing.T) {
ts := NewTypeSet()
assert.Equal(t, 0, ts.Len())

res := ts.Add("github.com/src-d/proteus/protobuf", "TypeSet")
res := ts.Add("gopkg.in/src-d/proteus.v1/protobuf", "TypeSet")
assert.True(t, res, "element was added")
res = ts.Add("github.com/src-d/proteus/protobuf", "Type")
res = ts.Add("gopkg.in/src-d/proteus.v1/protobuf", "Type")
assert.True(t, res, "second element was added")
res = ts.Add("github.com/src-d/proteus/resolver", "Resolver")
res = ts.Add("gopkg.in/src-d/proteus.v1/resolver", "Resolver")
assert.True(t, res, "adding an element in a new package")

assert.True(t, ts.Contains("github.com/src-d/proteus/protobuf", "Type"), "contains protobuf.Type")
assert.True(t, ts.Contains("github.com/src-d/proteus/protobuf", "TypeSet"), "contains protobuf.TypeSet")
assert.True(t, ts.Contains("github.com/src-d/proteus/resolver", "Resolver"), "contains resolver.Resolver")
assert.True(t, ts.Contains("gopkg.in/src-d/proteus.v1/protobuf", "Type"), "contains protobuf.Type")
assert.True(t, ts.Contains("gopkg.in/src-d/proteus.v1/protobuf", "TypeSet"), "contains protobuf.TypeSet")
assert.True(t, ts.Contains("gopkg.in/src-d/proteus.v1/resolver", "Resolver"), "contains resolver.Resolver")

assert.False(t, ts.Contains("github.com/src-d/proteus/protobuf", "NotType"), "does not contain protobuf.NotType")
assert.False(t, ts.Contains("github.com/src-d/proteus/resolver", "NotType"), "does not contain resolver.NotType")
assert.False(t, ts.Contains("github.com/src-d/proteus/notpackage", "NotType"), "does not contain notpackage.NotType")
assert.False(t, ts.Contains("gopkg.in/src-d/proteus.v1/protobuf", "NotType"), "does not contain protobuf.NotType")
assert.False(t, ts.Contains("gopkg.in/src-d/proteus.v1/resolver", "NotType"), "does not contain resolver.NotType")
assert.False(t, ts.Contains("gopkg.in/src-d/proteus.v1/notpackage", "NotType"), "does not contain notpackage.NotType")
}
4 changes: 2 additions & 2 deletions resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package resolver
import (
"fmt"

"github.com/src-d/proteus/report"
"github.com/src-d/proteus/scanner"
"gopkg.in/src-d/proteus.v1/report"
"gopkg.in/src-d/proteus.v1/scanner"
)

// Resolver has the responsibility of checking the types of all the packages
Expand Down
6 changes: 3 additions & 3 deletions resolver/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
"strings"
"testing"

"github.com/src-d/proteus/report"
"github.com/src-d/proteus/scanner"
"gopkg.in/src-d/proteus.v1/report"
"gopkg.in/src-d/proteus.v1/scanner"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)

const project = "github.com/src-d/proteus"
const project = "gopkg.in/src-d/proteus.v1"

func TestPackagesEnums(t *testing.T) {
packages := []*scanner.Package{
Expand Down
2 changes: 1 addition & 1 deletion rpc/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"go/types"
"strings"

"github.com/src-d/proteus/protobuf"
"gopkg.in/src-d/proteus.v1/protobuf"
)

type context struct {
Expand Down
4 changes: 2 additions & 2 deletions rpc/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import (
"fmt"
"testing"

"github.com/src-d/proteus/protobuf"
"gopkg.in/src-d/proteus.v1/protobuf"
"github.com/stretchr/testify/assert"

"gopkg.in/src-d/go-parse-utils.v1"
)

func TestContext_isNameDefined(t *testing.T) {
pkg, err := parseutil.NewImporter().Import("github.com/src-d/proteus/fixtures")
pkg, err := parseutil.NewImporter().Import("gopkg.in/src-d/proteus.v1/fixtures")
if err != nil {
assert.Fail(t, fmt.Sprintf("could not import project fixtures: %v", err))
}
Expand Down
4 changes: 2 additions & 2 deletions rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"path/filepath"
"strings"

"github.com/src-d/proteus/protobuf"
"github.com/src-d/proteus/report"
"gopkg.in/src-d/proteus.v1/protobuf"
"gopkg.in/src-d/proteus.v1/report"

"gopkg.in/src-d/go-parse-utils.v1"
)
Expand Down
10 changes: 5 additions & 5 deletions rpc/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"path/filepath"
"testing"

"github.com/src-d/proteus/protobuf"
"github.com/src-d/proteus/resolver"
"github.com/src-d/proteus/scanner"
"gopkg.in/src-d/proteus.v1/protobuf"
"gopkg.in/src-d/proteus.v1/resolver"
"gopkg.in/src-d/proteus.v1/scanner"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
Expand Down Expand Up @@ -311,7 +311,7 @@ func (s *subpkgServiceServer) Point_GeneratedMethodOnPointer(ctx context.Context
`

func (s *RPCSuite) TestGenerate() {
pkg := "github.com/src-d/proteus/fixtures/subpkg"
pkg := "gopkg.in/src-d/proteus.v1/fixtures/subpkg"
scanner, err := scanner.New(pkg)
s.Nil(err)

Expand Down Expand Up @@ -404,5 +404,5 @@ func TestRPCSuite(t *testing.T) {
}

func projectPath(path string) string {
return filepath.Join(os.Getenv("GOPATH"), "src", "github.com/src-d/proteus", path)
return filepath.Join(os.Getenv("GOPATH"), "src", "gopkg.in/src-d/proteus.v1", path)
}
4 changes: 2 additions & 2 deletions scanner/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
)

var goSrc = filepath.Join(os.Getenv("GOPATH"), "src")
var projectDir = filepath.Join(goSrc, "github.com/src-d/proteus")
var projectDir = filepath.Join(goSrc, "gopkg.in/src-d/proteus.v1")

func TestNewContext_error(t *testing.T) {
createDirWithMultipleFiles("erroring")
defer removeDir("erroring")
_, err := newContext("github.com/src-d/proteus/fixtures/erroring/multiple")
_, err := newContext("gopkg.in/src-d/proteus.v1/fixtures/erroring/multiple")
assert.NotNil(t, err)
}

Expand Down
2 changes: 1 addition & 1 deletion scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"
"sync"

"github.com/src-d/proteus/report"
"gopkg.in/src-d/proteus.v1/report"

"gopkg.in/src-d/go-parse-utils.v1"
)
Expand Down
2 changes: 1 addition & 1 deletion scanner/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

var gopath = os.Getenv("GOPATH")

const project = "github.com/src-d/proteus"
const project = "gopkg.in/src-d/proteus.v1"

func projectPath(pkg string) string {
return filepath.Join(gopath, "src", project, pkg)
Expand Down

0 comments on commit ff715db

Please sign in to comment.