This repository has been archived by the owner on Nov 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from christopherhein/chore/94-codegen
Adding Code Gen Into The Project Again
- Loading branch information
Showing
396 changed files
with
196,130 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/aws-service-operator-codegen |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,30 @@ | ||
# Gopkg.toml example | ||
# | ||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html | ||
# for detailed Gopkg.toml documentation. | ||
# | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project" | ||
# version = "1.0.0" | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project2" | ||
# branch = "dev" | ||
# source = "github.com/myfork/project2" | ||
# | ||
# [[override]] | ||
# name = "github.com/x/y" | ||
# version = "2.4.0" | ||
# | ||
# [prune] | ||
# non-go = false | ||
# go-tests = true | ||
# unused-packages = true | ||
|
||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true |
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,17 @@ | ||
commitSHA := $(shell git describe --dirty --always) | ||
dateStr := $(shell date +%s) | ||
|
||
.PHONY: build | ||
build: | ||
go build -ldflags "-X main.commit=$(commitSHA) -X main.date=$(dateStr)" ./cmd/aws-service-operator-codegen | ||
|
||
.PHONY: install-bindata | ||
install-bindata: | ||
go get -u github.com/jteeuwen/go-bindata/... | ||
|
||
.PHONY: update-bindata | ||
update-bindata: | ||
go generate ./pkg/codegen/ | ||
|
||
.PHONY: rebuild | ||
rebuild: update-bindata build |
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,29 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"github.com/spf13/cobra" | ||
"os" | ||
) | ||
|
||
var ( | ||
// rootCmd represents the base command when called without any subcommands | ||
rootCmd = &cobra.Command{ | ||
Use: "aws-operator-codegen", | ||
Short: "Processes AWS Operator Model files and outputs codegened operators", | ||
Long: `TODO WRITE THIS`, | ||
Run: func(c *cobra.Command, _ []string) { | ||
c.Help() | ||
}, | ||
} | ||
) | ||
|
||
func main() { | ||
if err := rootCmd.Execute(); err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func init() { | ||
} |
25 changes: 25 additions & 0 deletions
25
code-generation/cmd/aws-service-operator-codegen/process.go
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,25 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/christopherhein/aws-operator/code-generation/pkg/codegen" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var modelPath, rootPath string | ||
|
||
var processCmd = &cobra.Command{ | ||
Use: "process", | ||
Short: "Process the operator code based on the models files", | ||
Long: ``, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
generation := codegen.New(modelPath, rootPath) | ||
generation.Run() | ||
return | ||
}, | ||
} | ||
|
||
func init() { | ||
processCmd.Flags().StringVar(&modelPath, "model-path", "models/", "Model path used for regenerating the codebase") | ||
processCmd.Flags().StringVar(&rootPath, "root-path", "./", "Root path used for regenerating the codebase") | ||
rootCmd.AddCommand(processCmd) | ||
} |
36 changes: 36 additions & 0 deletions
36
code-generation/cmd/aws-service-operator-codegen/version.go
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,36 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
goVersion "github.com/christopherhein/go-version" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
shortened = false | ||
version = "dev" | ||
commit = "none" | ||
date = "unknown" | ||
versionCmd = &cobra.Command{ | ||
Use: "version", | ||
Short: "Version will output the current aws-operator build information", | ||
Long: ``, | ||
Run: func(_ *cobra.Command, _ []string) { | ||
var response string | ||
versionOutput := goVersion.New(version, commit, date) | ||
|
||
if shortened { | ||
response = versionOutput.ToShortened() | ||
} else { | ||
response = versionOutput.ToJSON() | ||
} | ||
fmt.Printf("%+v", response) | ||
return | ||
}, | ||
} | ||
) | ||
|
||
func init() { | ||
versionCmd.Flags().BoolVarP(&shortened, "short", "s", false, "Use shortened output for version information.") | ||
rootCmd.AddCommand(versionCmd) | ||
} |
Oops, something went wrong.