kopia lustrzana https://github.com/jupyterhub/repo2docker
Merge pull request #406 from gedankenstuecke/add_r_description
add R DESCRIPTION supportpull/418/head
commit
d2e69babf4
|
@ -96,6 +96,17 @@ We use ``apt.txt``, for example, to install LaTeX in our
|
||||||
`example apt.txt for LaTeX <https://github.com/binder-examples/latex/blob/master/apt.txt>`_.
|
`example apt.txt for LaTeX <https://github.com/binder-examples/latex/blob/master/apt.txt>`_.
|
||||||
|
|
||||||
|
|
||||||
|
``DESCRIPTION``
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
To install your repository like an R package, you may include a
|
||||||
|
``DESCRIPTION`` file. repo2docker installs the package and dependencies
|
||||||
|
from the ``DESCRIPTION`` by running ``devtools:install_git(".")``.
|
||||||
|
|
||||||
|
You also need to have a ``runtime.txt`` file that is formatted as
|
||||||
|
``r-<YYYY>-<MM>-<DD>``, where YYYY-MM-DD is a snapshot of MRAN that will be
|
||||||
|
used for your R installation.
|
||||||
|
|
||||||
.. _postBuild:
|
.. _postBuild:
|
||||||
|
|
||||||
``postBuild`` - Run code after installing the environment
|
``postBuild`` - Run code after installing the environment
|
||||||
|
|
|
@ -69,7 +69,16 @@ class RBuildPack(PythonBuildPack):
|
||||||
"""
|
"""
|
||||||
# If no date is found, then self.checkpoint_date will be False
|
# If no date is found, then self.checkpoint_date will be False
|
||||||
# Otherwise, it'll be a date object, which will evaluate to True
|
# Otherwise, it'll be a date object, which will evaluate to True
|
||||||
return bool(self.checkpoint_date)
|
if self.checkpoint_date:
|
||||||
|
return True
|
||||||
|
description_R = 'DESCRIPTION'
|
||||||
|
if not os.path.exists('binder') and os.path.exists(description_R):
|
||||||
|
if not self.checkpoint_date:
|
||||||
|
# no R snapshot date set through runtime.txt
|
||||||
|
# set the R runtime to the latest date that is guaranteed to be on MRAN across timezones
|
||||||
|
self._checkpoint_date = datetime.date.today() - datetime.timedelta(days=2)
|
||||||
|
self._runtime = "r-{}".format(str(self._checkpoint_date))
|
||||||
|
return True
|
||||||
|
|
||||||
def get_path(self):
|
def get_path(self):
|
||||||
"""
|
"""
|
||||||
|
@ -257,4 +266,13 @@ class RBuildPack(PythonBuildPack):
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
description_R = 'DESCRIPTION'
|
||||||
|
if not os.path.exists('binder') and os.path.exists(description_R):
|
||||||
|
assemble_scripts += [
|
||||||
|
(
|
||||||
|
"${NB_USER}",
|
||||||
|
'R --quiet -e "devtools::install_local(getwd())"'
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
return assemble_scripts
|
return assemble_scripts
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
Package: binderdescription
|
||||||
|
Version: 0.1
|
||||||
|
Date: 2018-09-18
|
||||||
|
Title: Binder R DESCRIPTION support
|
||||||
|
Description: Test that automatically building R packages works
|
||||||
|
Author: Bastian Greshake Tzovaras <bgreshake@googlemail.com>
|
||||||
|
Maintainer: Bastian Greshake Tzovaras <bgreshake@googlemail.com>
|
|
@ -0,0 +1,2 @@
|
||||||
|
# Export all names
|
||||||
|
exportPattern(".")
|
|
@ -0,0 +1,4 @@
|
||||||
|
print_something <- function()
|
||||||
|
{
|
||||||
|
print('blah');
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Test that `repo2docker` will build an R package
|
||||||
|
|
||||||
|
If a `DESCRIPTION` file is present along with an `R`-requiring `runtime.txt`
|
||||||
|
, repo2docker should build the R package that is in the repository.
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env Rscript
|
||||||
|
library('binderdescription')
|
Ładowanie…
Reference in New Issue