Skip to content

Commit c2c73a7

Browse files
Merge branch 'master' into kkumar-gcc/#726-auto-instrumentation
2 parents 621acba + eec12ad commit c2c73a7

13 files changed

Lines changed: 451 additions & 83 deletions

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ This project exists thanks to all the people who contribute, to participate in t
118118
<a href="https://github.com/zoryamba" target="_blank"><img src="https://github.com/u/21248500?v=4" width="48" height="48"></a>
119119
<a href="https://github.com/oguzhankrcb" target="_blank"><img src="https://github.com/u/7572058?v=4" width="48" height="48"></a>
120120
<a href="https://github.com/ChisThanh" target="_blank"><img src="https://github.com/u/93512710?v=4" width="48" height="48"></a>
121+
<a href="https://github.com/wyicwx" target="_blank"><img src="https://github.com/u/1241187?v=4" width="48" height="48"></a>
121122

122123
## Sponsor
123124

README_zh.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ err := facades.Queue().Job(&jobs.Test{}, []queue.Arg{}).Dispatch()
116116
<a href="https://github.com/zoryamba" target="_blank"><img src="https://github.com/u/21248500?v=4" width="48" height="48"></a>
117117
<a href="https://github.com/oguzhankrcb" target="_blank"><img src="https://github.com/u/7572058?v=4" width="48" height="48"></a>
118118
<a href="https://github.com/ChisThanh" target="_blank"><img src="https://github.com/u/93512710?v=4" width="48" height="48"></a>
119+
<a href="https://github.com/wyicwx" target="_blank"><img src="https://github.com/u/1241187?v=4" width="48" height="48"></a>
119120

120121
## 打赏
121122

console/service_provider.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,31 @@ func (r *ServiceProvider) registerCommands(app foundation.Application) {
5353
console.NewKeyGenerateCommand(configFacade),
5454
console.NewMakeCommand(),
5555
console.NewBuildCommand(configFacade),
56-
console.NewDeployCommand(configFacade, artisanFacade),
56+
// The deploy command is not completely ready yet, comment it out for now.
57+
// https://github.com/goravel/goravel/issues/778
58+
// https://github.com/goravel/goravel/issues/804
59+
// Add the configuration when the command is enabled.
60+
// "deploy": map[string]any{
61+
// "base_dir": config.Env("DEPLOY_BASE_DIR", "/var/www/"),
62+
// "ssh_ip": config.Env("DEPLOY_SSH_IP", "127.0.0.1"),
63+
// "reverse_proxy_port": config.Env("DEPLOY_REVERSE_PROXY_PORT", "9000"),
64+
// "ssh_port": config.Env("DEPLOY_SSH_PORT", "22"),
65+
// "ssh_user": config.Env("DEPLOY_SSH_USER", "root"),
66+
// "ssh_key_path": config.Env("DEPLOY_SSH_KEY_PATH", "~/.ssh/id_rsa"),
67+
// "prod_env_file_path": config.Env("DEPLOY_PROD_ENV_FILE_PATH", ".env.production"),
68+
// "domain": config.Env("DEPLOY_DOMAIN", ""),
69+
// "env_decrypt_key": config.Env("DEPLOY_ENV_DECRYPT_KEY", ""),
70+
// "reverse_proxy_enabled": config.Env("DEPLOY_REVERSE_PROXY_ENABLED", true),
71+
// "reverse_proxy_tls_enabled": config.Env("DEPLOY_REVERSE_PROXY_TLS_ENABLED", true),
72+
// "remote_env_decrypt": config.Env("DEPLOY_REMOTE_ENV_DECRYPT", false),
73+
// },
74+
75+
// "build": map[string]any{
76+
// "os": config.Env("DEPLOY_OS", "linux"),
77+
// "arch": config.Env("DEPLOY_ARCH", "amd64"),
78+
// "static": config.Env("DEPLOY_STATIC", true),
79+
// },
80+
// console.NewDeployCommand(configFacade, artisanFacade),
5781
console.NewHelpCommand(),
5882
})
5983
}

foundation/console/package_install_command.go

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,22 @@ func (r *PackageInstallCommand) Extend() command.Extend {
5959
Category: "package",
6060
Flags: []command.Flag{
6161
&command.BoolFlag{
62-
Name: "all-facades",
62+
Name: "all",
6363
Usage: "Install all facades",
6464
Aliases: []string{"a"},
6565
Value: false,
6666
},
67+
&command.BoolFlag{
68+
Name: "default",
69+
Usage: "Install facades with default drivers",
70+
Aliases: []string{"d"},
71+
Value: false,
72+
},
73+
&command.BoolFlag{
74+
Name: "dev",
75+
Usage: "Install drivers with the master branch",
76+
Value: false,
77+
},
6778
},
6879
}
6980
}
@@ -73,7 +84,7 @@ func (r *PackageInstallCommand) Handle(ctx console.Context) error {
7384
names := ctx.Arguments()
7485

7586
if len(names) == 0 {
76-
if ctx.OptionBool("all-facades") {
87+
if ctx.OptionBool("all") {
7788
names = getAvailableFacades(r.bindings)
7889
} else {
7990
var err error
@@ -160,6 +171,10 @@ func (r *PackageInstallCommand) inputThirdPackage(ctx console.Context) (string,
160171
}
161172

162173
func (r *PackageInstallCommand) installPackage(ctx console.Context, pkg string) error {
174+
if !strings.Contains(pkg, "@") && ctx.OptionBool("dev") {
175+
pkg += "@master"
176+
}
177+
163178
pkgPath, _, _ := strings.Cut(pkg, "@")
164179
setup := pkgPath + "/setup"
165180

@@ -169,7 +184,7 @@ func (r *PackageInstallCommand) installPackage(ctx console.Context, pkg string)
169184
}
170185

171186
// install package
172-
if err := supportconsole.ExecuteCommand(ctx, exec.Command("go", "run", setup, "install", "--package-name="+env.MainPath(), "--paths="+r.paths)); err != nil {
187+
if err := supportconsole.ExecuteCommand(ctx, exec.Command("go", "run", setup, "install", "--main-path="+env.MainPath(), "--paths="+r.paths)); err != nil {
173188
return fmt.Errorf("failed to install package: %s", err)
174189
}
175190

@@ -192,7 +207,7 @@ func (r *PackageInstallCommand) installFacade(ctx console.Context, name string)
192207
}
193208

194209
bindingsToInstall := r.getBindingsToInstall(binding)
195-
if len(bindingsToInstall) > 0 && !ctx.OptionBool("all-facades") {
210+
if len(bindingsToInstall) > 0 && !ctx.OptionBool("all") {
196211
facades := make([]string, len(bindingsToInstall))
197212
for i := range bindingsToInstall {
198213
facades[i] = convert.BindingToFacade(bindingsToInstall[i])
@@ -210,7 +225,7 @@ func (r *PackageInstallCommand) installFacade(ctx console.Context, name string)
210225
continue
211226
}
212227

213-
if err := supportconsole.ExecuteCommand(ctx, exec.Command("go", "run", setup, "install", "--facade="+facade, "--package-name="+env.MainPath(), "--paths="+r.paths)); err != nil {
228+
if err := supportconsole.ExecuteCommand(ctx, exec.Command("go", "run", setup, "install", "--facade="+facade, "--main-path="+env.MainPath(), "--paths="+r.paths)); err != nil {
214229
return fmt.Errorf("failed to install facade %s: %s", facade, err.Error())
215230
}
216231

@@ -271,27 +286,33 @@ func (r *PackageInstallCommand) installDriver(ctx console.Context, facade string
271286
Value: "Custom",
272287
})
273288

274-
driver, err := ctx.Choice(fmt.Sprintf("Select the %s driver to install", facade), options, console.ChoiceOption{
275-
Description: fmt.Sprintf("A driver is required for %s, please select one to install.", facade),
276-
})
277-
if err != nil {
278-
return err
279-
}
280-
281-
if driver == "Custom" {
282-
driver, err = ctx.Ask(fmt.Sprintf("Please enter the %s driver package", facade))
289+
var driver string
290+
if ctx.OptionBool("default") {
291+
driver = options[0].Value
292+
} else {
293+
var err error
294+
driver, err = ctx.Choice(fmt.Sprintf("Select the %s driver to install", facade), options, console.ChoiceOption{
295+
Description: fmt.Sprintf("A driver is required for %s, please select one to install.", facade),
296+
})
283297
if err != nil {
284298
return err
285299
}
286-
}
287300

288-
if driver == "" {
289-
return r.installDriver(ctx, facade, bindingInfo)
301+
if driver == "Custom" {
302+
driver, err = ctx.Ask(fmt.Sprintf("Please enter the %s driver package", facade))
303+
if err != nil {
304+
return err
305+
}
306+
}
307+
308+
if driver == "" {
309+
return r.installDriver(ctx, facade, bindingInfo)
310+
}
290311
}
291312

292313
if isInternalDriver(driver) {
293314
setup := bindingInfo.PkgPath + "/setup"
294-
if err := supportconsole.ExecuteCommand(ctx, exec.Command("go", "run", setup, "install", "--driver="+driver, "--package-name="+env.MainPath(), "--paths="+r.paths)); err != nil {
315+
if err := supportconsole.ExecuteCommand(ctx, exec.Command("go", "run", setup, "install", "--driver="+driver, "--main-path="+env.MainPath(), "--paths="+r.paths)); err != nil {
295316
return fmt.Errorf("failed to install driver %s: %s", driver, err.Error())
296317
}
297318

0 commit comments

Comments
 (0)