-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathci.red
84 lines (63 loc) · 1.87 KB
/
ci.red
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Red [
Title: "ci.red"
]
;--- boot start initialize directory
initial-directory: copy []
if empty? initial-directory [
if error? try [
folder: pick split-path system/options/script 1
][
folder: what-dir
]
either not none? folder [
append initial-directory folder
][
append initial-directory what-dir
]
]
;--- boot end initialize directory
do http://redlang.red/do-trace
;--- start boot to initialize script folder
if not value? 'get-parent-folder [
if error? try [
do https://redlang.red/get-folder
print [{loaded} https://redlang.red/get-folder]
][
print [{internet connection error}]
if error? try [
do %libs/get-folder
][
print [{cannot load} {lib/get-folder}]
]
]
]
;--- end boot to initialize script folder ---
script: system/options/script
script-folder: get-parent-folder script
local-domain-path: rejoin [{C:\rebol\.system.user\.data\.activities\} local-domain-subfolder]
local-github-path: rejoin [local-domain-path github-subfolder]
splitted-script: split (get-short-filename script) "."
iteration-number: pick splitted-script 2
splitted-filename: split form short-filename "."
filename: (pick splitted-filename 1)
extension: (pick splitted-filename 2)
updated-file: rejoin [
filename
{.} iteration-number {.}
extension
]
.message: rejoin [
updated-file
{ } {build.iteration: } build-number {.} iteration-number
]
;--- copy file ---
do https://redlang.red/copy-files
copy-file/force source-file: rejoin [script-folder updated-file]
target-file: to-red-file rejoin [local-github-path short-filename]
;--- commit ---
do https://quickrun.red/git-commit
do https://redlang.red/cd ; weird cd exists already git-commit but it generates error
cd (local-domain-path)
commit (.message)
cd (local-github-path)
commit (.message)