diff --git a/.gitignore b/.gitignore index 1a2ccc5..be0ad44 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ netlifyctl *.tar.gz builds releases +_vendor* diff --git a/commands/init/git.go b/commands/init/git.go index 16be427..6345294 100644 --- a/commands/init/git.go +++ b/commands/init/git.go @@ -22,7 +22,7 @@ var gitSSHURL = regexp.MustCompile("\\w+@([^:]+):([^.]+)(\\.git)?") type configurator interface { SetupDeployKey(context.Context, *models.DeployKey) error SetupWebHook(context.Context, *models.Site) error - RepoInfo(ctx context.Context) (*models.RepoSetup, error) + RepoInfo(ctx context.Context) (*models.RepoInfo, error) } type gitRepo struct { diff --git a/commands/init/github.go b/commands/init/github.go index 0584ce3..32081eb 100644 --- a/commands/init/github.go +++ b/commands/init/github.go @@ -85,18 +85,18 @@ func (c *githubConfigurator) SetupWebHook(ctx context.Context, site *models.Site return nil } -func (c *githubConfigurator) RepoInfo(ctx context.Context) (*models.RepoSetup, error) { +func (c *githubConfigurator) RepoInfo(ctx context.Context) (*models.RepoInfo, error) { repo, _, err := c.client.Repositories.Get(ctx, c.owner, c.repo) if err != nil { return nil, err } branch := *repo.DefaultBranch - return &models.RepoSetup{ + return &models.RepoInfo{ ID: int64(*repo.ID), Provider: "github", - Repo: *repo.FullName, - Branch: branch, + RepoPath: *repo.FullName, + RepoBranch: branch, AllowedBranches: []string{branch}, }, nil } diff --git a/commands/init/gitlab.go b/commands/init/gitlab.go index e4050fc..d7835d5 100644 --- a/commands/init/gitlab.go +++ b/commands/init/gitlab.go @@ -63,18 +63,18 @@ func (c *gitlabConfigurator) SetupWebHook(ctx context.Context, site *models.Site return err } -func (c *gitlabConfigurator) RepoInfo(ctx context.Context) (*models.RepoSetup, error) { +func (c *gitlabConfigurator) RepoInfo(ctx context.Context) (*models.RepoInfo, error) { project, _, err := c.client.Projects.GetProject(c.repoPath) if err != nil { return nil, err } branch := project.DefaultBranch - return &models.RepoSetup{ + return &models.RepoInfo{ ID: int64(project.ID), Provider: "gitlab", - Repo: project.Path, - Branch: branch, + RepoPath: project.Path, + RepoBranch: branch, AllowedBranches: []string{branch}, }, nil } diff --git a/commands/init/init.go b/commands/init/init.go index 7330a79..69433a0 100644 --- a/commands/init/init.go +++ b/commands/init/init.go @@ -66,7 +66,7 @@ func initSite(ctx context.Context, cmd *cobra.Command, args []string) error { fmt.Println("\nConfiguration:\n") fmt.Printf(" Repository: %s\n", host.Remote) - fmt.Printf(" Production branch: %s\n", info.Branch) + fmt.Printf(" Production branch: %s\n", info.RepoBranch) fmt.Printf(" Publishing directory: %s\n", dir) fmt.Printf(" Build command: %s\n\n", buildCmd) diff --git a/commands/init/manual.go b/commands/init/manual.go index 8480d16..ffdf4e1 100644 --- a/commands/init/manual.go +++ b/commands/init/manual.go @@ -34,13 +34,13 @@ func (c manualConfigurator) SetupWebHook(ctx context.Context, site *models.Site) return nil } -func (c manualConfigurator) RepoInfo(ctx context.Context) (*models.RepoSetup, error) { +func (c manualConfigurator) RepoInfo(ctx context.Context) (*models.RepoInfo, error) { branch := c.gitProvider.CurrentBranch - return &models.RepoSetup{ + return &models.RepoInfo{ Provider: "manual", - Repo: c.gitProvider.Remote, - Branch: branch, + RepoPath: c.gitProvider.Remote, + RepoBranch: branch, AllowedBranches: []string{branch}, }, nil return nil, nil diff --git a/glide.lock b/glide.lock index a66bfa7..d0c55b9 100644 --- a/glide.lock +++ b/glide.lock @@ -1,14 +1,22 @@ -hash: 798d282a6e6c2b4b8309186f046c2c5936e19ca1c70ba5efe53a195bce1b23a2 -updated: 2017-11-19T13:58:21.229843232-08:00 +hash: 034e6c8bda138a116a8462c75cb70fb6f400cf44600c0353df3607f3f81aec01 +updated: 2018-01-02T12:07:32.005883604-08:00 imports: - name: github.com/asaskevich/govalidator version: ca5f9e638c83bac66bfac70ded5bded1503135a7 +- name: github.com/Azure/go-autorest + version: 809ed2ef5c4c9a60c3c2f3aa9cc11f3a7c2ce59d + subpackages: + - autorest + - autorest/adal + - autorest/date - name: github.com/briandowns/spinner version: 48dbb65d7bd5c74ab50d53d04c949f20e3d14944 - name: github.com/BurntSushi/toml version: bbd5bb678321a0d6e58f1099321dfa73391c1b6f - name: github.com/cenkalti/backoff version: 61ba96c4d1002f22e06acb8e34a7650611125a63 +- name: github.com/dgrijalva/jwt-go + version: d2709f9f1f31ebcda9651b03077758c1f3a0018c - name: github.com/fatih/color version: 5df930a27be2502f99b292b7cc09ebad4d0891f4 - name: github.com/fhs/go-netrc @@ -97,7 +105,7 @@ imports: - name: github.com/mitchellh/mapstructure version: db1efb556f84b25a0a13a04aad883943538ad2e0 - name: github.com/netlify/open-api - version: 13e84171f6e5bcb8663fb50ffa1e38a6f1b0b851 + version: 307bc9561f802719e125e91135ac5440b6fd1f6d vcs: git subpackages: - go/models @@ -105,6 +113,7 @@ imports: - go/plumbing/operations - go/porcelain - go/porcelain/context + - go/porcelain/http - name: github.com/octokit/go-octokit version: 812e91dfbd64051c1ec72c48feda0278727e8a4e subpackages: diff --git a/glide.yaml b/glide.yaml index 401e030..6438492 100644 --- a/glide.yaml +++ b/glide.yaml @@ -11,7 +11,7 @@ import: - client - package: github.com/go-openapi/strfmt - package: github.com/netlify/open-api - version: 13e84171f6e5bcb8663fb50ffa1e38a6f1b0b851 + version: 307bc9561f802719e125e91135ac5440b6fd1f6d vcs: git subpackages: - go/models @@ -30,3 +30,7 @@ import: - package: golang.org/x/sys version: 1e2299c37cc91a509f1b12369872d27be0ce98a6 - package: github.com/briandowns/spinner +- package: github.com/Azure/go-autorest + version: ~9.6.0 + subpackages: + - autorest