Skip to content

Commit 30a7490

Browse files
committed
Merge remote-tracking branch 'origin/devel' into docs/lldb
2 parents 495aa7a + 0657ca7 commit 30a7490

File tree

18 files changed

+220
-44
lines changed

18 files changed

+220
-44
lines changed

.Rprofile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,27 @@
99
# .libPaths() already includes site library for default R version.
1010
.libPaths(c(.libPaths(), .Library.site))
1111

12+
# Source initialization script for VSCode R extension
13+
source("~/.vscode-R/init.R")
14+
.First.sys()
15+
16+
# The remotes package is installed to install httpgd from GitHub
17+
# The gdiff package is installed to support visual difference testing
18+
19+
# Configure r-universe for binary package installations dynamically
20+
linux_binary_repo <- function(universe){
21+
runiverse <- sprintf('r-universe.dev/bin/linux/%s-%s/%s/',
22+
system2('lsb_release', '-sc', stdout = TRUE),
23+
R.version$arch,
24+
substr(getRversion(), 1, 3))
25+
sprintf('https://%s.%s', universe, runiverse)
26+
}
27+
28+
# Set repos for CRAN to use r-universe linux binaries
29+
options(repos = c(
30+
cran = linux_binary_repo("cran")
31+
))
32+
1233
# For PNG graphics uncomment following lines
1334
# options(vsc.use_httpgd = FALSE,
1435
# vsc.dev.args = list(width = 800, height = 600))

.devcontainer/devcontainer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"name": "R-Dev-Env",
33
"image": "ghcr.io/r-devel/r-dev-env:devel",
4+
"runArgs": ["--cap-add=SYS_PTRACE"],
5+
"remoteUser": "vscode",
46
"hostRequirements": {
57
"cpus": 4
68
},
@@ -9,7 +11,6 @@
911
"settings": {
1012
"git.ignoredRepositories": ["."],
1113
"files.exclude": {
12-
"**/.vscode": true,
1314
"**/.devcontainer": true,
1415
"**/.git": true,
1516
"**/.github": true,
@@ -43,9 +44,10 @@
4344
"johnstoncode.svn-scm",
4445
"ms-vscode.cpptools",
4546
"MS-vsliveshare.vsliveshare",
46-
"natqe.reload"
47+
"natqe.reload",
48+
"vadimcn.vscode-lldb"
4749
]
4850
}
4951
},
50-
"postCreateCommand": "find . -wholename '*.git*' -type d -prune -o -type f -exec chown vscode:vscode {} \\; && sh /workspaces/r-dev-env/scripts/localscript.sh"
52+
"postCreateCommand": "bash ./scripts/localscript.sh"
5153
}

.devcontainer/launch.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "(lldb) Attach to R",
6+
"type": "lldb",
7+
"request": "attach",
8+
"pid": "${command:pickMyProcess}",
9+
"stopOnEntry": false
10+
}
11+
]
12+
}

.gitignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
R-4.1.3/
2-
R-4.1.3.tar.gz
3-
R-devel/
4-
R-devel.tar.gz
1+
/build
2+
/svn
53
/venv
64
.cache/
7-
.Rproj.user
85
.vscode/
6+
.Rhistory
7+
.Rproj.user
8+
*.Rproj
9+
*/allow_ptrace

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ RUN sed -i.bak "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list \
88
software-properties-common \
99
subversion \
1010
libmagick++-dev \
11+
libpoppler-cpp-dev \
1112
&& add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0" \
1213
&& wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc \
1314
&& apt-get update \
@@ -22,11 +23,14 @@ RUN Rscript -e "runiverse <- sprintf('r-universe.dev/bin/linux/%s-%s/%s/', \
2223
R.version\$arch, \
2324
substr(getRversion(), 1, 3)); \
2425
print('Installing packages...'); \
25-
install.packages(c('languageserver', 'httpgd'), \
26-
repos = c(runiverse = paste0('https://cran.', runiverse), \
27-
nx10 = paste0('https://nx10.', runiverse))); \
26+
install.packages(c('languageserver', 'gdiff', 'remotes'), \
27+
repos = c(runiverse = paste0('https://cran.', runiverse))); \
28+
print('Installing httpgd from GitHub...'); \
29+
remotes::install_github('nx10/httpgd'); \
2830
print('Packages installed.')"
2931

3032
# Define env var used in GitHub Actions that build and deploy container
3133
ARG CONTAINER_VERSION
3234
ENV CONTAINER_VERSION=${CONTAINER_VERSION}
35+
36+
USER vscode

INIT

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/assets/rdev3_5.png

735 KB
Loading

docs/container_setup/github_codespace/creating_codespace.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,32 @@ GitHub Codespaces' button and then click the green 'Create Codespace' button.
2020

2121
3. You will be taken to a VS Code editor within your browser.
2222
![codespace](../../assets/rdev3.png)
23+
24+
4. Rename your codespace and manage auto-delete for easier identification and to
25+
prevent accidental removal:
26+
27+
By default, your codespace will have a randomly generated name. Renaming it to
28+
something descriptive — such as referencing the issue or feature you’re working
29+
on makes it much easier to manage your codespaces. You can also disable
30+
auto-delete to ensure your codespace isn't removed unexpectedly:
31+
32+
- Open your [GitHub Codespaces dashboard](https://github.com/codespaces)
33+
(<https://github.com/codespaces>) in your browser.
34+
- Find the codespace you just created (it will show the repository name and
35+
the current random display name).
36+
- A: Click the ellipsis (**...**) next to your codespace to open the
37+
options menu.
38+
- B: Select **Rename** from the dropdown.
39+
- Enter a descriptive new display name, e.g.,
40+
`Bug 7084 - text() recycling problems` or
41+
`Ignore deprecated/defunct fns in checkS3methods`, and confirm.
42+
- C: In the same options menu, click on **Auto-delete codespace** to toggle
43+
off auto-delete (remove the check mark). This will prevent the
44+
codespace from being deleted automatically.
45+
46+
![rename codespace](../../assets/rdev3_5.png)
47+
48+
!!! Tip
49+
50+
You can rename your codespace at any time. The display name is
51+
for your convenience and **does not** affect your code or environment.
Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,75 @@
1-
!!! note Local setup is not recommended on macOS or Windows as the Docker
1+
!!! note
2+
Local setup is not recommended on macOS or Windows as the Docker
23
container will work via a Virtual Machine and building R will take far
34
longer (e.g. a full build may take 1 hour vs 10 minutes!).
45

56
We can also use this codespace locally. For that we need to have some
67
prerequisites installed.
78

8-
#### > Prerequisites
9+
#### Prerequisites
910

1011
1. Docker Engine or Docker Desktop. You can find the docker desktop install
1112
instructions on [Docker Desktop
1213
Docs](https://www.docker.com/products/docker-desktop/).
1314
2. VSCode Editor. You can download and install from [VSCode
1415
website](https://code.visualstudio.com/download).
1516

16-
#### > Steps to run R Development Container locally
17+
#### Steps to run R Development Container locally
1718

1819
1. Clone the [R Dev Container Github
1920
repo](https://github.com/r-devel/r-dev-env/)
21+
2022
2. In a terminal, change directory to r-dev-env
2123

22-
```bash
23-
cd r-dev-env
24-
```
24+
```bash
25+
cd r-dev-env
26+
```
2527

2628
3. Restart VSCode in the `r-dev-env` directory with the command:
2729

28-
```bash
29-
code .
30-
```
30+
```bash
31+
code .
32+
```
3133

3234
4. Checkout the main branch and pull the latest changes
3335

34-
```bash
35-
git checkout main
36-
git pull
37-
```
36+
```bash
37+
git checkout main
38+
git pull
39+
```
3840

39-
The main branch provides the stable release. If you require an in-development
40-
feature, use the devel branch instead.
41+
The main branch provides the stable release. If you require an in-development
42+
feature, use the devel branch instead.
4143

4244
5. After this step please be sure that your docker engine is started. If you
4345
have installed Docker Desktop just open the Docker Desktop app the engine
4446
starts automatically and if you are using just docker engine make sure to
4547
start it with the following command
4648

47-
```bash
48-
systemctl start docker
49-
```
49+
```bash
50+
systemctl start docker
51+
```
5052

5153
6. We can see pop-up at the bottom right of the VSCode editor which says reopen
52-
in Dev Container. Click on `Reopen in DevContainer` button. ![start
53-
localsetup](../../assets/rdev13.png)
54+
in Dev Container.
55+
Click on `Reopen in Container` button.
56+
57+
![startlocalsetup](../../assets/rdev13.png)
5458

5559
7. After clicking on that button we will see our container is getting ready. It
5660
will take some time. So till that time you can have coffee :) ![start
5761
localsetup](../../assets/rdev24.png)
62+
5863
8. We can also test whether the dev container is working or not by just printing
59-
the environment variables mentioned in the welcome message on the terminal. And
60-
there we go!!! We have setup our R Dev Container locally. ![start
61-
localsetup](../../assets/rdev25.png)
64+
the environment variables mentioned in the welcome message on the terminal.
65+
66+
```console
67+
$ echo $BUILDDIR
68+
/workspaces/r-dev-env/bin/R
69+
```
70+
71+
And there we go!!! We have setup our R Dev Container locally. ![start
72+
localsetup](../../assets/rdev25.png)
6273

6374
9. The container will be closed when you close VSCode. To reopen the container,
6475
open the `r-dev-env` directory in VSCode.

docs/css/custom.css

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/* customise CSS for bash code chunks and bash sessions ("console") */
2+
3+
/* .gp = Generic Prompt (e.g., shell prompt like $ or >) */
4+
/* default: var(--md-code-hl-generic-color); */
5+
/* prompts treated as normal code in bash code chunks */
6+
.language-console.highlight code span.gp{
7+
color: #7aa2cd;
8+
}
9+
10+
/* .go = Generic output: output from a command */
11+
/* default: var(--md-code-hl-generic-color); */
12+
.language-console.highlight code span.go,
13+
.language-bash.highlight code span.go {
14+
color: var(--md-code-hl-generic-color);
15+
}
16+
17+
/* .nb = Built-in name like print, echo */
18+
/* default: var(--md-code-hl-constant-color); */
19+
.language-console.highlight code span.nb,
20+
.language-bash.highlight code span.nb {
21+
color: var(--md-code-hl-constant-color);
22+
}
23+
24+
/* .nv = Named variables like $BUILDDIR */
25+
/* default: var(--md-code-hl-variable-color); */
26+
/* use same as normal text: var(--md-code-fg-color); */
27+
.language-console.highlight code span.nv,
28+
.language-bash.highlight code span.nv {
29+
color: var(--md-code-fg-color);
30+
}
31+
32+
/* .c1 = Built-in name like print, echo */
33+
/* default: var(--md-code-hl-comment-color); */
34+
.language-console.highlight code span.c1,
35+
.language-bash.highlight code span.c1 {
36+
color: var(--md-code-hl-comment-color);
37+
}

0 commit comments

Comments
 (0)