diff --git a/composer.lock b/composer.lock index 6f41a3e76..a167a8fa1 100644 --- a/composer.lock +++ b/composer.lock @@ -394,16 +394,16 @@ }, { "name": "monolog/monolog", - "version": "1.7.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "6225b22de9dcf36546be3a0b2fa8e3d986153f57" + "reference": "392ef35fd470638e08d0160d6b1cbab63cb23174" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/6225b22de9dcf36546be3a0b2fa8e3d986153f57", - "reference": "6225b22de9dcf36546be3a0b2fa8e3d986153f57", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/392ef35fd470638e08d0160d6b1cbab63cb23174", + "reference": "392ef35fd470638e08d0160d6b1cbab63cb23174", "shasum": "" }, "require": { @@ -411,11 +411,11 @@ "psr/log": "~1.0" }, "require-dev": { - "aws/aws-sdk-php": "~2.4.8", - "doctrine/couchdb": "dev-master", - "mlehner/gelf-php": "1.0.*", + "aws/aws-sdk-php": "~2.4, >2.4.8", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", "phpunit/phpunit": "~3.7.0", - "raven/raven": "0.5.*", + "raven/raven": "~0.5", "ruflin/elastica": "0.90.*" }, "suggest": { @@ -423,19 +423,20 @@ "doctrine/couchdb": "Allow sending log messages to a CouchDB server", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", "ext-mongo": "Allow sending log messages to a MongoDB server", - "mlehner/gelf-php": "Allow sending log messages to a GrayLog2 server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "raven/raven": "Allow sending log messages to a Sentry server", + "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { - "psr-0": { - "Monolog": "src/" + "psr-4": { + "Monolog\\": "src/Monolog" } }, "notification-url": "https://packagist.org/downloads/", @@ -457,7 +458,7 @@ "logging", "psr-3" ], - "time": "2013-11-14 19:48:31" + "time": "2014-03-23 19:50:26" }, { "name": "phpseclib/phpseclib", @@ -465,12 +466,12 @@ "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "b77b26f692e34bc7d4e84bb55ac73b0a47719401" + "reference": "fba7376b08e0ebdf0312809505633aee7a9809f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/b77b26f692e34bc7d4e84bb55ac73b0a47719401", - "reference": "b77b26f692e34bc7d4e84bb55ac73b0a47719401", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/fba7376b08e0ebdf0312809505633aee7a9809f4", + "reference": "fba7376b08e0ebdf0312809505633aee7a9809f4", "shasum": "" }, "require": { @@ -552,7 +553,7 @@ "x.509", "x509" ], - "time": "2014-03-12 23:03:21" + "time": "2014-03-30 15:23:30" }, { "name": "psr/log", @@ -763,12 +764,12 @@ "source": { "type": "git", "url": "https://github.com/padraic/mockery.git", - "reference": "a32c6ad986c061b40636b7da4fe30adc2a7451b5" + "reference": "2739e3062557253b1eddb7c32b49936d5882333f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/padraic/mockery/zipball/a32c6ad986c061b40636b7da4fe30adc2a7451b5", - "reference": "a32c6ad986c061b40636b7da4fe30adc2a7451b5", + "url": "https://api.github.com/repos/padraic/mockery/zipball/2739e3062557253b1eddb7c32b49936d5882333f", + "reference": "2739e3062557253b1eddb7c32b49936d5882333f", "shasum": "" }, "require": { @@ -821,7 +822,7 @@ "test double", "testing" ], - "time": "2014-03-05 22:17:02" + "time": "2014-03-30 21:04:41" }, { "name": "nesbot/carbon", @@ -875,12 +876,12 @@ "source": { "type": "git", "url": "https://github.com/nicolas-grekas/Patchwork-UTF8.git", - "reference": "aea0de833cba7cf2c25239be71f2787edaee36d5" + "reference": "f45ba8bc7962b7356847724989a6949b68d975a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nicolas-grekas/Patchwork-UTF8/zipball/aea0de833cba7cf2c25239be71f2787edaee36d5", - "reference": "aea0de833cba7cf2c25239be71f2787edaee36d5", + "url": "https://api.github.com/repos/nicolas-grekas/Patchwork-UTF8/zipball/f45ba8bc7962b7356847724989a6949b68d975a2", + "reference": "f45ba8bc7962b7356847724989a6949b68d975a2", "shasum": "" }, "require": { @@ -918,7 +919,7 @@ "utf-8", "utf8" ], - "time": "2014-03-01 20:01:07" + "time": "2014-03-26 10:52:02" }, { "name": "phine/exception", diff --git a/src/Rocketeer/Traits/BashModules/Binaries.php b/src/Rocketeer/Traits/BashModules/Binaries.php index 155d9a4fa..7cd612aba 100644 --- a/src/Rocketeer/Traits/BashModules/Binaries.php +++ b/src/Rocketeer/Traits/BashModules/Binaries.php @@ -34,40 +34,41 @@ public function php($command = null) return trim($php. ' ' .$command); } + // Artisan + //////////////////////////////////////////////////////////////////// + /** - * Prefix a command with the right path to Composer + * Prefix a command with the right path to Artisan * * @param string $command + * @param array $flags * * @return string */ - public function composer($command = null) + public function artisan($command = null, $flags = array()) { - $composer = $this->which('composer', $this->releasesManager->getCurrentReleasePath().'/composer.phar'); - - // Prepend PHP command - if (strpos($composer, 'composer.phar') !== false) { - $composer = $this->php($composer); + $artisan = $this->which('artisan') ?: 'artisan'; + foreach ($flags as $name => $value) { + $command .= ' --'.$name; + $command .= $value ? '="' .$value. '"' : ''; } - return trim($composer. ' ' .$command); + return $this->php($artisan. ' ' .$command); } - // Artisan - //////////////////////////////////////////////////////////////////// - /** - * Prefix a command with the right path to Artisan + * Run an artisan command * * @param string $command + * @param array $flags * * @return string */ - public function artisan($command = null) + public function runArtisan($command = null, $flags = array()) { - $artisan = $this->which('artisan') ?: 'artisan'; + $command = $this->artisan($command, $flags); - return $this->php($artisan. ' ' .$command); + return $this->runForCurrentRelease($command); } /** @@ -79,10 +80,10 @@ public function artisan($command = null) */ public function runMigrations($seed = false) { - $seed = $seed ? ' --seed' : null; $this->command->comment('Running outstanding migrations'); + $flags = $seed ? array('seed' => '') : array(); - return $this->runForCurrentRelease($this->artisan('migrate'.$seed)); + return $this->runArtisan('migrate', $flags); } /** @@ -94,9 +95,10 @@ public function runMigrations($seed = false) */ public function seed($class = null) { - $class = $class ? ' --class="'.$class.'"' : null; + $this->command->comment('Seeding database'); + $flags = $class ? array('class' => $class) : array(); - return $this->runForCurrentRelease($this->artisan('db:seed'.$class)); + return $this->runArtisan('db:seed', $flags); } // PHPUnit @@ -129,6 +131,25 @@ public function runTests($arguments = null) // Composer //////////////////////////////////////////////////////////////////// + /** + * Prefix a command with the right path to Composer + * + * @param string $command + * + * @return string + */ + public function composer($command = null) + { + $composer = $this->which('composer', $this->releasesManager->getCurrentReleasePath().'/composer.phar'); + + // Prepend PHP command + if (strpos($composer, 'composer.phar') !== false) { + $composer = $this->php($composer); + } + + return trim($composer. ' ' .$command); + } + /** * Run Composer on the folder * diff --git a/src/Rocketeer/Traits/BashModules/Filesystem.php b/src/Rocketeer/Traits/BashModules/Filesystem.php index efccccc54..54a0f4937 100644 --- a/src/Rocketeer/Traits/BashModules/Filesystem.php +++ b/src/Rocketeer/Traits/BashModules/Filesystem.php @@ -54,12 +54,7 @@ public function symlink($folder, $symlink) */ public function move($origin, $destination) { - $folder = dirname($destination); - if (!$this->fileExists($folder)) { - $this->createFolder($folder, true); - } - - return $this->run(sprintf('mv %s %s', $origin, $destination)); + return $this->fromTo('mv', $origin, $destination); } /** @@ -72,12 +67,7 @@ public function move($origin, $destination) */ public function copy($origin, $destination) { - $folder = dirname($destination); - if (!$this->fileExists($folder)) { - $this->createFolder($folder, true); - } - - return $this->run(sprintf('cp %s %s', $origin, $destination)); + return $this->fromTo('cp', $origin, $destination); } /** @@ -192,4 +182,27 @@ public function removeFolder($folder = null) { return $this->run('rm -rf '.$this->rocketeer->getFolder($folder)); } + + //////////////////////////////////////////////////////////////////// + /////////////////////////////// HELPERS //////////////////////////// + //////////////////////////////////////////////////////////////////// + + /** + * Execute a "from/to" style command + * + * @param string $command + * @param string $from + * @param string $to + * + * @return string + */ + protected function fromTo($command, $from, $to) + { + $folder = dirname($to); + if (!$this->fileExists($folder)) { + $this->createFolder($folder, true); + } + + return $this->run(sprintf('%s %s %s', $command, $from, $to)); + } }