コード例 #1
0
 public function create()
 {
     try {
         Subversion::cmd('import', array(OpenpearConfig::svn_skeleton(work_path('skeleton')), File::absolute(OpenpearConfig::svn_root(), $this->package()->name())), array('message' => sprintf('[New Package] %s (@%s)', $this->package()->name(), $this->maintainer()->name()), 'username' => OpenpearConfig::system_user('openpear')));
         // $message = new OpenpearMessage();
         // $message->subject('New Package is ready for your commit!');
         $this->delete();
         C($this)->commit();
     } catch (Exception $e) {
         Log::error($e->getMessage());
         $this->trial_count += 1;
         $this->save();
         C($this)->commit();
     }
 }
コード例 #2
0
ファイル: OpenpearAPI.php プロジェクト: nequal/Openpear
 public function check_repo_exists()
 {
     $this->login_required();
     try {
         $package = OpenpearPackage::get_package($this->in_vars('package_id'));
         $info = Subversion::cmd('info', array(File::absolute(OpenpearConfig::svn_root(), implode('/', array($package->name(), 'trunk', $this->in_vars('dir', ''))))));
         if (isset($info['kind']) && $info['kind'] == 'dir') {
             echo 'ok';
         } else {
             throw new RuntimeException('directory is not found');
         }
     } catch (Exception $e) {
         Log::debug($e);
         echo 'ng';
     }
     exit;
 }
コード例 #3
0
ファイル: OpenpearChangeset.php プロジェクト: nequal/Openpear
 public static function commit_hook($path, $revision, $message)
 {
     Log::debug(sprintf('commit hook: %s %d "%s"', $path, $revision, $message));
     $changed = Subversion::look('changed', array($path), array('revision' => $revision));
     $author = trim(Subversion::look('author', array($path), array('revision' => $revision)));
     $parsed_changed = self::parse_svnlook_changed($changed);
     list($package_name) = explode('/', $parsed_changed[0]['path']);
     try {
         $package = C(OpenpearPackage)->find_get(Q::eq('name', $package_name));
         $maintainer = null;
         try {
             if ($author == OpenpearConfig::system_user('openpear') && preg_match('/\\(@(.*?)\\)$/', trim($message), $match)) {
                 $author = $match[1];
             }
             $maintainer = C(OpenpearMaintainer)->find_get(Q::eq('name', $author));
         } catch (Exception $e) {
             Log::error($e);
             // throw $e;
         }
         $changeset = new self();
         $changeset->revision($revision);
         if ($maintainer instanceof OpenpearMaintainer) {
             $changeset->maintainer_id($maintainer->id());
         }
         $changeset->package_id($package->id());
         $changeset->changed(serialize($parsed_changed));
         $changeset->save();
         if ($maintainer instanceof OpenpearMaintainer) {
             $package->author_id($maintainer->id());
         }
         $package->recent_changeset($changeset->revision());
         $package->save(true);
     } catch (Exception $e) {
         throw $e;
     }
     try {
         chdir(OpenpearConfig::working_copy());
         ob_start();
         passthru('svn up');
         ob_end_clean();
     } catch (Exception $e) {
     }
 }
コード例 #4
0
ファイル: OpenpearNoLogin.php プロジェクト: nequal/Openpear
 /**
  * SVNからログを取得
  * @param array $info
  * @return array
  */
 public static function format_info(array $info)
 {
     // TODO 仕様の確認
     // TODO Subversion::cmdの実装
     $log = Subversion::cmd('log', array($info['url']), array('limit' => 1));
     $info['recent'] = array_shift($log);
     try {
         $info['recent']['maintainer'] = C(OpenpearMaintainer)->find_get(Q::eq('name', $info['recent']['author']));
     } catch (NotfoundDaoException $e) {
         // FIXME
         $info['recent']['maintainer'] = new OpenpearMaintainer();
     }
     return $info;
 }
コード例 #5
0
ファイル: OpenpearTemplf.php プロジェクト: nequal/Openpear
 public final function svn_log_msg($revision)
 {
     $log = Subversion::cmd('log', array(OpenpearConfig::svn_root()), array('revision' => $revision));
     return (string) $log[0]['msg'];
 }