1 Star 0 Fork 14

smalltsky/axe.store

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
update.gua 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
axe-store 提交于 2020-07-11 15:11 . 优化 exec 完成
const importUtil = import("util")
const importPath = import("path")
const versionLocal = function() {
const metaBin = importPath.pathMetaBin()
const versionFile = '{}/{}'.format(metaBin, 'version')
if (importUtil.guaFileExist(versionFile)) {
const c = 'cat {}'.format(versionFile)
const r = importUtil.call(c)
return importUtil.guaStringToInt(r)
} else {
return 0
}
}
const versionRemote = function() {
const c = 'curl https://gitee.com/kuaibiancheng/store/raw/master/version'
const r = importUtil.call(c)
var version = importUtil.guaStringToInt(r)
return version
}
const checkVersion = function() {
const l = versionLocal()
const r = versionRemote()
const isOldVersion = r > l
return isOldVersion
}
const replaceMeta = function() {
// 先把代码下载下来到临时目录
// 复制代码到 meta bin
// 删除临时目录
const pathTmp = '{}/tmp_repo'.format(importPath.pathHome())
const repoUrl = 'https://gitee.com/kuaibiancheng/store'
const commandGit = 'git clone --depth=1 {} {}'.format(repoUrl, pathTmp)
importUtil.call(commandGit)
const pathMetaBin = importPath.pathMetaBin()
const commandCp = 'cp -r {}/* {}'.format(pathTmp, pathMetaBin)
importUtil.call(commandCp)
updateGualang(pathTmp)
importUtil.guaFileRm(pathTmp)
}
const updateGualang = function(repoPath) {
const c1 = 'cp {}/gualang/* /usr/local/axe/meta'.format(repoPath)
const c2 = "chmod +x /usr/local/axe/meta/gualang"
importUtil.callWithoutOutput(c1)
importUtil.callWithoutOutput(c2)
}
const clear = function() {
const pathOutput = importPath.pathAsyncOutput()
importUtil.guaFileRm(pathOutput)
}
const updateStore = function() {
clear()
const isOldVersion = checkVersion()
if (isOldVersion) {
replaceMeta()
return true
} else {
return false
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/smalltskyKepler/store.git
git@gitee.com:smalltskyKepler/store.git
smalltskyKepler
store
axe.store
master

搜索帮助