FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/install.js at bc4d4e049aef7fa080608390b74cf8601ec2bb72 · nodegit/nodegit · GitHub
nodegit
nodegit
Repository navigation
Code
Issues
344
(344)
Pull requests
23
(23)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
install.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
114 lines (104 loc) · 3.44 KB
Breadcrumbs
nodegit
/
install.js
Copy path
File metadata and controls
114 lines (104 loc) · 3.44 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
var
async
=
require
(
'async'
)
,
child_process
=
require
(
'child_process'
)
,
spawn
=
child_process
.
spawn
,
path
=
require
(
'path'
)
,
fs
=
require
(
'fs'
)
,
request
=
require
(
'request'
)
,
AdmZip
=
require
(
'adm-zip'
)
;
function
passthru
(
)
{
var
args
=
Array
.
prototype
.
slice
.
call
(
arguments
)
;
var
cb
=
args
.
splice
(
-
1
)
[
0
]
;
var
cmd
=
args
.
splice
(
0
,
1
)
[
0
]
;
var
opts
=
{
}
;
if
(
typeof
(
args
.
slice
(
-
1
)
[
0
]
)
===
'object'
)
{
opts
=
args
.
splice
(
-
1
)
[
0
]
;
}
var
child
=
spawn
(
cmd
,
args
,
opts
)
;
child
.
stdout
.
pipe
(
process
.
stdout
)
;
child
.
stderr
.
pipe
(
process
.
stderr
)
;
child
.
on
(
'exit'
,
cb
)
;
}
function
shpassthru
(
)
{
var
cmd
=
passthru
.
apply
(
null
,
[
'/bin/sh'
,
'-c'
]
.
concat
(
Array
.
prototype
.
slice
.
call
(
arguments
)
)
)
;
}
function
envpassthru
(
)
{
passthru
.
apply
(
null
,
[
'/usr/bin/env'
]
.
concat
(
Array
.
prototype
.
slice
.
call
(
arguments
)
)
)
;
}
var
updateSubmodules
=
function
(
mainCallback
)
{
console
.
log
(
'[nodegit] Downloading libgit2 dependency.'
)
;
async
.
series
(
[
function
(
callback
)
{
envpassthru
(
'git'
,
'submodule'
,
'init'
,
callback
)
;
}
,
function
(
callback
)
{
envpassthru
(
'git'
,
'submodule'
,
'update'
,
callback
)
;
}
]
,
function
(
error
)
{
if
(
error
)
process
.
exit
(
error
)
;
mainCallback
(
)
;
}
)
;
}
;
var
checkoutDependencies
=
function
(
mainCallback
)
{
console
.
log
(
'[nodegit] Downloading libgit2 dependency.'
)
;
var
libgit2ZipUrl
=
'https://github.com/libgit2/libgit2/archive/v0.17.0.zip'
;
zipFile
=
__dirname
+
'/vendor/libgit2.zip'
,
unzippedFolderName
=
__dirname
+
'/vendor/libgit2-0.17.0'
,
targetFolderName
=
__dirname
+
'/vendor/libgit2'
;
async
.
series
(
[
function
(
callback
)
{
request
(
libgit2ZipUrl
)
.
pipe
(
fs
.
createWriteStream
(
zipFile
)
)
.
on
(
'close'
,
function
(
)
{
callback
(
)
;
}
)
;
}
,
function
(
callback
)
{
var
zip
=
new
AdmZip
(
zipFile
)
;
zip
.
extractAllTo
(
__dirname
+
'/vendor/'
,
true
)
;
fs
.
unlink
(
zipFile
)
;
callback
(
)
;
}
,
function
renameLibgit2Folder
(
callback
)
{
fs
.
rename
(
unzippedFolderName
,
targetFolderName
,
callback
)
;
}
]
,
function
(
error
)
{
if
(
error
)
process
.
exit
(
error
)
;
mainCallback
(
)
;
}
)
;
}
;
var
buildDir
=
path
.
join
(
__dirname
,
'vendor/libgit2/build'
)
;
async
.
series
(
[
function
(
callback
)
{
// Check for presence of .git folder
fs
.
exists
(
__dirname
+
'/.git'
,
function
(
exists
)
{
if
(
exists
)
{
updateSubmodules
(
callback
)
;
}
else
{
checkoutDependencies
(
callback
)
;
}
}
)
;
}
,
function
(
callback
)
{
console
.
log
(
'[nodegit] Building libgit2 dependency.'
)
;
envpassthru
(
'mkdir'
,
'-p'
,
buildDir
,
callback
)
;
}
,
function
(
callback
)
{
envpassthru
(
'cmake'
,
'-DTHREADSAFE=1'
,
'-DBUILD_CLAR=0'
,
'..'
,
{
cwd
:
buildDir
}
,
callback
)
;
}
,
function
(
callback
)
{
envpassthru
(
'cmake'
,
'--build'
,
'.'
,
{
cwd
:
buildDir
}
,
callback
)
;
}
,
function
(
callback
)
{
console
.
log
(
'[nodegit] Building native module.'
)
;
// shpassthru('node-gyp configure --debug', callback);
shpassthru
(
'node-gyp configure'
,
callback
)
;
}
,
function
(
callback
)
{
shpassthru
(
'node-gyp build'
,
callback
)
;
}
]
,
function
(
err
)
{
if
(
err
)
process
.
exit
(
err
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL