Skip to content

Commit 4425228

Browse files
author
john
committed
merged from release-1.6
2 parents 2f0b954 + 1433301 commit 4425228

File tree

234 files changed

+3754
-2138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

234 files changed

+3754
-2138
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: go
22

33
go:
4-
- "1.11.x"
4+
- "1.16.x"
55

66
git:
77
depth: 1
@@ -11,15 +11,15 @@ branches:
1111
- master
1212
- v2
1313

14-
go_import_path: hidevops.io/hiboot
14+
go_import_path: github.com/hidevopsio/hiboot
1515

1616
env:
1717
- GO111MODULE=on APP_PROFILES_ACTIVE=local GOPROXY=https://goproxy.cn
1818

1919
install: true
2020

2121
script:
22-
- env GO111MODULE=on go test -v ./... -coverprofile=coverage.out -covermode=atomic
22+
- env GO111MODULE=on go test -p 1 -v ./... -coverprofile=coverage.out -covermode=atomic
2323

2424
after_success:
2525
- bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN}

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Below, we outline one of the more common Git workflows that core developers use.
2828

2929
### Fork the main repository
3030

31-
* Go to https://hidevops.io/hiboot
31+
* Go to https://github.com/hidevopsio/hiboot
3232
* Click the "Fork" button (at the top right)
3333

3434
### Clone your fork
@@ -41,7 +41,7 @@ mkdir -p $GOPATH/src/hidevops.io
4141
cd $GOPATH/src/hidevops.io
4242
git clone https://github.com/$GITHUB_USER/hiboot
4343
cd hiboot
44-
git remote add upstream 'https://hidevops.io/hiboot'
44+
git remote add upstream 'https://github.com/hidevopsio/hiboot'
4545
git config --global --add http.followRedirects 1
4646
```
4747

@@ -59,4 +59,4 @@ git fetch upstream
5959
git rebase upstream/master
6060
```
6161

62-
Note: If you have write access to the main repositories (e.g. hidevops.io/hiboot), you should modify your Git configuration so that you can't accidentally push to upstream:
62+
Note: If you have write access to the main repositories (e.g. github.com/hidevopsio/hiboot), you should modify your Git configuration so that you can't accidentally push to upstream:

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Hiboot - web/cli application framework
1+
# Hiboot - web/cli application framework
22

33
<p align="center">
44
<a href="https://hiboot.hidevops.io">
@@ -10,7 +10,7 @@
1010
<a href="https://travis-ci.org/hidevopsio/hiboot?branch=master">
1111
<img src="https://travis-ci.org/hidevopsio/hiboot.svg?branch=master" alt="Build Status"/>
1212
</a>
13-
<a class="badge-align" href="https://www.codacy.com/app/john-deng/hiboot?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=hidevopsio/hiboot&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/ee8ddbf56ece4f46a6efeb216c351a0f"/></a>
13+
<a class="badge-align" href="https://www.codacy.com/app/john-deng/hiboot?utm_source=github.com&utm_medium=referral&utm_content=hidevopsio/hiboot&utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/ee8ddbf56ece4f46a6efeb216c351a0f"/></a>
1414
<a href="https://github.com/hidevopsio/hiboot">
1515
<img src="https://tokei.rs/b1/github/hidevopsio/hiboot" />
1616
</a>
@@ -20,10 +20,10 @@
2020
<a href="https://opensource.org/licenses/Apache-2.0">
2121
<img src="https://img.shields.io/badge/License-Apache%202.0-green.svg" />
2222
</a>
23-
<a href="https://goreportcard.com/report/hidevops.io/hiboot">
24-
<img src="https://goreportcard.com/badge/hidevops.io/hiboot" />
23+
<a href="https://goreportcard.com/report/github.com/hidevopsio/hiboot">
24+
<img src="https://goreportcard.com/badge/github.com/hidevopsio/hiboot" />
2525
</a>
26-
<a href="https://godoc.org/hidevops.io/hiboot">
26+
<a href="https://godoc.org/github.com/hidevopsio/hiboot">
2727
<img src="https://godoc.org/github.com/golang/gddo?status.svg" />
2828
</a>
2929
</p>
@@ -56,3 +56,8 @@ Thank you for considering contributing to the Hiboot framework, The contribution
5656
© John Deng, 2017 ~ time.Now
5757

5858
Released under the [Apache License 2.0](https://hidevops.io/hiboot/blob/master/LICENSE)
59+
=====================================
60+
61+
Released under the [Apache License 2.0](https://github.com/hidevopsio/hiboot/blob/master/LICENSE)
62+
63+
[Jetbrains](https://www.jetbrains.com/?from=hiboot) supports this project with GoLand licenses. We appreciate their support for free and open source software!

doc.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Hiboot is a cloud native web and cli application framework written in Go.
1919
Hiboot integrates the popular libraries but make them simpler, easier to use.
2020
It borrowed some of the Spring features like dependency injection, aspect oriented programming, and auto configuration.
2121
You can integrate any other libraries easily by auto configuration with dependency injection support. hiboot-data is the
22-
typical project that implement customized hiboot starters. see https://godoc.org/hidevops.io/hiboot-data
22+
typical project that implement customized hiboot starters. see https://godoc.org/github.com/hidevopsio/hiboot-data
2323
2424
Overview
2525
@@ -153,8 +153,8 @@ Getting started with Hiboot web application
153153
154154
Get the source code
155155
156-
go get -u hidevops.io/hiboot
157-
cd $GOPATH/src/hidevops.io/hiboot/examples/web/helloworld/
156+
go get -u github.com/hidevopsio/hiboot
157+
cd $GOPATH/src/github.com/hidevopsio/hiboot/examples/web/helloworld/
158158
159159
Source Code
160160

doc_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
package hiboot_test
1616

1717
import (
18-
"hidevops.io/hiboot/pkg/app/web"
19-
"hidevops.io/hiboot/pkg/at"
18+
"github.com/hidevopsio/hiboot/pkg/app/web"
19+
"github.com/hidevopsio/hiboot/pkg/at"
2020
)
2121

2222
// This is a simple hello world example

examples/cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package main
1010

1111
// import cli starter and fmt
1212
import (
13-
"hidevops.io/hiboot/pkg/starter/cli"
13+
"github.com/hidevopsio/hiboot/pkg/starter/cli"
1414
"github.com/manifoldco/promptui"
1515
"fmt"
1616
)

examples/cli/advanced/cmd/bar.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
package cmd
1616

1717
import (
18-
"hidevops.io/hiboot/pkg/app"
19-
"hidevops.io/hiboot/pkg/app/cli"
20-
"hidevops.io/hiboot/pkg/log"
18+
"github.com/hidevopsio/hiboot/pkg/app"
19+
"github.com/hidevopsio/hiboot/pkg/app/cli"
20+
"github.com/hidevopsio/hiboot/pkg/log"
2121
)
2222

2323
type barCommand struct {

examples/cli/advanced/cmd/foo.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
package cmd
1616

1717
import (
18-
"hidevops.io/hiboot/examples/cli/advanced/model"
19-
"hidevops.io/hiboot/pkg/app"
20-
"hidevops.io/hiboot/pkg/app/cli"
21-
"hidevops.io/hiboot/pkg/log"
18+
"github.com/hidevopsio/hiboot/examples/cli/advanced/model"
19+
"github.com/hidevopsio/hiboot/pkg/app"
20+
"github.com/hidevopsio/hiboot/pkg/app/cli"
21+
"github.com/hidevopsio/hiboot/pkg/log"
2222
)
2323

2424
type fooCommand struct {

examples/cli/advanced/cmd/root.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
package cmd
1616

1717
import (
18-
"hidevops.io/hiboot/pkg/app/cli"
19-
"hidevops.io/hiboot/pkg/log"
18+
"github.com/hidevopsio/hiboot/pkg/app/cli"
19+
"github.com/hidevopsio/hiboot/pkg/log"
2020
)
2121

2222
// RootCommand is the root command
@@ -25,6 +25,8 @@ type RootCommand struct {
2525

2626
profile string
2727
timeout int
28+
29+
MagicNumber int `value:"${magic.number}"`
2830
}
2931

3032
// NewRootCommand the root command
@@ -43,6 +45,7 @@ func NewRootCommand(second *secondCommand) *RootCommand {
4345

4446
// Run root command handler
4547
func (c *RootCommand) Run(args []string) error {
46-
log.Infof("handle first command: profile=%v, timeout=%v", c.profile, c.timeout)
48+
log.Debugf("root: %v", args)
49+
log.Infof("handle first command: profile=%v, timeout=%v, magic.number=%v", c.profile, c.timeout, c.MagicNumber)
4750
return nil
4851
}

examples/cli/advanced/cmd/root_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ package cmd
1616

1717
import (
1818
"github.com/stretchr/testify/assert"
19-
_ "hidevops.io/hiboot/examples/cli/advanced/config"
20-
"hidevops.io/hiboot/pkg/app/cli"
19+
_ "github.com/hidevopsio/hiboot/examples/cli/advanced/config"
20+
"github.com/hidevopsio/hiboot/pkg/app/cli"
21+
"sync"
2122
"testing"
2223
)
2324

25+
var mu sync.Mutex
2426
func TestRootCommands(t *testing.T) {
27+
mu.Lock()
2528
testApp := cli.NewTestApplication(t, NewRootCommand)
2629

2730
t.Run("should run first command", func(t *testing.T) {
@@ -59,4 +62,5 @@ func TestRootCommands(t *testing.T) {
5962
assert.NotEqual(t, nil, err)
6063
assert.Contains(t, err.Error(), "unknown command")
6164
})
65+
mu.Unlock()
6266
}

examples/cli/advanced/cmd/second.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
package cmd
1616

1717
import (
18-
"hidevops.io/hiboot/pkg/app"
19-
"hidevops.io/hiboot/pkg/app/cli"
20-
"hidevops.io/hiboot/pkg/log"
18+
"github.com/hidevopsio/hiboot/pkg/app"
19+
"github.com/hidevopsio/hiboot/pkg/app/cli"
20+
"github.com/hidevopsio/hiboot/pkg/log"
2121
)
2222

2323
type secondCommand struct {

examples/cli/advanced/config/autoconfigure.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package config
22

33
import (
4-
"hidevops.io/hiboot/examples/cli/advanced/model"
5-
"hidevops.io/hiboot/pkg/app"
4+
"github.com/hidevopsio/hiboot/examples/cli/advanced/model"
5+
"github.com/hidevopsio/hiboot/pkg/app"
66
)
77

88
// Profile is the configuration name
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# config file for testing
2+
3+
4+
logging:
5+
level: debug
6+
7+
magic:
8+
number: 999
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# config file for testing
2+
3+
4+
logging:
5+
level: error
6+
7+
magic:
8+
number: 888
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# config file for testing
2+
# filename should be application.yml
3+
4+
app:
5+
project: hidevopsio
6+
name: hiboot-cmd
7+
profiles:
8+
include:
9+
- foo
10+
11+
logging:
12+
level: info
13+
14+
magic:
15+
number: 666
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# config file for testing
2+
3+
4+
logging:
5+
level: debug
6+
7+
magic:
8+
number: 999

examples/cli/advanced/main.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,23 @@
1515
package main
1616

1717
import (
18-
"hidevops.io/hiboot/examples/cli/advanced/cmd"
19-
"hidevops.io/hiboot/examples/cli/advanced/config"
20-
"hidevops.io/hiboot/pkg/app"
21-
"hidevops.io/hiboot/pkg/app/cli"
22-
"hidevops.io/hiboot/pkg/starter/logging"
18+
"embed"
19+
20+
"github.com/hidevopsio/hiboot/examples/cli/advanced/cmd"
21+
"github.com/hidevopsio/hiboot/examples/cli/advanced/config"
22+
"github.com/hidevopsio/hiboot/pkg/app"
23+
"github.com/hidevopsio/hiboot/pkg/app/cli"
24+
"github.com/hidevopsio/hiboot/pkg/starter/logging"
2325
)
2426

27+
//go:embed config/foo
28+
var embedFS embed.FS
29+
2530
func main() {
2631
// create new cli application and run it
2732
cli.NewApplication(cmd.NewRootCommand).
28-
SetProperty(logging.Level, logging.LevelWarn).
29-
SetProperty(app.ProfilesInclude, config.Profile).
33+
SetProperty(app.Config, &embedFS).
34+
SetProperty(logging.Level, logging.LevelError).
35+
SetProperty(app.ProfilesInclude, config.Profile, logging.Profile).
3036
Run()
3137
}

examples/cli/advanced/main_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
package main
1717

1818
import (
19+
"sync"
1920
"testing"
20-
"time"
2121
)
2222

23+
var mu sync.Mutex
24+
2325
func TestRunMain(t *testing.T) {
26+
mu.Lock()
2427
go main()
25-
time.Sleep(200 * time.Millisecond)
28+
mu.Unlock()
2629
}

examples/cli/crypto/cmd/crypto.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ package cmd
1616

1717
import (
1818
"fmt"
19-
"hidevops.io/hiboot/pkg/app"
20-
"hidevops.io/hiboot/pkg/app/cli"
21-
"hidevops.io/hiboot/pkg/utils/crypto/rsa"
19+
"github.com/hidevopsio/hiboot/pkg/app"
20+
"github.com/hidevopsio/hiboot/pkg/app/cli"
21+
"github.com/hidevopsio/hiboot/pkg/utils/crypto/rsa"
2222
)
2323

2424
// define the command

examples/cli/crypto/cmd/crypto_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ package cmd
1616

1717
import (
1818
"github.com/stretchr/testify/assert"
19-
"hidevops.io/hiboot/pkg/app/cli"
20-
"hidevops.io/hiboot/pkg/log"
19+
"github.com/hidevopsio/hiboot/pkg/app/cli"
20+
"github.com/hidevopsio/hiboot/pkg/log"
2121
"testing"
2222
)
2323

examples/cli/crypto/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ package main
1818

1919
// import cli starter and fmt
2020
import (
21-
_ "hidevops.io/hiboot/examples/cli/crypto/cmd"
22-
"hidevops.io/hiboot/pkg/app/cli"
21+
_ "github.com/hidevopsio/hiboot/examples/cli/crypto/cmd"
22+
"github.com/hidevopsio/hiboot/pkg/app/cli"
2323
)
2424

2525
// main function

examples/cli/crypto/main_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
package main
1717

1818
import (
19+
"sync"
1920
"testing"
20-
"time"
2121
)
2222

23+
var mu sync.Mutex
24+
2325
func TestRunMain(t *testing.T) {
26+
mu.Lock()
2427
go main()
25-
time.Sleep(200 * time.Millisecond)
28+
mu.Unlock()
2629
}

examples/cli/hello/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ package main
1919
// import cli starter and fmt
2020
import (
2121
"fmt"
22-
"hidevops.io/hiboot/pkg/app"
23-
"hidevops.io/hiboot/pkg/app/cli"
22+
"github.com/hidevopsio/hiboot/pkg/app"
23+
"github.com/hidevopsio/hiboot/pkg/app/cli"
2424
)
2525

2626
// define the command

0 commit comments

Comments
 (0)