function testDestinationIsValid() { $testdir = sys_get_temp_dir() . "/testdirtocreate"; $destination = Utils\destinationIsValid($testdir); $this->assertFileExists($testdir); $this->assertEquals($testdir, $destination); }
public function testDestinationIsValid() { $file_name = '/tmp/test_destination'; setOutputDestination($file_name); try { $valid_destination = Utils\destinationIsValid($file_name); } catch (\Exception $e) { $message = $e->getMessage(); } $this->assertTrue(isset($message)); resetOutputDestination($file_name); Utils\destinationIsValid('/tmp/'); }
/** * Mount a site with sshfs * * ## OPTIONS * * [--site=<site>] * : Site to deploy from * * --destination=<path> * : local directory to mount * * [--env=<env>] * : Environment (dev,test) * */ public function mount($args, $assoc_args) { exec('which sshfs', $stdout, $exit); if ($exit !== 0) { $this->failure('Must install sshfs first'); } $destination = Utils\destinationIsValid($assoc_args['destination']); $site = $this->sites->get(Input::sitename($assoc_args)); $env = Input::env(array('args' => $assoc_args, 'site' => $site)); exec('uname', $output, $ret); $darwin = ''; if (is_array($output) && isset($output[0]) && strpos($output[0], 'Darwin') !== false) { $darwin = '-o defer_permissions '; } $user = $env . '.' . $site->get('id'); $host = sprintf('appserver.%s.%s.drush.in', $env, $site->get('id')); $cmd = sprintf('sshfs %s -p 2222 %s@%s:./ %s', $darwin, $user, $host, $destination); exec($cmd, $stdout, $exit); if ($exit != 0) { $this->failure("Couldn't mount {$destination}"); } $message = 'Site mounted to {destination}.'; $message .= ' To unmount, run: umount {destination}'; $message .= ' (or fusermount -u {destination}).'; $this->log()->info($message, compact('destination')); }