-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path_pkg.do
62 lines (47 loc) · 1.61 KB
/
_pkg.do
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
// Create packages for all files
// Set directory
global directory "/Users/bbdaniels/GitHub/stata"
cd "${directory}"
// Update submodules
!cd "${directory}"
!git submodule foreach --recursive git pull origin main
// Remove TOC
!rm "${directory}/stata.toc"
// Delete all packages and submission zips
!rm *.pkg
!rm *.zip
// Start writing new TOC
file close _all
file open toc using "${directory}/stata.toc" , write
file write toc "v 0.1" _n "d Benjamin Daniels" _n
// Find all adofiles in /src/
local adoFiles : dir `"${directory}/src/"' dirs "*"
// Write all adofiles into TOC and zip into packages
foreach file in `adoFiles' {
local ado : dir `"${directory}/src/`file'/"' files "*.ado"
local hlp : dir `"${directory}/src/`file'/"' files "*.sthlp"
file write toc "p `file' `file'" _n
file open `file' using "${directory}/`file'.pkg" , write
file write `file' "v 0.1" _n "d Benjamin Daniels" _n
local items ""
local zip ""
foreach item in `ado' `hlp' {
local items "`items' ${directory}/src/`file'/`item'"
file write `file' "f /pkg/`item'" _n
copy "${directory}/src/`file'/`item'" "${directory}/pkg/`item'" , replace
copy "${directory}/src/`file'/`item'" "${directory}/`item'" , replace
local zip "`zip' `item'"
}
file close `file'
!zip `file'.zip `zip'
copy "${directory}/`file'.zip" "${directory}/zip/`file'.zip" , replace
!rm `zip'
!rm `file'.zip
}
// Finish writing TOC
file close toc
// Close up repo
!git add -A
!git commit -m "Updated `c(current_date)' `c(current_time)'"
!git push origin
// All packed!