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}', { deploy: fis.plugin('http-push', { receiver: qa_tpl_receiver, to: qa_tpldir + '/test' }), url: '/test$0', useHash: false }); // 线上环境配置 /*fis.media('production') .match('**', { useHash: true, 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', { deploy: fis.plugin('local-deliver', { to: ol_root + APP + '/css' }), optimizer: fis.plugin('clean-css'), url: ol_url + '/css$0' }) .match('*.{png,jpg,gif}', { deploy: fis.plugin('local-deliver', { to: ol_root + APP + '/image' }), optimizer: fis.plugin('png-compressor'), url: ol_url + '/image$0', }); */
三、在本地进入项目目录执行命令(项目将会同步到指定服务器位置本地由于更改会自动同步)
fis3 release qa -w
四、注意本地必须有nodejs环境
本文由:xiaoshu168 作者:xiaoshu发表,转载请注明来源!