-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to create remote repository before first push
fix lint
- Loading branch information
Showing
11 changed files
with
481 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2024 tsuru authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package fake | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
) | ||
|
||
type FakeRepository struct { | ||
CreatedRepos map[string]bool | ||
RepoExists map[string]bool | ||
AuthSuccess bool | ||
} | ||
|
||
func (f *FakeRepository) Auth(ctx context.Context) error { | ||
if f.AuthSuccess { | ||
return nil | ||
} | ||
return errors.New("auth repository failed") | ||
} | ||
|
||
func (f *FakeRepository) Create(ctx context.Context, name string) error { | ||
if _, exists := f.RepoExists[name]; exists { | ||
return errors.New("repository already exists") | ||
} | ||
if f.CreatedRepos == nil { | ||
f.CreatedRepos = make(map[string]bool) | ||
} | ||
if f.RepoExists == nil { | ||
f.RepoExists = make(map[string]bool) | ||
} | ||
f.CreatedRepos[name] = true | ||
f.RepoExists[name] = true | ||
return nil | ||
} | ||
|
||
func (f *FakeRepository) Exists(ctx context.Context, name string) (bool, error) { | ||
if f.RepoExists == nil { | ||
f.RepoExists = make(map[string]bool) | ||
} | ||
exists := f.RepoExists[name] | ||
return exists, nil | ||
} |
Oops, something went wrong.