fix: refactor to use identity and different model mapping
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 5s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 22m50s
CI Workflow / CI (pull_request) Failing after 27m13s
CI Workflow / Code coverage report (pull_request) Has been skipped
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 5s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 22m50s
CI Workflow / CI (pull_request) Failing after 27m13s
CI Workflow / Code coverage report (pull_request) Has been skipped
This commit is contained in:
parent
762c39fbbd
commit
8d7323bbc1
9 changed files with 191 additions and 212 deletions
|
|
@ -75,14 +75,14 @@ func (b *Builder) Build() error {
|
|||
slog.Info("Creating generator dir", "dir", fmt.Sprintf("%s/%s", *root, GEN_REPO_NAME))
|
||||
genDir := path.Join(*root, GEN_REPO_NAME)
|
||||
if !b.SkipClone {
|
||||
err = createGeneratorDir(GEN_REPO, genDir)
|
||||
err = createGeneratorDir(GEN_REPO, genDir, b.SkipClone)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
slog.Info("Creating oas dir", "dir", fmt.Sprintf("%s/%s", *root, OAS_REPO_NAME))
|
||||
repoDir, err := createRepoDir(genDir, OAS_REPO, OAS_REPO_NAME, !b.SkipClone)
|
||||
slog.Info("Creating oas repo dir", "dir", fmt.Sprintf("%s/%s", *root, OAS_REPO_NAME))
|
||||
repoDir, err := createRepoDir(genDir, OAS_REPO, OAS_REPO_NAME, b.SkipClone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s", err.Error())
|
||||
}
|
||||
|
|
@ -128,14 +128,6 @@ func (b *Builder) Build() error {
|
|||
}
|
||||
}
|
||||
|
||||
if !b.SkipCleanup {
|
||||
slog.Info("Cleaning up", "dir", repoDir)
|
||||
err = os.RemoveAll(filepath.Dir(repoDir))
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
slog.Info("Changing dir", "dir", genDir)
|
||||
err = os.Chdir(genDir)
|
||||
if err != nil {
|
||||
|
|
@ -249,6 +241,12 @@ func (b *Builder) Build() error {
|
|||
slog.Error("RemoveAll", "dir", path.Join(*root, GEN_REPO_NAME), "err", err)
|
||||
return err
|
||||
}
|
||||
|
||||
slog.Info("Cleaning up", "dir", repoDir)
|
||||
err = os.RemoveAll(filepath.Dir(repoDir))
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
slog.Info("Done")
|
||||
|
|
@ -738,9 +736,9 @@ func handleVersion(service string, match []string) (*string, *version, error) {
|
|||
return &resStr, &version{verString: verString, major: majVer, minor: minVer}, nil
|
||||
}
|
||||
|
||||
func createRepoDir(root, repoUrl, repoName string, doClone bool) (string, error) {
|
||||
func createRepoDir(root, repoUrl, repoName string, skipClone bool) (string, error) {
|
||||
targetDir := path.Join(root, repoName)
|
||||
if doClone {
|
||||
if !skipClone {
|
||||
if fileExists(targetDir) {
|
||||
slog.Warn("target dir exists - skipping", "targetDir", targetDir)
|
||||
return targetDir, nil
|
||||
|
|
@ -756,8 +754,14 @@ func createRepoDir(root, repoUrl, repoName string, doClone bool) (string, error)
|
|||
return targetDir, nil
|
||||
}
|
||||
|
||||
func createGeneratorDir(repoUrl, targetDir string) error {
|
||||
if !fileExists(targetDir) {
|
||||
func createGeneratorDir(repoUrl, targetDir string, skipClone bool) error {
|
||||
if !skipClone {
|
||||
if fileExists(targetDir) {
|
||||
remErr := os.RemoveAll(targetDir)
|
||||
if remErr != nil {
|
||||
return remErr
|
||||
}
|
||||
}
|
||||
_, cloneErr := git.Clone(
|
||||
clone.Repository(repoUrl),
|
||||
clone.Directory(targetDir),
|
||||
|
|
|
|||
|
|
@ -14,9 +14,6 @@ func main() {
|
|||
slog.SetDefault(slog.New(slogcolor.NewHandler(os.Stderr, slogcolor.DefaultOptions)))
|
||||
|
||||
rootCmd := cmd.NewRootCmd()
|
||||
//rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)")
|
||||
//rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "author name for copyright attribution")
|
||||
//rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "name of license for the project")
|
||||
|
||||
cc.Init(&cc.Config{
|
||||
RootCmd: rootCmd,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue