Skip to content

Add generic apptype detection using apptype approach in #574 - #585

Merged
rfay merged 4 commits into
ddev:masterfrom
rfay:20171227_detect_handling
Jan 3, 2018
Merged

rfay merged 4 commits into
ddev:masterfrom
rfay:20171227_detect_handling

Conversation

@rfay

@rfay rfay commented Dec 27, 2017 •

Copy link
Copy Markdown
Member

The Problem/Issue/Bug:

Apptype detection is done inline in existing code, which makes it hard to maintain. We're now moving all types of app-specific logic into its own file in ddevapp. This PR does that for drupal, wordpress, and php.

This builds on #574 (generic, extensible apptype handling)

How this PR Solves The Problem:

  • Add an appTypeDetect member to the appTypeMatrix,
  • Implement the members for drupal and wordpress
  • Create the master user DetectAppType()

Manual Testing Instructions:

Try it out on some sites. Note that only drupal7, drupal8, and wordpress (and the default "php") are currently implemented.

Automated Testing Overview:

This adds one test for detection and updates previous tests.

Related Issue Link(s):

#574 is the basic PR, with much background.
OP: #535

Release/Deployment notes:

@rfay rfay self-assigned this Dec 27, 2017
@rfay
rfay requested a review from cweagans December 27, 2017 17:43
@rfay
rfay force-pushed the 20171227_detect_handling branch from 8673ad1 to 401251c Compare December 27, 2017 19:22
@rfay

rfay commented Dec 27, 2017

Copy link
Copy Markdown
Member Author

OK, I think this one is ready for review if it passes tests, thanks @cweagans and @rickmanelius

@rickmanelius
rickmanelius self-requested a review December 27, 2017 23:58
@rfay
rfay force-pushed the 20171227_detect_handling branch from ca325a2 to 64cd309 Compare December 28, 2017 01:59
Comment thread pkg/ddevapp/apptypes.go
return appName
}
}
return "php"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, we should not hardcode this. Put php at the end of appTypeMatrix, and then have an actual detector function for PHP that returns true if there are any PHP files in the app root. It'll be last in line behind the other PHP app types. That way, if we ever get around to adding Ruby or Python environments, we can do something similar for fallback detection.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rfay let me know that the ordering of maps in Go is indeterminate, so this is not quite as easy as I thought it would be. Given that support for other languages is likely a while out still, this is fine as is :)

@rfay
rfay force-pushed the 20171227_detect_handling branch from 64cd309 to 35b66a0 Compare January 3, 2018 17:41
@rfay
rfay merged commit c41d649 into ddev:master Jan 3, 2018
@rfay
rfay deleted the 20171227_detect_handling branch January 3, 2018 21:42
This was referenced Jan 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants