|
3 | 3 | import os |
4 | 4 | import term |
5 | 5 |
|
6 | | -const server = 'gitly' |
| 6 | +const server = 'gitly' |
7 | 7 | const remote_path = '/var/www/gitly' |
8 | 8 |
|
9 | 9 | fn main() { |
10 | | - println('Step 1: Syncing files...') |
11 | | - // -a: archive mode (preserves permissions, recursive, etc.) |
12 | | - // -v: verbose |
13 | | - // -z: compress |
14 | | - exec_safe('rsync -avz src translations ${server}:${remote_path}/') |
15 | | - |
16 | | - println('\nStep 2: Remote compilation and restart...') |
17 | | - remote_cmds := [ |
18 | | - 'cd $remote_path', |
19 | | - '/root/v2/v -d new_veb -d use_openssl .', |
20 | | - 'sudo systemctl restart gitly' |
21 | | - ].join(' && ') |
22 | | - |
23 | | - println('ssh $server "$remote_cmds"') |
24 | | - exec_safe('ssh $server "$remote_cmds"') |
25 | | - |
26 | | - println(term.green('\nDeployment successful!')) |
| 10 | + println('Step 1: Syncing files...') |
| 11 | + // -a: archive mode (preserves permissions, recursive, etc.) |
| 12 | + // -v: verbose |
| 13 | + // -z: compress |
| 14 | + exec_safe('rsync -avz src translations ${server}:${remote_path}/') |
| 15 | + |
| 16 | + println('\nStep 2: Remote compilation and restart...') |
| 17 | + remote_cmds := [ |
| 18 | + 'cd ${remote_path}', |
| 19 | + '/root/v2/v -keepc -d trace_pg_error -d new_veb -d use_openssl .', |
| 20 | + 'sudo systemctl restart gitly', |
| 21 | + ].join(' && ') |
| 22 | + |
| 23 | + println('ssh ${server} "${remote_cmds}"') |
| 24 | + exec_safe('ssh ${server} "${remote_cmds}"') |
| 25 | + |
| 26 | + println(term.green('\nDeployment successful!')) |
27 | 27 | } |
28 | 28 |
|
29 | 29 | fn exec_safe(cmd string) { |
30 | | - // os.system streams output directly to stdout/stderr, |
31 | | - // which is better for seeing rsync progress and compiler errors. |
32 | | - if os.system(cmd) != 0 { |
33 | | - eprintln(term.red('\n Error executing command.')) |
34 | | - exit(1) |
35 | | - } |
| 30 | + // os.system streams output directly to stdout/stderr, |
| 31 | + // which is better for seeing rsync progress and compiler errors. |
| 32 | + if os.system(cmd) != 0 { |
| 33 | + eprintln(term.red('\n Error executing command.')) |
| 34 | + exit(1) |
| 35 | + } |
36 | 36 | } |
37 | | - |
0 commit comments