Skip to content

Commit

Permalink
Fix Craft implementation and instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbertsoft committed Jul 3, 2023
1 parent d104f29 commit 040f997
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
3 changes: 3 additions & 0 deletions cmd/ddev/cmd/composer-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ ddev composer create --preserve-flags --no-interaction psr/log
output.UserErr.Println(stderr)
}

// Reload composer.json if it has changed in the meantime.
composerManifest, _ := composer.NewManifest(path.Join(composerRoot, "composer.json"))

if !preserveFlags && composerManifest != nil && composerManifest.HasPostCreateProjectCmdScript() {
// Try to run post-create-project-cmd.
composerCmd = []string{
Expand Down
3 changes: 1 addition & 2 deletions docs/content/users/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ While the generic `php` project type is [ready to go](./project.md) with any CMS
ddev start
ddev composer create -y craftcms/craft

# Run the Craft installer:
ddev craft install
# Open site in the browser:
ddev launch
```

Expand Down
18 changes: 3 additions & 15 deletions pkg/ddevapp/craftcms.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package ddevapp

import (
"fmt"
"os"
"path/filepath"

"github.com/ddev/ddev/pkg/archive"
"github.com/ddev/ddev/pkg/fileutil"
"github.com/ddev/ddev/pkg/nodeps"
"github.com/ddev/ddev/pkg/util"
"github.com/pkg/errors"
"os"
"path/filepath"
)

// isCraftCmsApp returns true if the app is of type craftcms
Expand Down Expand Up @@ -138,19 +139,6 @@ func craftCmsPostStartAction(app *DdevApp) error {
return err
}

// If composer.json.default exists, rename it to composer.json
composerDefaultFilePath := filepath.Join(app.AppRoot, app.ComposerRoot, "composer.json.default")
if fileutil.FileExists(composerDefaultFilePath) {
composerFilePath := filepath.Join(app.AppRoot, app.ComposerRoot, "composer.json")
util.Warning("Renaming composer.json.default to composer.json")
err = os.Rename(composerDefaultFilePath, composerFilePath)
if err != nil {
util.Error("Error renaming composer.json.default to composer.json")

return err
}
}

return nil
}

Expand Down

0 comments on commit 040f997

Please sign in to comment.