Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
rglow
friendlyr
Commits
a9d1f36a
Commit
a9d1f36a
authored
Aug 14, 2020
by
Jean-Marie Lepioufle
Browse files
typo
parent
d55df622
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/install
_friendlyr
.R
→
lib/install.R
View file @
a9d1f36a
...
...
@@ -3,14 +3,14 @@
# Jean-Marie Lepioufle
# NILU - nilu.no
# 2020-08-14
# install
friendlyr
# install
'install
_friendlyr
'install
Usage:
install
_friendlyr.R -
branch <branch>
-rpath <rpath
>
install
_friendlyr
.R (-h | --help)
install
_friendlyr
.R --version
install
.R pkg <pkg>
branch <branch>
dir <dir
>
install.R (-h | --help)
install.R --version
Options:
-h --help Show this screen.
...
...
@@ -23,11 +23,17 @@ Outcomes:
#library(docopt)
arguments
<-
docopt
::
docopt
(
doc
,
version
=
'install
_friendlyr
version 0.0.1'
)
arguments
<-
docopt
::
docopt
(
doc
,
version
=
'install version 0.0.1'
)
cat
(
"Initialising parameters... \n"
)
# arguments
pkg
<-
tryCatch
({
res
<-
as.character
(
arguments
$
pkg
)
res
},
error
=
function
(
err
)
{
print
(
paste
(
"Error in argument 'pkg': "
,
err
))
print
(
"It will crash."
)
})
# init parameters
branch
<-
tryCatch
({
res
<-
as.character
(
arguments
$
branch
)
res
...
...
@@ -36,16 +42,14 @@ branch <- tryCatch({
print
(
"It will crash."
)
})
# get path
rpath
<-
tryCatch
({
res
<-
normalizePath
(
file.path
(
as.character
(
arguments
$
rpath
)),
mustWork
=
FALSE
)
dir
<-
tryCatch
({
res
<-
normalizePath
(
file.path
(
as.character
(
arguments
$
dir
)),
mustWork
=
FALSE
)
res
},
error
=
function
(
err
)
{
print
(
paste
(
"Error in argument '
rpath
': "
,
err
))
print
(
paste
(
"Error in argument '
dir
': "
,
err
))
print
(
"It will crash."
)
})
cat
(
"Installation... \n"
)
# install pkg
wd
<-
dirname
(
dirname
(
getwd
()))
# install friendlyr
install.packages
(
file.path
(
rpath
,
paste0
(
'friendlyr_'
,
branch
,
'.tar.gz'
)),
repos
=
NULL
,
type
=
'source'
)
install.packages
(
file.path
(
dir
,
paste0
(
pkg
,
'-'
,
branch
,
'.tar.gz'
)),
repos
=
NULL
,
type
=
'source'
)
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