Skip to content

Commit 8d2339d

Browse files
committed
Improve local building instructions
Signed-off-by: Carlosespicur <carlosespicur@proton.me>
1 parent fc27cb9 commit 8d2339d

File tree

1 file changed

+95
-4
lines changed

1 file changed

+95
-4
lines changed

README.md

Lines changed: 95 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,90 @@ Please note the following third-party elements and content:
3434
For details on the open source components included in the micro-ros.github.io repository, see the file [3rd-party-licenses.txt](3rd-party-licenses.txt).
3535

3636
## Running locally
37+
This project uses Jekyll, the static site generator behind GitHub Pages (see [Jekyll Quickstart](https://jekyllrb.com/docs/) for more information).
38+
To preview the site locally, you’ll need to install Ruby, Jekyll, and the project dependencies.
39+
40+
### Prerequisites
41+
Make sure your system has the necessary build tools and libraries for compiling Ruby and Jekyll dependencies:
42+
43+
```bash
44+
sudo apt update
45+
sudo apt install -y \
46+
libffi-dev \
47+
libyaml-dev \
48+
git
49+
```
50+
51+
### Install Ruby via rbenv
52+
We recommend using rbenv to manage Ruby versions locally:
53+
54+
```bash
55+
# Install rbenv
56+
sudo apt install -y rbenv
57+
58+
# Add rbenv to your shell
59+
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
60+
echo 'eval "$(rbenv init - bash)"' >> ~/.bashrc
61+
source ~/.bashrc
62+
63+
# Install ruby-build plugin
64+
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
65+
git -C "$(rbenv root)"/plugins/ruby-build pull
66+
67+
# Install Ruby 3.4.5
68+
rbenv install 3.4.5
69+
rbenv global 3.4.5
70+
```
71+
72+
### Configure UTF-8 Locale
73+
Jekyll and its plugins require UTF-8 encoding to handle special characters correctly:
74+
75+
```bash
76+
export LC_ALL="C.UTF-8"
77+
export LANG="en_US.UTF-8"
78+
export LANGUAGE="en_US.UTF-8"
79+
```
80+
81+
### Install Jekyll and Bundler
82+
83+
```bash
84+
gem install jekyll bundler
85+
```
86+
87+
Using a Bundler version different from the one recorded in the `Gemfile.lock` (currently 2.7.2) may lead to compatibility issues.
88+
You can check your installed Bundler version by running:
89+
90+
```bash
91+
bundler -v
92+
```
93+
94+
### Clone repository and dependencies
95+
For the includes of README.md files on the micro-ROS demos (in the tutorials chapter) from the corresponding repositories, please init and update the corresponding git submodules:
96+
97+
```bash
98+
git clone https://github.com/micro-ROS/micro-ROS.github.io.git
99+
cd micro-ROS.github.io/
100+
101+
# Fetch tutorials and demos included via submodules
102+
git submodule update --init --recursive
103+
```
104+
105+
### Install project dependencies
106+
After installing Jekyll, install all dependencies by running:
107+
108+
```bash
109+
bundle install
110+
```
111+
112+
### Run the Jekyll server
113+
You may launch Jekyll to build and serve the website continuously by running:
114+
115+
```bash
116+
bundle exec jekyll serve
117+
```
118+
119+
By default, the site will be available at http://localhost:4000
37120

38-
To test locally, you need a local version of Jekyll, the site-generation
39-
engine used by GitHub Pages. See [Jekyll Quickstart](https://jekyllrb.com/docs/)
40-
for installation instructions.
41121

42122
After installing Jekyll, install all dependencies by running
43123
```bash
@@ -49,7 +129,18 @@ Then, you may launch Jekyll to build and serve the website continuously by
49129
bundle exec jekyll serve
50130
```
51131

52-
For the includes of README.md files on the micro-ROS demos (in the tutorials chapter) from the corresponding repositories, please init and update the corresponding git submodules (i.e. `git submodule init ; git submodule update`).
132+
### (Optional) Regenerate `Gemfile.lock` file
133+
134+
When updating Ruby or Bundler version it is possible that dependencies no longer resolve cleanly, causing `bundle install` to fail.
135+
It can be fixed by regenerating the `Gemfile.lock` file and commiting the changes:
136+
137+
```bash
138+
rm Gemfile.lock
139+
140+
bundle install
141+
```
142+
143+
This will resolve all dependencies defined in your `Gemfile` and generate a new `Gemfile.lock` consistent with your current Bundler version and available gems.
53144

54145
## Testing generated site
55146

0 commit comments

Comments
 (0)