Skip to content

Commit

Permalink
fix: dependency error
Browse files Browse the repository at this point in the history
  • Loading branch information
hwbrzzl committed Sep 29, 2024
1 parent d23da62 commit 4393423
Show file tree
Hide file tree
Showing 6 changed files with 198 additions and 237 deletions.
85 changes: 84 additions & 1 deletion contracts/foundation/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,32 @@ package foundation
import (
"context"

"github.com/goravel/framework/contracts/auth"
"github.com/goravel/framework/contracts/auth/access"
"github.com/goravel/framework/contracts/cache"
"github.com/goravel/framework/contracts/config"
"github.com/goravel/framework/contracts/console"
"github.com/goravel/framework/contracts/crypt"
"github.com/goravel/framework/contracts/database/migration"
"github.com/goravel/framework/contracts/database/orm"
"github.com/goravel/framework/contracts/database/seeder"
"github.com/goravel/framework/contracts/event"
"github.com/goravel/framework/contracts/filesystem"
"github.com/goravel/framework/contracts/grpc"
"github.com/goravel/framework/contracts/hash"
"github.com/goravel/framework/contracts/http"
"github.com/goravel/framework/contracts/log"
"github.com/goravel/framework/contracts/mail"
"github.com/goravel/framework/contracts/queue"
"github.com/goravel/framework/contracts/route"
"github.com/goravel/framework/contracts/schedule"
"github.com/goravel/framework/contracts/session"
"github.com/goravel/framework/contracts/testing"
"github.com/goravel/framework/contracts/translation"
"github.com/goravel/framework/contracts/validation"
)

type Application interface {
Container
// Boot register and bootstrap configured service providers.
Boot()
// Commands register the given commands with the console application.
Expand Down Expand Up @@ -42,4 +63,66 @@ type Application interface {
SetJson(json Json)
// GetJson get the JSON implementation.
GetJson() Json

// Container
// Bind registers a binding with the container.
Bind(key any, callback func(app Application) (any, error))
// BindWith registers a binding with the container.
BindWith(key any, callback func(app Application, parameters map[string]any) (any, error))
// Instance registers an existing instance as shared in the container.
Instance(key, instance any)
// Make resolves the given type from the container.
Make(key any) (any, error)
// MakeArtisan resolves the artisan console instance.
MakeArtisan() console.Artisan
// MakeAuth resolves the auth instance.
MakeAuth(ctx http.Context) auth.Auth
// MakeCache resolves the cache instance.
MakeCache() cache.Cache
// MakeConfig resolves the config instance.
MakeConfig() config.Config
// MakeCrypt resolves the crypt instance.
MakeCrypt() crypt.Crypt
// MakeEvent resolves the event instance.
MakeEvent() event.Instance
// MakeGate resolves the gate instance.
MakeGate() access.Gate
// MakeGrpc resolves the grpc instance.
MakeGrpc() grpc.Grpc
// MakeHash resolves the hash instance.
MakeHash() hash.Hash
// MakeLang resolves the lang instance.
MakeLang(ctx context.Context) translation.Translator
// MakeLog resolves the log instance.
MakeLog() log.Log
// MakeMail resolves the mail instance.
MakeMail() mail.Mail
// MakeOrm resolves the orm instance.
MakeOrm() orm.Orm
// MakeQueue resolves the queue instance.
MakeQueue() queue.Queue
// MakeRateLimiter resolves the rate limiter instance.
MakeRateLimiter() http.RateLimiter
// MakeRoute resolves the route instance.
MakeRoute() route.Route
// MakeSchedule resolves the schedule instance.
MakeSchedule() schedule.Schedule
// MakeSchema resolves the schema instance.
MakeSchema() migration.Schema
// MakeSession resolves the session instance.
MakeSession() session.Manager
// MakeStorage resolves the storage instance.
MakeStorage() filesystem.Storage
// MakeTesting resolves the testing instance.
MakeTesting() testing.Testing
// MakeValidation resolves the validation instance.
MakeValidation() validation.Validation
// MakeView resolves the view instance.
MakeView() http.View
// MakeSeeder resolves the seeder instance.
MakeSeeder() seeder.Facade
// MakeWith resolves the given type with the given parameters from the container.
MakeWith(key any, parameters map[string]any) (any, error)
// Singleton registers a shared binding in the container.
Singleton(key any, callback func(app Application) (any, error))
}
92 changes: 0 additions & 92 deletions contracts/foundation/container.go

This file was deleted.

30 changes: 0 additions & 30 deletions contracts/foundation/service_provider_test.go

This file was deleted.

10 changes: 5 additions & 5 deletions foundation/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"

"github.com/goravel/framework/config"
consolecontract "github.com/goravel/framework/contracts/console"
contractsconsole "github.com/goravel/framework/contracts/console"
"github.com/goravel/framework/contracts/foundation"
"github.com/goravel/framework/foundation/console"
"github.com/goravel/framework/foundation/json"
Expand Down Expand Up @@ -38,7 +38,7 @@ func init() {
}

type Application struct {
foundation.Container
*Container
publishes map[string]map[string]string
publishGroups map[string]map[string]string
json foundation.Json
Expand All @@ -52,7 +52,7 @@ func NewApplication() foundation.Application {
func (app *Application) Boot() {
app.registerConfiguredServiceProviders()
app.bootConfiguredServiceProviders()
app.registerCommands([]consolecontract.Command{
app.registerCommands([]contractsconsole.Command{

Check warning on line 55 in foundation/application.go

View check run for this annotation

Codecov / codecov/patch

foundation/application.go#L55

Added line #L55 was not covered by tests
console.NewTestMakeCommand(),
console.NewPackageMakeCommand(),
console.NewVendorPublishCommand(app.publishes, app.publishGroups),
Expand All @@ -61,7 +61,7 @@ func (app *Application) Boot() {
app.bootArtisan()
}

func (app *Application) Commands(commands []consolecontract.Command) {
func (app *Application) Commands(commands []contractsconsole.Command) {

Check warning on line 64 in foundation/application.go

View check run for this annotation

Codecov / codecov/patch

foundation/application.go#L64

Added line #L64 was not covered by tests
app.registerCommands(commands)
}

Expand Down Expand Up @@ -209,7 +209,7 @@ func (app *Application) bootServiceProviders(serviceProviders []foundation.Servi
}
}

func (app *Application) registerCommands(commands []consolecontract.Command) {
func (app *Application) registerCommands(commands []contractsconsole.Command) {

Check warning on line 212 in foundation/application.go

View check run for this annotation

Codecov / codecov/patch

foundation/application.go#L212

Added line #L212 was not covered by tests
app.MakeArtisan().Register(commands)
}

Expand Down
Loading

0 comments on commit 4393423

Please sign in to comment.