2019-12-23 13:22:06 +03:00
|
|
|
|
module main
|
|
|
|
|
|
2019-12-23 13:09:22 +03:00
|
|
|
|
import (
|
|
|
|
|
os
|
2020-02-20 19:41:55 +03:00
|
|
|
|
v.pref
|
2019-12-23 13:09:22 +03:00
|
|
|
|
)
|
2019-11-01 13:14:59 +03:00
|
|
|
|
|
|
|
|
|
fn main() {
|
2020-03-08 00:26:26 +03:00
|
|
|
|
vroot := os.dir(pref.vexe_path())
|
2019-11-01 13:14:59 +03:00
|
|
|
|
os.chdir(vroot)
|
2020-04-07 17:56:33 +03:00
|
|
|
|
|
|
|
|
|
println('Updating V...')
|
|
|
|
|
|
2020-02-20 19:41:55 +03:00
|
|
|
|
// git pull
|
2020-04-07 17:56:33 +03:00
|
|
|
|
git_result := os.exec('git pull --rebase origin master') or {
|
2020-02-20 19:41:55 +03:00
|
|
|
|
panic(err)
|
|
|
|
|
}
|
2020-04-07 17:56:33 +03:00
|
|
|
|
|
|
|
|
|
if git_result.exit_code != 0 {
|
|
|
|
|
if git_result.output.contains('Permission denied') {
|
|
|
|
|
eprintln('have no access ‘$vroot: Permission denied')
|
|
|
|
|
} else {
|
|
|
|
|
eprintln(git_result.output)
|
|
|
|
|
}
|
|
|
|
|
exit(1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
println(git_result.output)
|
2020-02-20 19:41:55 +03:00
|
|
|
|
|
2019-11-01 13:14:59 +03:00
|
|
|
|
$if windows {
|
2020-02-20 19:41:55 +03:00
|
|
|
|
v_backup_file := 'v_old.exe'
|
|
|
|
|
if os.exists(v_backup_file) {
|
|
|
|
|
os.rm(v_backup_file)
|
|
|
|
|
}
|
|
|
|
|
os.mv('v.exe', v_backup_file)
|
2020-03-08 00:26:26 +03:00
|
|
|
|
|
2020-04-07 17:56:33 +03:00
|
|
|
|
make_result := os.exec('make.bat') or {
|
2020-02-20 19:41:55 +03:00
|
|
|
|
panic(err)
|
2019-11-01 13:14:59 +03:00
|
|
|
|
}
|
2020-04-07 17:56:33 +03:00
|
|
|
|
println(make_result.output)
|
2019-11-01 13:14:59 +03:00
|
|
|
|
} $else {
|
2020-04-07 17:56:33 +03:00
|
|
|
|
make_result := os.exec('make') or {
|
2020-02-20 19:41:55 +03:00
|
|
|
|
panic(err)
|
|
|
|
|
}
|
2020-04-07 17:56:33 +03:00
|
|
|
|
println(make_result.output)
|
2019-11-01 13:14:59 +03:00
|
|
|
|
}
|
|
|
|
|
}
|