fis php,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}', {

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环境

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值