Last active
August 29, 2015 14:26
-
-
Save dustinleblanc/e4de37239a923ac10923 to your computer and use it in GitHub Desktop.
Build a Drupal 7 site with custom module code, features, settings, drush aliases, and themes using the drupal-composer template and Robo!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Root | |
|-composer.json | |
|-composer.lock | |
|-src/ | |
|-custom/ | |
|-features/ | |
|-themes/ | |
|-drush/ | |
|-settings.php | |
|-readme.md | |
|-web/ (the drupal root which is created after composer install and further populated with custom code after robo build) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This is project's console commands configuration for Robo task runner. | |
* | |
* @see http://robo.li/ | |
*/ | |
class RoboFile extends \Robo\Tasks | |
{ | |
/** | |
* Sync custom source files with web directory. | |
*/ | |
public function build() { | |
$this->taskMirrorDir([ | |
'src/features' => 'web/sites/all/modules/features', | |
'src/custom' => 'web/sites/all/modules/custom', | |
'src/themes' => 'web/sites/all/themes', | |
'src/drush' => 'web/sites/all/drush' | |
])->run(); | |
$this->taskFilesystemStack() | |
->copy('src/settings.php', 'web/sites/default/settings.php') | |
->run(); | |
} | |
/** | |
* Ensures that all site code has the proper file permissions | |
* @param string $user | |
* @param string $group | |
* @throws \Robo\Exception\TaskException | |
*/ | |
public function setPerms($user, $group) { | |
if (!$user) { | |
$user = $this->ask('What is your system username?'); | |
} | |
if (!$group) { | |
$group = $this->ask('What is your system group name?'); | |
} | |
$this->taskExecStack() | |
->dir('./web') | |
->stopOnFail() | |
->exec("chown -R $user:$group .") | |
->exec("find . -type d -exec chmod u=rwx,g=rx,o= '{}' \;") | |
->exec("find . -type f -exec chmod u=rw,g=r,o= '{}' \;") | |
->dir('./web/sites') | |
->exec("find . -type d -name files -exec chmod ug=rwx,o= '{}' \;") | |
->exec("for d in ./*/files; do find \$d -type d -exec chmod ug=rwx,o= '{}' \;; find \$d -type f -exec chmod ug=rw,o= '{}' \;; done") | |
->run(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment