|
1 | | -# Installing R, Carpentries packages, and previewing Sandpaper in multi OS (Linux, Windows and Mac) |
2 | | - |
3 | | -## Steps in Ubuntu 22.04 x64 |
4 | | -1. Create new repo: https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course |
5 | | -2. Clone repo `git clone https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course` |
6 | | -3. install R (if you haven't done already) [:link:](https://cran.r-project.org/bin/linux/ubuntu/) |
7 | | -``` |
8 | | -sudo apt-get install r-cran-xml |
9 | | -sudo apt-get install libxml2-dev |
10 | | -sudo apt install libgit2-dev |
11 | | -sudo apt install r-cran-curl |
12 | | -
|
13 | | -``` |
14 | | -4. Open R and run the following to install dependencies |
15 | | -``` |
16 | | -options(repos = c( |
17 | | - carpentries = "https://carpentries.r-universe.dev/", |
18 | | - CRAN = "https://cran.rstudio.com/" |
19 | | -)) |
20 | | -install.packages(c("remotes"), dep =TRUE) |
21 | | -``` |
22 | | - |
23 | | -5. In R, run |
24 | | -``` |
25 | | -remotes::install_github("HealthBioscienceIDEAS/sandpaper", dependencies = TRUE) |
26 | | -# this one is taking some 20mins the fist time as it seems is building various packages |
27 | | -# Terminal logs |
28 | | -Downloading GitHub repo HealthBioscienceIDEAS/sandpaper@HEAD |
29 | | -These packages have more recent versions available. |
30 | | -It is recommended to update all of them. |
31 | | -Which would you like to update? |
32 | | -
|
33 | | -1: All |
34 | | -2: CRAN packages only |
35 | | -3: None |
36 | | -4: pegboard (0.7.5 -> a32a7836d...) [GitHub] |
37 | | -5: varnish (1.0.2 -> 56d594d27...) [GitHub] |
38 | | -6: curl (4.3.2 -> 5.2.1 ) [CRAN] |
39 | | -7: httr (1.4.2 -> 1.4.7 ) [CRAN] |
40 | | -8: gh (1.3.0 -> 1.4.1 ) [CRAN] |
41 | | -9: covr (3.5.1 -> 3.6.4 ) [CRAN] |
42 | | -
|
43 | | -Enter one or more numbers, or an empty line to skip updates: 1 |
44 | | -
|
45 | | -The downloaded source packages are in |
46 | | - ‘/tmp/Rtmpn94NAu/downloaded_packages’ |
47 | | -Downloading GitHub repo carpentries/pegboard@HEAD |
48 | | -These packages have more recent versions available. |
49 | | -It is recommended to update all of them. |
50 | | -Which would you like to update? |
51 | | -
|
52 | | -1: All |
53 | | -2: CRAN packages only |
54 | | -3: None |
55 | | -4: tinkr (0.2.0.9000 -> be564d524...) [GitHub] |
56 | | -
|
57 | | -Enter one or more numbers, or an empty line to skip updates: 1 |
58 | | -
|
59 | | -── R CMD build ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
60 | | -✔ checking for file ‘/tmp/Rtmpn94NAu/remotes50ddb31b7ca85/HealthBioscienceIDEAS-sandpaper-fb14e02/DESCRIPTION’ ... |
61 | | -─ preparing ‘sandpaper’: |
62 | | -✔ checking DESCRIPTION meta-information ... |
63 | | -─ checking for LF line-endings in source and make files and shell scripts (420ms) |
64 | | -─ checking for empty or unneeded directories |
65 | | - Omitted ‘LazyData’ from DESCRIPTION |
66 | | -─ building ‘sandpaper_0.16.4.tar.gz’ |
| 1 | +# How to setup local previews of the Workbench website |
| 2 | + |
| 3 | +## Installing requirements |
| 4 | +### Windows/Mac |
| 5 | +1. If R is not already installed, install R using the following: |
| 6 | + * [Windows](https://cran.r-project.org/bin/windows/base/) and use the default settings during the installation of **RGUi 4.x.x** |
| 7 | + * [Mac](https://cran.r-project.org/bin/macosx/) |
| 8 | +1. **Optional, but recommended** Download [RStudio Desktop](https://posit.co/download/rstudio-desktop/) |
| 9 | +1. **For Mac only** Before installing Varnish and Sandpaper, there are some |
| 10 | +additional packages that will need to be installed. The easiest way is via |
| 11 | +[Homebrew](https://brew.sh/): |
| 12 | + ```bash |
| 13 | + brew install freetype fribidi harfbuzz libpng libgit2 |
| 14 | + ``` |
| 15 | +1. Open RStudio and run the following lines of code to install the sandpaper package. |
| 16 | + ```r |
| 17 | + options(repos = c( |
| 18 | + carpentries = "https://carpentries.r-universe.dev/", |
| 19 | + CRAN = "https://cran.rstudio.com/" |
| 20 | + )) |
| 21 | + install.packages("sandpaper", dep = TRUE) |
| 22 | + ``` |
| 23 | + You can find further instructions on the |
| 24 | +[Carpentries Workbench documentation](https://carpentries.github.io/sandpaper-docs/index.html) |
| 25 | +1. Enter the following command to install the local version of varnish. This |
| 26 | +version is needed to incorporate the IDEAS identity for the site. |
| 27 | + ```r |
| 28 | + install.packages("remotes") |
| 29 | + remotes::install_github("HealthBioscienceIDEAS/varnish", dependencies = TRUE) |
| 30 | + ``` |
| 31 | +1. Go to the section on [previewing the website](#previewing-episodes) |
| 32 | + |
| 33 | +### Linux |
| 34 | +This installation was performed using Ubuntu 22.04 x64 |
| 35 | + |
| 36 | +1. install R (if you haven't done already) from [CRAN](https://cran.r-project.org/bin/linux/ubuntu/) |
| 37 | + ```bash |
| 38 | + sudo apt-get install r-cran-xml |
| 39 | + sudo apt-get install libxml2-dev |
| 40 | + sudo apt install libgit2-dev |
| 41 | + sudo apt install r-cran-curl |
| 42 | + ``` |
| 43 | +1. OPen R and install the sandpaper package. |
| 44 | + ```r |
| 45 | + options(repos = c( |
| 46 | + carpentries = "https://carpentries.r-universe.dev/", |
| 47 | + CRAN = "https://cran.rstudio.com/" |
| 48 | + )) |
| 49 | + install.packages("sandpaper", dep = TRUE) |
| 50 | + ``` |
| 51 | +1. Install the local IDEAS fork of the varnish repository |
| 52 | + ```r |
| 53 | + install.packages("remotes") |
| 54 | + remotes::install_github("HealthBioscienceIDEAS/varnish", dependencies = TRUE) |
| 55 | + # this one takes a long time, about 20mins for the the fist time |
| 56 | + # due to dependencies |
| 57 | + # You may see something similar to below in the output of the terminal |
| 58 | + # (this has been truncated - a fair amount of additional text should |
| 59 | + # follow showing progress of the installation) |
67 | 60 |
|
68 | | -Installing package into ‘/home/mxochicale/R/x86_64-pc-linux-gnu-library/4.4’ |
69 | | -(as ‘lib’ is unspecified) |
70 | | -* installing *source* package ‘sandpaper’ ... |
71 | | -** using staged installation |
72 | | -** R |
73 | | -** inst |
74 | | -** byte-compile and prepare package for lazy loading |
75 | | -** help |
76 | | -*** installing help indices |
77 | | -*** copying figures |
78 | | -** building package indices |
79 | | -** installing vignettes |
80 | | -** testing if installed package can be loaded from temporary location |
81 | | -** testing if installed package can be loaded from final location |
82 | | -** testing if installed package keeps a record of temporary installation path |
83 | | -* DONE (sandpaper) |
84 | | -Warning message: |
85 | | -In i.p(...) : installation of package ‘curl’ had non-zero exit status |
86 | | -
|
87 | | -``` |
88 | | - |
89 | | -6. In R, run |
90 | | -``` |
91 | | -sandpaper::create_lesson("~/Desktop/medical-registration/Medical-Image-Registration-Short-Course") |
92 | | -## LOGS |
93 | | -
|
94 | | -> sandpaper::create_lesson("~/Desktop/medical-registration/Medical-Image-Registration-Short-Course") |
95 | | -No personal access token (PAT) available.gistration/Medical-Image-Registration-Short-Course... |
96 | | -Obtain a PAT from here: |
97 | | -https://github.com/settings/tokens |
98 | | -For more on what to do with the PAT, see ?gh_whoami. |
99 | | -ℹ No schedule set, using Rmd files in episodes/ directory. |
100 | | -→ To remove this message, define your schedule in config.yaml or use `set_episodes()` to generate it. |
101 | | -─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
102 | | -ℹ To save this configuration, use |
103 | | -
|
104 | | -set_episodes(path = path, order = ep, write = TRUE) |
105 | | -• Edit '/home/mxochicale/Desktop/medical-registration/Medical-Image-Registration-Short-Course/episodes/introduction.Rmd' |
106 | | -✔ First episode created in /home/mxochicale/Desktop/medical-registration/Medical-Image-Registration-Short-Course/episodes/introduction.Rmd |
107 | | -ℹ Workflows up-to-date! |
108 | | -✔ Lesson successfully created in ~/Desktop/medical-registration/Medical-Image-Registration-Short-Course |
109 | | -✔ Setting active project to '/home/mxochicale/Desktop/medical-registration/Medical-Image-Registration-Short-Course' |
110 | | -✔ Changing working directory to '/home/mxochicale/Desktop/medical-registration/Medical-Image-Registration-Short-Course/' |
111 | | -~/Desktop/medical-registration/Medical-Image-Registration-Short-Course |
112 | | -> |
113 | | -``` |
114 | | - |
115 | | -7. Setting up config file in sandpaper template: |
116 | | -``` |
117 | | -carpentry: 'IDEAS' |
118 | | -title: ''Medical-Image-Registration-Short-Course' |
119 | | -created: '2024-05-13' |
120 | | -source: 'https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course' |
121 | | -varnish: 'HealthBioscienceIDEAS/varnish@IDEAS' |
122 | | -sandpaper: 'HealthBioscienceIDEAS/sandpaper@IDEAS' |
123 | | -``` |
124 | | - |
125 | | -8. Set up GitHub Pages |
126 | | -* Go go [pages](https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course/settings/pages) and select gh-pages branch with `/root` and click save |
127 | | -* Pass CI [actions](https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course/actions/runs/9064118161) |
128 | | -* :tada: you have created: https://healthbioscienceideas.github.io/Medical-Image-Registration-Short-Course/ |
129 | | - |
130 | | - |
131 | | -## Steps on Windows |
132 | | - |
133 | | -1. Create new repo: https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course |
134 | | - |
135 | | -2. Clone repo `git clone https://github.com/HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course` |
136 | | - |
137 | | -3. Installing R using the following: https://cran.r-project.org/bin/windows/base/ |
138 | | - |
139 | | -4. Using the default settings during the installation of **RGUi 4.x.x** |
140 | | - |
141 | | -5. From RGui Console, enter the following command: |
142 | | -``` |
143 | | -options(repos = c( |
144 | | -carpentries = "https://carpentries.r-universe.dev/", |
145 | | -CRAN = "https://cran.rstudio.com/" |
146 | | -)) |
147 | | -install.packages(c("remotes"), dep =TRUE) |
148 | | -``` |
149 | | - |
150 | | -6. Enter the following command: |
151 | | -`remotes::install_github("HealthBioscienceIDEAS/sandpaper", dependencies = TRUE) |
152 | | -` |
153 | | -7. Change path from RGUi to the GitHub folder of the medical image registration course. This is done from the Menu list by picking 'File' then 'Change Dir..' |
154 | | - |
155 | | -8. Run the following command to start sandpaper: |
156 | | -`sandpaper::build_lesson() |
157 | | -` |
158 | | -9. You may notice some package not installed called _**Pandoc**_ after running the sandpaper command. If so, install Pandoc then run _step 8_ again. |
159 | | -Pandoc installation: https://pandoc.org/installing.html |
160 | | - |
161 | | -## Steps in MAC |
162 | | -Packages via homebrew: freetype, fribidi, harfbuzz, libpng, git2. |
163 | | - |
164 | | -# Previewing eposides in any OS platform |
165 | | -## In your local machine |
| 61 | + Downloading GitHub repo HealthBioscienceIDEAS/varnish@HEAD |
| 62 | + These packages have more recent versions available. |
| 63 | + It is recommended to update all of them. |
| 64 | + Which would you like to update? |
| 65 | + |
| 66 | + 1: All |
| 67 | + 2: CRAN packages only |
| 68 | + 3: None |
| 69 | + ...(individual packages) |
| 70 | + |
| 71 | + Enter one or more numbers, or an empty line to skip updates: 1 |
| 72 | + ...(truncated) |
| 73 | + ``` |
| 74 | +## Previewing episodes |
| 75 | +### In your local machine |
166 | 76 | 1. Using your terminal clone repo |
167 | | -``` |
168 | | -git clone git@github.com:HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course.git |
169 | | -``` |
170 | | - |
171 | | -2. Checkout `feature-branch-name`. |
172 | | -``` |
173 | | -git checkout feature-branch-name |
174 | | -``` |
| 77 | + ```bash |
| 78 | + git clone git@github.com:HealthBioscienceIDEAS/Medical-Image-Registration-Short-Course.git |
| 79 | + ``` |
| 80 | +1. If you are working on a specific branch, checkout the branch locally: |
| 81 | + ```bash |
| 82 | + git checkout feature-branch-name |
| 83 | + ``` |
| 84 | +1. In RStudio, open the medical imaging regsitration course repository by going to |
| 85 | +File->Open Project and then selecting the path where you cloned the repository. |
| 86 | +You may need to click on the R project file that is located in the repository directory. |
| 87 | +1. Run the following command to start sandpaper: |
| 88 | + ```r |
| 89 | + sandpaper::serve() |
| 90 | + ``` |
| 91 | + This will build the site and put it in the `Viewer` tab in RStudio. You can look at it in your |
| 92 | + browser by clicking on the "Open in New Window" icon. |
| 93 | + |
| 94 | + If you notice errors that the package _**Pandoc**_ was not installed, try installing Pandoc and |
| 95 | + then try building the lesson again. If successful, R which will launch your internet browser with the episode. |
| 96 | + As you make edits and save the document you are working on, the site will be rebuilt. |
175 | 97 |
|
176 | | -3. Run `sandpaper::build_lesson()` in R which will launch your internet browser with the episode |
177 | | -``` |
178 | | -R |
179 | | -sandpaper::build_lesson() |
180 | | -``` |
181 | | -## In GitHub |
| 98 | + **Alternative to sandpaper::serve** |
| 99 | + |
| 100 | + The function `build_lesson` is very similar to |
| 101 | + ```r |
| 102 | + sandpaper::build_lesson() |
| 103 | + ``` |
| 104 | + except that it doesn't automatically build upon each save. If the page does not appear automatically in |
| 105 | + your browser, you may need to open it manually. |
| 106 | + |
| 107 | +### On GitHub |
182 | 108 | You can also preview your episodes once you have a Pull-Request. |
183 | | -1. Select branch called md-outputs-<PR-number> for each PR where it stores the rendered markdown files. This is controlled by the [pr-receive](https://carpentries.github.io/sandpaper-docs/pull-request.html#reviewing-a-pull-request) workflow. |
| 109 | + |
| 110 | +Select branch called md-outputs-<PR-number> for each PR where it stores the |
| 111 | +rendered markdown files. This is controlled by the [pr-receive](https://carpentries.github.io/sandpaper-docs/pull-request.html#reviewing-a-pull-request) workflow. |
| 112 | + |
| 113 | +Note this will only preview the markdown, it will not look like the final |
| 114 | +rendered website. |
184 | 115 |
|
0 commit comments