Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
N
node-bigstream
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bs
node-bigstream
Commits
b9bda805
Commit
b9bda805
authored
Sep 18, 2019
by
Krit Punpreuk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add get plugin from repo url
parent
ec467260
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
get_plugin.js
script/get_plugin.js
+76
-0
No files found.
script/get_plugin.js
0 → 100644
View file @
b9bda805
#!/usr/bin/env node
var
Git
=
require
(
"nodegit"
);
var
fs
=
require
(
'fs'
);
var
temppath
=
"tmp"
const
bspath
=
"../plugins/"
/*
remove file script https://stackoverflow.com/a/32197381
*/
var
deleteFolderRecursive
=
function
(
path
)
{
if
(
fs
.
existsSync
(
path
))
{
fs
.
readdirSync
(
path
).
forEach
(
function
(
file
,
index
){
var
curPath
=
path
+
"/"
+
file
;
if
(
fs
.
lstatSync
(
curPath
).
isDirectory
())
{
// recurse
deleteFolderRecursive
(
curPath
);
}
else
{
// delete file
//console.log("remove file"+curPath)
fs
.
unlinkSync
(
curPath
);
}
});
fs
.
rmdirSync
(
path
);
}
};
console
.
log
(
"BigStream plugin installer version 1.0"
)
console
.
log
(
"**This script version support install from github repository only.**"
)
var
args
=
process
.
argv
.
slice
(
2
);
if
(
args
.
length
==
0
)
{
console
.
log
(
"Missing git repository url"
)
}
else
{
let
url
=
args
[
0
]
// Remove any old tmp if exists
deleteFolderRecursive
(
temppath
);
console
.
log
(
"start git clone "
+
url
)
Git
.
Clone
(
url
,
temppath
)
.
then
((
repo
)
=>
{
var
profile
=
require
(
'./tmp/profile.json'
);
var
plugin_type
=
profile
.
type
var
plugin_name
=
profile
.
name
if
(
!
plugin_type
||
!
plugin_name
)
{
console
.
log
(
"plugin profile not valid format."
)
console
.
log
(
profile
);
deleteFolderRecursive
(
temppath
);
return
}
var
fdname
=
plugin_type
+
"-"
+
plugin_name
// If already have plugin stop it
if
(
fs
.
existsSync
(
bspath
+
plugin_type
+
'/'
+
fdname
))
{
console
.
log
(
"Found plugin already exists in "
+
bspath
+
plugin_type
+
'/'
+
fdname
)
console
.
log
(
"Exit"
)
deleteFolderRecursive
(
temppath
);
return
}
console
.
log
(
"copy to plugins directory"
)
fs
.
renameSync
(
temppath
,
bspath
+
plugin_type
+
'/'
+
fdname
);
// Auto call update script
console
.
log
(
"run plugin installer script"
)
var
auto_install
=
require
(
"./install_plugins"
)
//console.log(profile);
return
;
})
.
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment