Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

Update Open-API. #68

Merged
merged 1 commit into from
Jan 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ netlifyctl
*.tar.gz
builds
releases
_vendor*
2 changes: 1 addition & 1 deletion commands/init/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions commands/init/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 4 additions & 4 deletions commands/init/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion commands/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions commands/init/manual.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 12 additions & 3 deletions glide.lock

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

6 changes: 5 additions & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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