-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathgithublistpack.ado
121 lines (89 loc) · 3.9 KB
/
githublistpack.ado
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/***
_v. 1.0.0_
githublistpack
==============
mines the GitHub API for Stata repositories
Syntax
------
> __githublistpack__ [ _keyword_ ] [, _options_ ]
### Options
| _option_ | _Description_ |
|:--------------|:-------------------------------------------------------------------------|
| language(_str_) | specifies the programming language of the repository. the default is __Stata__ |
| in(_str_) | specifies the domain of the search which can be __name__, __description__, __readme__, or __all__ |
| all | shows repositories that lack the __pkg__ and __stata.toc__ files in the search results |
| duration(_num_) | search time frame in number of days. the default is __1__ |
| delay | number of miliseconds to let the API rest after each search. the default is 10000 ms |
| save | saves the search results in a data set |
| replace | replaces existing data set |
| append | appends results to an existing data set |
| created(_str_) | initial date for beginning of the search |
| pushed(_str_) | initial pushing date of the repository, which is useful for updating the archive |
| reference(_str_) | initial date. if missing, it is set to __"2012.01.01"__ |
| perpage(_num_) | maximum number of returned results (check GitHub API limits) |
| quite | avoids output log |
| debug | detailed output log |
Description
-----------
__githublistpack__ searches for repositories on GitHub within
a limited time frame (i.e. _duration_). It can save and update
the results in a data set. It also provides options for
narrowing down or expanding the search.
Examples
--------
### examples of mining Stata packages on packages
list all GitHub repositories in Stata language
. githublistpack , language(Stata) append replace ///
save("repolist") duration(1) all in(all) ///
perpage(100)
search for repositories created from 2019 on
. githublistpack , language(Stata) append replace ///
save("update") duration(1) all in(all) ///
reference("2019-01-01") perpage(100)
Author
------
E. F. Haghish
Department of Mathematics and Computer Science (IMADA)
University of Southern Denmark
- - -
This help file was dynamically produced by
[MarkDoc Literate Programming package](http://www.haghish.com/markdoc/)
***/
*capture prog drop githublistpack
prog githublistpack
syntax [anything] [, language(str) in(str) all save(str) created(str) ///
pushed(str) reference(str) stopdate(str) duration(numlist max=1) ///
perpage(numlist max=1) delay(numlist max=1) replace append quiet debug]
if missing("`stopdate'") {
local stopdate: display date(c(current_date), "DMY")
}
// Packages before 2012
// ======================================================================
if missing("`reference'") {
local reference "2012-01-01"
if missing("`quiet'") display "<2012-01-01"
githubsearch `anything', created("<2012-01-01") language(`language') ///
in(`in') `all' save("`save'") append quiet scoreless `quiet' `debug' ///
perpage(`perpage')
}
// Packages after the reference (default is 2012-01-01)
// ======================================================================
githubsearchsteps `anything', reference("`reference'") duration(`duration') ///
language(`language') in(`in') `all' save("`save'") append `quiet' `debug' ///
delay(`delay')
preserve
// Generate score
// ======================================================================
if !missing(`"`save'"') {
use "`save'", clear
qui label data "updated on `c(current_date)'"
qui save `"`save'"', replace
}
// -----------------------------------------------------------------------
// Drawing the output table
// =======================================================================
if missing("`quiet'") {
githuboutput `anything', in("`in'") `all' quiet
}
restore
end