当前位置: 首页>>代码示例>>PHP>>正文


PHP Command::stderr方法代码示例

本文整理汇总了PHP中Command::stderr方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::stderr方法的具体用法?PHP Command::stderr怎么用?PHP Command::stderr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Command的用法示例。


在下文中一共展示了Command::stderr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build

 /**
  * パッケージのビルドとリリースを行う
  * @return void
  **/
 public function build()
 {
     $package = C(OpenpearPackage)->find_get(Q::eq('id', $this->package_id));
     $maintainer = C(OpenpearMaintainer)->find_get(Q::eq('id', $this->maintainer_id));
     $this->init_build_dir(work_path('build/' . $package->name() . '.' . date('YmdHis')));
     foreach (array('desc.txt', 'notes.txt', 'summary.txt') as $filename) {
         File::write($this->build_dir($filename), $package->description());
     }
     if ($package->is_external_repository()) {
         switch ($package->external_repository_type()) {
             case 'Git':
                 $cmd = 'git clone';
                 break;
             case 'Mercurial':
                 $cmd = 'hg clone';
                 break;
             case 'Subversion':
                 $cmd = 'svn export';
                 break;
             default:
                 throw new RuntimeException('unknown repository type');
         }
         $command = new Command(sprintf('%s %s %s', $cmd, escapeshellarg($package->external_repository()), escapeshellarg($this->build_dir('tmp'))));
     } else {
         // Openpear Repository
         $revision = is_numeric($this->revision) && $this->revision > 0 ? intval($this->revision) : 'HEAD';
         $repository_path = sprintf('%s/%s/trunk', OpenpearConfig::svn_root(), $package->name());
         $command = new Command(sprintf('svn export -r %s %s %s', $revision, escapeshellarg($repository_path), escapeshellarg($this->build_dir('tmp'))));
     }
     if ($command->end_code()) {
         throw new RuntimeException($command->stderr());
     }
     $build_path = $this->build_dir(implode('/', array('tmp', $this->build_path)));
     if (!File::exist($build_path)) {
         throw new RuntimeException(sprintf('build path is not found: %s', $build_path));
     }
     $mv = new Command(sprintf('mv %s %s', escapeshellarg($build_path), escapeshellarg($this->build_dir('src'))));
     if ($mv->stderr() || !is_dir($this->build_dir('src'))) {
         throw new RuntimeException('src dir is not found');
     }
     // ビルドする
     chdir($this->build_dir());
     $project = PEAR_PackageProjector::singleton()->load($this->build_dir());
     $project->configure($this->build_dir('build.conf'));
     $project->make();
     // リリースしたファイルはどこ?
     chdir($this->build_dir('release'));
     foreach (glob('*.tgz') as $filename) {
         $package_file = $this->build_dir('release') . '/' . $filename;
         break;
     }
     if (!file_exists($package_file)) {
         throw new RuntimeException('package file is not exists: ' . $package_file);
     }
     // サーバーに追加する
     $cfg = (include path('channel.config.php'));
     $server = new PEAR_Server2($cfg);
     $server->addPackage($package_file);
     // svn tag
     $build_conf = parse_ini_string($this->build_conf, true);
     $svn = new Command(sprintf('svn copy' . ' %s/%s/trunk/%s' . ' %s/%s/tags/%s-%s-%s' . ' -m "%s (%s-%s) (@%s)"' . ' --username openpear', OpenpearConfig::svn_root(), $package->name(), $this->build_path, OpenpearConfig::svn_root(), $package->name(), $build_conf['version']['release_ver'], $build_conf['version']['release_stab'], date('YmdHis'), 'package released', $build_conf['version']['release_ver'], $build_conf['version']['release_stab'], $maintainer->name()));
     // これ以降はエラーが起きてもドンマイ
     try {
         $release = new OpenpearRelease();
         $release->package_id($package->id());
         $release->maintainer_id($maintainer->id());
         $release->version($build_conf['version']['release_ver']);
         $release->version_stab($build_conf['version']['release_stab']);
         $release->notes($this->notes);
         $release->settings($this->build_conf);
         $release->save();
         $package->latest_release_id($release->id());
         $package->released_at(time());
         $package->save();
         $message_template = new Template();
         $message_template->vars('t', new Templf());
         $message_template->vars('package', $package);
         $message_template->vars('maintainer', $maintainer);
         $message = new OpenpearMessage('type=system');
         $message->maintainer_to_id($maintainer->id());
         $message->subject(trans('{1} package have been released.', $package->name()));
         $message->description($message_template->read('messages/released.txt'));
         $message->save();
     } catch (Exception $e) {
         Log::error($e);
     }
 }
开发者ID:nequal,项目名称:Openpear,代码行数:91,代码来源:OpenpearReleaseQueue.php

示例2: anime_gif

 public static function anime_gif($input_dir, $output_filename, $delay = 50)
 {
     if (!is_dir($input_dir)) {
         throw new Exception($input_dir . " not found");
     }
     if (!preg_match("/\\.gif\$/i", $output_filename)) {
         $output_filename = $output_filename . ".gif";
     }
     $cmd = new Command(sprintf("%s -delay %d -loop 0 %s %s", self::$imagemagick_convert, $delay, File::path($input_dir, "*"), $output_filename));
     if (!is_file($output_filename)) {
         throw new Exception($cmd->stderr());
     }
     return $output_file;
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:14,代码来源:Image.php


注:本文中的Command::stderr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。