Skip to content

Commit

Permalink
Merge branch 'release/3.6.1'
Browse files Browse the repository at this point in the history
Removing sudo command
  • Loading branch information
singularo committed Jun 27, 2019
2 parents 3a98c71 + 28e2e0c commit 49c4d60
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
32 changes: 18 additions & 14 deletions RoboFileBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ abstract class RoboFileBase extends \Robo\Tasks {

protected $drush_cmd;
protected $local_user;
protected $sudo_cmd;

protected $drush_bin = "bin/drush";
protected $composer_bin = "composer";
Expand Down Expand Up @@ -90,7 +89,6 @@ abstract class RoboFileBase extends \Robo\Tasks {
*/
public function __construct() {
$this->drush_cmd = $this->drush_bin;
$this->sudo_cmd = posix_getuid() == 0 ? '' : 'sudo';
$this->local_user = $this->getLocalUser();

// Read config from env vars.
Expand Down Expand Up @@ -203,9 +201,9 @@ public function buildMake($flags = '') {
public function buildSetFilesOwner() {
foreach ([$this->file_public_path, $this->file_private_path, $this->file_temporary_path] as $path) {
$this->say("Ensuring all directories exist.");
$this->_exec("$this->sudo_cmd mkdir -p $path");
$this->_exec("mkdir -p $path");
$this->say("Setting files directory owner.");
$this->_exec("$this->sudo_cmd chown $this->web_server_user:$this->local_user -R $path");
$this->_exec("chown $this->web_server_user:$this->local_user -R $path");
$this->say("Setting directory permissions.");
$this->setPermissions($path, '0775');
}
Expand Down Expand Up @@ -260,13 +258,13 @@ public function setSitePath() {
*/
public function buildClean() {
$this->setPermissions("$this->application_root/sites/default", '0755');
$this->_exec("$this->sudo_cmd rm -fR $this->application_root/core");
$this->_exec("$this->sudo_cmd rm -fR $this->application_root/modules/contrib");
$this->_exec("$this->sudo_cmd rm -fR $this->application_root/profiles/contrib");
$this->_exec("$this->sudo_cmd rm -fR $this->application_root/themes/contrib");
$this->_exec("$this->sudo_cmd rm -fR $this->application_root/sites/all");
$this->_exec("$this->sudo_cmd rm -fR bin");
$this->_exec("$this->sudo_cmd rm -fR vendor");
$this->_exec("rm -fR $this->application_root/core");
$this->_exec("rm -fR $this->application_root/modules/contrib");
$this->_exec("rm -fR $this->application_root/profiles/contrib");
$this->_exec("rm -fR $this->application_root/themes/contrib");
$this->_exec("rm -fR $this->application_root/sites/all");
$this->_exec("rm -fR bin");
$this->_exec("rm -fR vendor");
}

/**
Expand Down Expand Up @@ -332,14 +330,20 @@ public function devInstallAdminer() {
* CLI debug enable.
*/
public function devXdebugEnable() {
$this->_exec("sudo $this->php_enable_module_command -s cli xdebug");
// Only run this on environments configured with xdebug.
if (getenv('XDEBUG_CONFIG')) {
$this->_exec("sudo $this->php_enable_module_command -s cli xdebug");
}
}

/**
* CLI debug disable.
*/
public function devXdebugDisable() {
$this->_exec("sudo $this->php_disable_module_command -s cli xdebug");
// Only run this on environments configured with xdebug.
if (getenv('XDEBUG_CONFIG')) {
$this->_exec("sudo $this->php_disable_module_command -s cli xdebug");
}
}

/**
Expand Down Expand Up @@ -636,7 +640,7 @@ public function lintFix($path = '') {
*/
protected function setPermissions($file, $permission) {
if (file_exists($file)) {
$this->_exec("$this->sudo_cmd chmod $permission $file");
$this->_exec("chmod $permission $file");
}
}

Expand Down
2 changes: 0 additions & 2 deletions docker-compose.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ services:
USER_ID: ${USER_ID:-1000}
GROUP_ID: ${GROUP_ID:-1000}
image: uofa/s2i-shepherd-drupal-dev
# Chrome webdriver requires this - used for tests.
privileged: true
hostname: ${PROJECT}
ports:
- "80:8080"
Expand Down

0 comments on commit 49c4d60

Please sign in to comment.