forked from haghish/github
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitget.ado
102 lines (77 loc) · 2.8 KB
/
gitget.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
/***
_v. 1.2_
gitget
======
__gitget__ installs or updates a package from GitHub using the _packagename_ only.
this is an exploratory alternative to __github__ command.
Syntax
------
> __gitget__ _packagename_ [, stable version(_str_) ]
_options_
| _option_ | _Description_ |
|:------------------|:-------------------------------------------------------------------------|
| stable | installs the latest stable release. otherwise the main branch is installed |
| **v**erson(_str_) | specifies a particular stable version (release tags) for the installation |
Description
-----------
__github__ is a wrapper for [github install](help github) command. it uses the
__gitget.dta__ data set, which is installed with __github__ package to obtain
the _username/reponame_ of the package. if multiple packages with identical name
are found, the command describes them in a table without installing any module.
by default, the command installs the development version of a repository. if you
wish to install a stable release rather than the developmnt version, add the
__stable__ option or specify the version within the __version__ option.
Example
----------
installing markdoc package and its dependencies
. gitget markdoc
installing the latest stable version of markdoc package and its dependencies
. gitget markdoc, stable
Author
------
E. F. Haghish
University of Göttingen
- - -
This help file was dynamically produced by
[MarkDoc Literate Programming package](http://www.haghish.com/markdoc/)
***/
*cap prog drop gitget
program gitget
version 13
syntax anything [, stable version(str)]
// find the gitget dataset
// -----------------------------------------------------------------------
capture findfile gitget.dta, path("`c(sysdir_plus)'g/")
if _rc == 0 {
preserve
quietly use "`r(fn)'", clear
quietly keep if packagename == "`anything'"
if _N == 0 {
display as err "`anything' package is unknown. try: {stata github search `anything'}"
}
else if _N == 1 {
display as txt _n "{it:Installing `anything' ...}"
githuboutput
di as txt _n
local address = address[1]
local pathaddress = path[1]
local packagename = packagename[1]
tokenize "`pathaddress'", parse("/")
while "`2'" != "" {
local path "`path'`1'"
macro shift
}
noisily github install `address', `stable' version(`version') path(`path') package(`package')
}
else if _N > 1 {
display as txt "multiple Stata packages were found! "
quietly gsort -score
githuboutput
}
restore
}
else {
display as err "the {bf:gitget.dta} data set was not found!"
}
end