36 lines
560 B
Go
36 lines
560 B
Go
package creator
|
|
|
|
import (
|
|
"os"
|
|
|
|
"penahub.gitlab.yandexcloud.net/pena-services/bluepint/blueprint"
|
|
)
|
|
|
|
type Deps struct {
|
|
Blueprint *blueprint.BlueprintFile
|
|
}
|
|
|
|
type Creator struct {
|
|
blueprint *blueprint.BlueprintFile
|
|
}
|
|
|
|
func NewCreator(deps Deps) *Creator {
|
|
return &Creator{
|
|
blueprint: deps.Blueprint,
|
|
}
|
|
}
|
|
|
|
func (r *Creator) CreateApp() error {
|
|
return r.makeFolders()
|
|
}
|
|
|
|
func (r *Creator) makeFolders() error {
|
|
for _, folderPath := range r.blueprint.Folders {
|
|
if err := os.MkdirAll(folderPath, 0750); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|