Skip to content

Commit

Permalink
Updates create logic to v2 (#3200)
Browse files Browse the repository at this point in the history
  • Loading branch information
mik-dass committed May 18, 2020
1 parent a559ce6 commit d054e0c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/odo/cli/component/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -770,29 +770,29 @@ func (co *CreateOptions) downloadProject(projectPassed string) error {
return err
}

var zipUrl string
switch project.Source.Type {
case "git":
if strings.Contains(project.Source.Location, "github.com") {
zipUrl, err = util.GetGitHubZipURL(project.Source.Location)
var url string
switch project.SourceType {
case common.GitProjectSourceType:
if strings.Contains(project.Git.Location, "github.com") {
url, err = util.GetGitHubZipURL(project.Git.Location)
if err != nil {
return err
}
} else {
return errors.Errorf("Project type git with non github url not supported")
}
case "github":
zipUrl, err = util.GetGitHubZipURL(project.Source.Location)
case common.GitHubProjectSourceType:
url, err = util.GetGitHubZipURL(project.Github.Location)
if err != nil {
return err
}
case "zip":
zipUrl = project.Source.Location
case common.ZipProjectSourceType:
url = project.Zip.Location
default:
return errors.Errorf("Project type not supported")
}

err = util.GetAndExtractZip(zipUrl, path)
err = util.GetAndExtractZip(url, path)
if err != nil {
return err
}
Expand Down

0 comments on commit d054e0c

Please sign in to comment.