-
Notifications
You must be signed in to change notification settings - Fork 6
Adds setup:codespaces command #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.x
Are you sure you want to change the base?
Changes from 2 commits
6e390a6
f79615e
dd3d458
ff093e5
58d289f
565142d
9acd9f8
fb75aee
686a2fc
1172bfd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -506,4 +506,39 @@ public function frontendDevDisable($siteDir = 'default', array $opts = ['yes|y' | |
| ->remove($this->devServicesPath) | ||
| ->run(); | ||
| } | ||
|
|
||
| /** | ||
| * Setup a site in GitHub Codespaces. | ||
| * | ||
| * @throws \Robo\Exception\TaskException | ||
| */ | ||
| public function setupCodespaces() | ||
| { | ||
| $codespaces_directory = getenv('PWD') . '/web'; | ||
| if (empty($codespaces_directory)) { | ||
| throw new TaskException($this, 'Codespaces directory is unavailable.'); | ||
| } | ||
| $result = $this->taskExec('rm /var/www/html')->run(); | ||
|
walangitan marked this conversation as resolved.
Outdated
|
||
| $result = $this->taskExec("ln -s $codespaces_directory /var/www/html")->run(); | ||
|
|
||
| $this->io()->title('Start apache, forwarding port 80.'); | ||
| $result = $this->taskExec('service apache2 start')->run(); | ||
|
|
||
| $this->io()->title('Download database.'); | ||
| $dbPath = $this->databaseDownload(); | ||
| if (empty($dbPath)) { | ||
| throw new TaskException($this, 'Database download failed.'); | ||
| } | ||
|
|
||
| $this->io()->section('Importing database.'); | ||
| $result = $this->taskExec("zcat $dbPath | mysql -h db -u mariadb -pmariadb mariadb")->run(); | ||
| $result = $this->taskExec('rm')->args($dbPath)->run(); | ||
|
|
||
| $this->io()->section('Building theme.'); | ||
| $result = $this->taskExec('composer robo theme:build')->run(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and the db download line above will work for simple sites, but multi-sites will require some special cases. I am OK with merging this assuming we want to address that in a future update.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can log a ticket about updating this to support multi-sites, as well as some other caveats that may need to be created to support running a multi-site in codespaces. |
||
|
|
||
| $this->io()->section('Clearing Drupal cache.'); | ||
| $result = $this->taskExec('vendor/bin/drush cr')->run(); | ||
|
walangitan marked this conversation as resolved.
Outdated
|
||
| return $result; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.