generated from origadmin/.github
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(repo): implement repository handling and file copying functions
- Add Repository struct to handle git repository operations - Implement CopyDir function to copy files and directories- Add functionality to clone and update git repositories - Include tests for repository operations and file copying - Update go.mod with new dependencies
- Loading branch information
Showing
12 changed files
with
984 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
GOPATH:=$(shell go env GOPATH) | ||
VERSION=$(shell git describe --tags --always) | ||
INTERNAL_PROTO_FILES=$(shell find internal -name *.proto) | ||
API_PROTO_FILES=$(shell find example/helloworld -name *.proto) | ||
KRATOS_VERSION=$(shell go mod graph |grep go-kratos/kratos/v2 |head -n 1 |awk -F '@' '{print $$2}') | ||
KRATOS=$(GOPATH)/pkg/mod/github.com/go-kratos/kratos/v2@$(KRATOS_VERSION) | ||
|
||
.PHONY: init | ||
# init env | ||
init: | ||
go get -u github.com/go-kratos/kratos/cmd/kratos/v2 | ||
go get -u google.golang.org/protobuf/cmd/protoc-gen-go | ||
go get -u google.golang.org/grpc/cmd/protoc-gen-go-grpc | ||
go get -u github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2 | ||
go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 | ||
go get -u github.com/google/wire/cmd/wire | ||
|
||
.PHONY: grpc | ||
# generate grpc code | ||
grpc: | ||
protoc --proto_path=. \ | ||
--proto_path=./example/third_party \ | ||
--go_out=paths=source_relative:. \ | ||
--go-grpc_out=paths=source_relative:. \ | ||
$(API_PROTO_FILES) | ||
|
||
.PHONY: http | ||
# generate http code | ||
http: | ||
protoc --proto_path=. \ | ||
--proto_path=./example/third_party \ | ||
--go_out=paths=source_relative:. \ | ||
--go-http_out=paths=source_relative:. \ | ||
$(API_PROTO_FILES) | ||
|
||
.PHONY: gin | ||
# generate gin code | ||
gin: | ||
protoc --proto_path=. --proto_path=./example/third_party --go_out=paths=source_relative:. --go-gin_out=paths=source_relative:. ./example/helloworld/helloworld.proto | ||
|
||
.PHONY: errors | ||
# generate errors code | ||
errors: | ||
protoc --proto_path=. \ | ||
--proto_path=$(KRATOS)/third_party \ | ||
--go_out=paths=source_relative:. \ | ||
--go-errors_out=paths=source_relative:. \ | ||
$(API_PROTO_FILES) | ||
|
||
.PHONY: proto | ||
# generate internal proto | ||
proto: | ||
protoc --proto_path=. \ | ||
--proto_path=./example/third_party \ | ||
--go_out=paths=source_relative:. \ | ||
./example/helloworld/helloworld.proto | ||
|
||
.PHONY: swagger | ||
# generate swagger file | ||
swagger: | ||
protoc --proto_path=. \ | ||
--proto_path=./example/third_party \ | ||
--openapiv2_out . \ | ||
--openapiv2_opt logtostderr=true \ | ||
$(API_PROTO_FILES) | ||
|
||
.PHONY: generate | ||
# generate client code | ||
generate: | ||
go generate ./... | ||
|
||
.PHONY: build | ||
# build | ||
build: | ||
mkdir -p bin/ && go build -ldflags "-X main.Version=$(VERSION)" -o ./bin/ ./... | ||
|
||
.PHONY: test | ||
# test | ||
test: | ||
go test -v ./... -cover | ||
|
||
.PHONY: all | ||
# generate all | ||
all: | ||
make generate; | ||
make grpc; | ||
make http; | ||
make proto; | ||
make errors; | ||
make swagger; | ||
make build; | ||
make test; | ||
|
||
# show help | ||
help: | ||
@echo '' | ||
@echo 'Usage:' | ||
@echo ' make [target]' | ||
@echo '' | ||
@echo 'Targets:' | ||
@awk '/^[a-zA-Z\-\_0-9]+:/ { \ | ||
helpMessage = match(lastLine, /^# (.*)/); \ | ||
if (helpMessage) { \ | ||
helpCommand = substr($$1, 0, index($$1, ":")-1); \ | ||
helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \ | ||
printf "\033[36m%-22s\033[0m %s\n", helpCommand,helpMessage; \ | ||
} \ | ||
} \ | ||
{ lastLine = $$0 }' $(MAKEFILE_LIST) | ||
|
||
.DEFAULT_GOAL := help |
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,17 @@ | ||
package config | ||
|
||
const ( | ||
Project = "origen" | ||
PackageName = "application" | ||
WebSite = `https://origadmin.com` | ||
) | ||
|
||
// UI generated by https://patorjk.com/software/taag/#p=display&f=Graffiti&t=Origen | ||
const UI = ` | ||
________ .__ | ||
\_____ \_______|__| ____ ____ ____ | ||
/ | \_ __ \ |/ ___\_/ __ \ / \ | ||
/ | \ | \/ / /_/ > ___/| | \ | ||
\_______ /__| |__\___ / \___ >___| / | ||
\/ /_____/ \/ \/ | ||
` |
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 |
---|---|---|
@@ -1,25 +1,54 @@ | ||
module github.com/origadmin/origen | ||
|
||
go 1.22.5 | ||
|
||
toolchain go1.22.6 | ||
go 1.23.1 | ||
|
||
require ( | ||
github.com/caarlos0/go-version v0.1.1 | ||
github.com/origadmin/toolkits/codec v0.0.4 | ||
github.com/go-git/go-git v4.7.0+incompatible | ||
github.com/go-git/go-git/v5 v5.12.0 | ||
github.com/origadmin/toolkits v0.0.42 | ||
github.com/origadmin/toolkits/codec v0.0.8 | ||
github.com/spf13/cobra v1.8.1 | ||
) | ||
|
||
require ( | ||
dario.cat/mergo v1.0.0 // indirect | ||
github.com/BurntSushi/toml v1.4.0 // indirect | ||
github.com/Microsoft/go-winio v0.6.1 // indirect | ||
github.com/ProtonMail/go-crypto v1.0.0 // indirect | ||
github.com/bytedance/sonic v1.12.3 // indirect | ||
github.com/bytedance/sonic/loader v0.2.0 // indirect | ||
github.com/cloudflare/circl v1.3.7 // indirect | ||
github.com/cloudwego/base64x v0.1.4 // indirect | ||
github.com/cloudwego/iasm v0.2.0 // indirect | ||
github.com/cyphar/filepath-securejoin v0.2.4 // indirect | ||
github.com/emirpasic/gods v1.18.1 // indirect | ||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect | ||
github.com/go-git/go-billy/v5 v5.5.0 // indirect | ||
github.com/goexts/ggb v0.0.7 // indirect | ||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect | ||
github.com/hashicorp/errwrap v1.1.0 // indirect | ||
github.com/hashicorp/go-multierror v1.1.1 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/kevinburke/ssh_config v1.2.0 // indirect | ||
github.com/klauspost/cpuid/v2 v2.2.8 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/origadmin/toolkits v0.0.37 // indirect | ||
github.com/pjbgf/sha1cd v0.3.0 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect | ||
github.com/skeema/knownhosts v1.2.2 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect | ||
github.com/xanzy/ssh-agent v0.3.3 // indirect | ||
golang.org/x/arch v0.10.0 // indirect | ||
golang.org/x/crypto v0.27.0 // indirect | ||
golang.org/x/mod v0.12.0 // indirect | ||
golang.org/x/net v0.22.0 // indirect | ||
golang.org/x/sys v0.25.0 // indirect | ||
golang.org/x/tools v0.13.0 // indirect | ||
gopkg.in/warnings.v0 v0.1.2 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Oops, something went wrong.