Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMMIT0-57 api for generating project #68

Merged
merged 10 commits into from Nov 9, 2019
Merged

Conversation

liang-lillian
Copy link
Contributor

No description provided.

@liang-lillian liang-lillian force-pushed the COMMIT0-57-api branch 2 times, most recently from 84cb805 to 51a3d15 Compare November 7, 2019 22:19
case "POST":
decoder := json.NewDecoder(req.Body)
var projectConfig ProjectConfiguration
err := decoder.Decode(&projectConfig)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to add validation for post request

templates := packr.New("templates", "../templates")
t := templator.NewTemplator(templates)

err := os.Chdir(projectConfig.ProjectName) //cd into project
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cd into project
(could pass in project name to add to file path for each generate function)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you shouldn't need to chdir..


## Usage
- To run:
`go run internal/api/generate_api.go internal/api/create_project.go`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this to an argument to the binary. commit0 walkthrough or commit0 ui or something

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do I do this? @bmonkman --ty!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you would create a new file like cmd/ui.go which adds a new command

"sync"
)

func GenerateArtifactsHelper(t *templator.Templator, cfg *config.Commit0Config) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shared func for both cmd / api generate

if (err != nil) {
panic(err)
}
cfg := config.LoadConfig(util.ApiGeneratedYamlName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just keep calling this commit0.yaml?

@@ -56,6 +57,7 @@ func NewTemplator(box *packr.Box) *Templator {
ProtoHealthTemplate: NewSingleFileTemplator(box, "proto/health_proto.tmpl"),
ProtoServiceTemplate: NewSingleFileTemplator(box, "proto/service_proto.tmpl"),
Go: NewGoTemplator(box),
ApiCommit0: NewSingleFileTemplator(box, "commit0/api_generated.tmpl"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output of the ui process should just be a regular commit0.yaml using the same template

@liang-lillian liang-lillian merged commit ab8d5d2 into master Nov 9, 2019
@liang-lillian liang-lillian deleted the COMMIT0-57-api branch November 9, 2019 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants