示例#1
0
文件: concat.php 项目: nagumo/Phest
function plugin_build_concat(array $params, Phest $phest)
{
    $sourcepath = $phest->getSourcePath();
    $output_source = '';
    $count = 0;
    foreach ($params['sources'] as $spath) {
        $spath = $sourcepath . '/' . $spath;
        if (file_exists($spath)) {
            $count++;
            $output_source .= file_get_contents($spath);
        } else {
            $phest->add('builderror', '[concat] sources で指定されたファイルが存在しません: ' . $spath);
        }
    }
    $phest->add('build', '[concat] ' . $count . '個のファイルを結合: /<b>' . $params['output'] . '</b>');
    File::buildPutFile($sourcepath . '/' . $params['output'], $output_source);
    return true;
}
示例#2
0
文件: Phest.php 项目: nagumo/Phest
 /**
  * ファイルに更新があるか
  *
  * @method hasNew
  * @return boolean 更新がある場合true
  */
 public function hasNew()
 {
     $has_new = false;
     $path_concat_string = '';
     //ページをスキャン
     foreach ($this->watch_list as $filepath) {
         if ($this->site_last_buildtime < filemtime($filepath)) {
             $has_new = true;
         }
         $path_concat_string .= ':' . $filepath;
     }
     //ファイルパスを全部つないだ文字列のハッシュをとる
     $source_pathhash = md5($path_concat_string);
     //ファイルパスの変更があるか
     if ($this->site_last_buildhash != $source_pathhash) {
         $has_new = true;
     }
     if ($has_new) {
         $this->site_last_buildhash = $source_pathhash;
         //ビルド時間を記録
         File::buildPutFile($this->path_buildstatus_site, $this->site_last_buildhash);
     }
     return $has_new;
 }
示例#3
0
文件: index.php 项目: nagumo/Phest
     }
     //css
     if ($is_css) {
         //本番環境かつcompilecss=1なら圧縮
         if ($finalize and !empty($config_yaml['compilecss'])) {
             if (!check_path_match($filepath, $config_yaml['ignorecompilecss'])) {
                 $source = CssMin::minify($source);
                 $create_option .= ' (minified)';
             } else {
                 $create_option .= ' (ignore minify)';
             }
         }
     }
     //ファイルとして出力
     if ($is_output) {
         File::buildPutFile($dir_output . '/' . $filepath, $source);
         if ($is_js and !$is_nolint) {
             //lint check
             $lint_error = jslint($pathname);
             if ($lint_error) {
                 foreach ($lint_error as $lerr) {
                     $phest->add('jslint', $basename . ':' . $lerr);
                 }
             }
         }
     }
 } else {
     $outputpath = $dir_output . '/' . $filepath;
     $tmp_dir = dirname($outputpath);
     if (!is_dir($tmp_dir)) {
         File::buildMakeDir($tmp_dir);