微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

fis 时时推送代码到服务器上

fis 时时推送代码到服务器上,fis代码同步,代码同步到服务器

一、服务器PHP文件


@error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
function mkdirs($path, $mod = 0777)
{
    if (is_dir($path))
    {
        return chmod($path, $mod);
    } else
    {
        $old = umask(0);
        if(mkdir($path, $mod, true) && is_dir($path)){
            umask($old);
            return true;
        } else {
            umask($old);
        }
    }
    return false;
}

if($_POST['to'])
{
    $to = urldecode($_POST['to']);
    if(is_dir($to) || $_FILES["file"]["error"] > 0){
        header("Status: 500 Internal Server Error");
    } else {
        if(file_exists($to)){
            unlink($to);
        } else {
            $dir = dirname($to);
            if(!file_exists($dir)){
                mkdirs($dir);
            }
        }
        echo move_uploaded_file($_FILES["file"]["tmp_name"], $to) ? 0 : 1;
    }
} else 
{
    echo 'I\'m ready for that, you kNow.';
}

二、js (fis-conf.js)文件(本地项目根目录下)


//QA环境
const qa_tpl_receiver = 'http://127.0.0.1/receiver.PHP'; //真实服务器上receiver.PHP文件地址需要777权限
const qa_tpldir = '/www/';//服务器项目根目录
const qa_cdn = '';
// 认基础配置
fis.match('*.js', {
    optimizer: fis.plugin('uglify-js'),    useHash: false
  })
  .match('*.css', {
    optimizer: fis.plugin('clean-css'),    useHash: false
  });

// 联调环境配置  test为项目目录的文件夹 需要777权限
fis
  .media('qa')
  .match('**', {
    useHash: true,    domain: qa_cdn
  })
  .match('**.html', {
    deploy: fis.plugin('http-push', {
      receiver: qa_tpl_receiver,      to: qa_tpldir + '/test'
    }),    useHash: false
  })
  .match('*.{woff,ttf,woff2,otf,eot,svg,png,jpg,gif,css,less,js}',    url: '/test$0',    useHash: false
  });


// 线上环境配置
/*fis.media('production')
  .match('**',    domain: ol_cdn
  })
  .match('*.tpl', {
    useHash: false
  })
  .match('*.js', {
    deploy: fis.plugin('local-deliver', {
      to: ol_root + APP + '/is'
    }),    optimizer: fis.plugin('uglify-js'),    url: ol_url + '/js$0'
  })
  .match('*.css', {
      to: ol_root + APP + '/css'
    }),    optimizer: fis.plugin('clean-css'),    url: ol_url + '/css$0'
  })

  .match('*.{png,gif}', {
      to: ol_root + APP + '/image'
    }),    optimizer: fis.plugin('png-compressor'),    url: ol_url + '/image$0',  });
*/

三、在本地进入项目目录执行命令(项目将会同步到指定服务器位置本地由于更改会自动同步)


 fis3 release qa -w

四、注意本地必须有nodejs环境

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐