Skip to content

Commit b1af62d

Browse files
authored
Merge pull request #434 from MDAnalysis/update-gemfile
update to ruby >= 2.7, <4
2 parents d5b12a2 + 85b09ec commit b1af62d

File tree

4 files changed

+177
-15
lines changed

4 files changed

+177
-15
lines changed

Gemfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
source 'https://rubygems.org'
2-
ruby "~> 2.6"
2+
ruby ">= 2.7", "< 4"
33

4-
gem 'ffi', '=1.16.3'
54
gem 'github-pages'
65
gem 'rouge'
76
gem "webrick", "~> 1.7"
7+
8+
# rdiscount is a dependency of github-pages but earlier
9+
# version may trigger issue https://github.com/davidfstr/rdiscount/issues/145
10+
# (at least on macOS) so we explicitly pin here
11+
gem "rdiscount", ">= 2.2.0.2"
12+
13+
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
14+
# and associated library; see https://jekyllrb.com/docs/installation/windows/
15+
platforms :mingw, :x64_mingw, :mswin, :jruby do
16+
gem "tzinfo", ">= 1", "< 3"
17+
gem "tzinfo-data"
18+
end

INSTALL.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Running Jekyll locally
2+
3+
Follow the [GitHub: Testing your GitHub Pages site locally with
4+
Jekyll](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/testing-your-github-pages-site-locally-with-jekyll) instructions
5+
6+
Two possible approaches: Either install `ruby` (>= 2.7) and
7+
[jekyll](https://jekyllrb.com/) locally or use a Docker image with a
8+
jekyll installation. The local ruby/jekyll is more flexible if you can
9+
get it to work.
10+
11+
## Local jekyll installation
12+
13+
Basically follow [GitHub: Testing your GitHub Pages site locally with
14+
Jekyll](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/testing-your-github-pages-site-locally-with-jekyll)
15+
and in particular [Jekyll's installation
16+
instructions](https://jekyllrb.com/docs/installation/).
17+
18+
19+
### macOS
20+
21+
Do not use the system ruby (i.e., not `/usr/bin/ruby`) but install
22+
your own version. The [Jekyll macOS
23+
instructions](https://jekyllrb.com/docs/installation/macos/) use
24+
[homebrew](https://brew.sh/) but this works equally well with
25+
[macports](https://www.macports.org/).
26+
27+
#### Overview
28+
29+
1. Use `chruby` and `ruby-install` to manage different ruby versions.
30+
2. Build ruby 3.4.1 (this was the recommended version in the Jekyll
31+
instructions at the time)
32+
3. Install all necessary gems from [Gemfile][] with `bundle`.
33+
34+
35+
#### ruby installation with macports
36+
37+
Install `chruby` and `ruby-install`: On macos with macports
38+
39+
sudo port install chruby ruby-install
40+
41+
Update `~/.bash_profile` (or your `~/.zshrc`) with
42+
43+
# chruby (macports)
44+
source /opt/local/share/chruby/chruby.sh
45+
46+
# To enable auto-switching of Rubies specified by .ruby-version files, add the
47+
# following to ~/.bash_profile or ~/.zshrc:
48+
source /opt/local/share/chruby/auto.sh
49+
50+
Install ruby (compile from source, this requires Xcode and development
51+
tools on macOS and will take a while):
52+
53+
ruby-install ruby 3.4.1
54+
55+
Switch to using it (can also be added to `~/.bash_profile`)
56+
57+
chruby ruby-3.4.1
58+
59+
To always activate this version, add a `.ruby-version` file in the
60+
directory with the `Gemfile` (see [How to install different versions
61+
of ruby and automatically switch between them](https://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/#how-to-install-different-versions-of-ruby-and-switch-between-them)
62+
-- also needs chruby to be active):
63+
64+
echo "3.4.1" > .ruby-version
65+
66+
(May need to open a new terminal to let `.bash_profile` changes to take effect).
67+
68+
69+
### All OS: install gems (including jekyll)
70+
71+
Ensure that the correct version of ruby is use (`ruby --version`) and
72+
then
73+
74+
bundle install
75+
76+
should download and build the appropriate gems.
77+
78+
The `Gemfile.lock` should show something like
79+
```ruby
80+
GEM
81+
remote: https://rubygems.org/
82+
specs:
83+
...
84+
github-pages (232)
85+
github-pages-health-check (= 1.18.2)
86+
jekyll (= 3.10.0)
87+
...
88+
```
89+
90+
### Run jekyll locally
91+
92+
Start jekyll and have it serve the site at http://127.0.0.1:4000
93+
```bash
94+
rm -r _site
95+
bundle exec jekyll serve --watch --livereload --future --incremental
96+
```
97+
98+
(See the [serve commandline
99+
options](https://jekyllrb.com/docs/configuration/options/#serve-command-options)
100+
for more details.)
101+
102+
103+
104+
## Docker image
105+
106+
### macOS docker installation
107+
108+
- install Docker Desktop https://docs.docker.com/desktop/install/mac-install/
109+
- start docker
110+
- follow the solution from https://stackoverflow.com/a/58850151/ as
111+
described next
112+
113+
114+
### Build the site
115+
116+
To build the static site, run `jekyll build` inside docker:
117+
```bash
118+
export JEKYLL_VERSION=4.0
119+
docker run --rm \
120+
--volume="$PWD:/srv/jekyll" \
121+
-it jekyll/jekyll:$JEKYLL_VERSION \
122+
jekyll build
123+
```
124+
The static site files are stored in the `_site` directory.
125+
126+
### Serve the static site
127+
128+
Then you must *serve* the site:
129+
```bash
130+
cd _site
131+
python -m http.serve
132+
```
133+
134+
Point your browser to http://localhost:8000
135+
136+
When you make changes, you need to re-build the site.
137+
138+
139+

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ described next:
201201

202202
To **build the static site**, run `jekyll build` inside docker:
203203
```bash
204-
export JEKYLL_VERSION=3.8
204+
export JEKYLL_VERSION=4.0
205205
docker run --rm \
206206
--volume="$PWD:/srv/jekyll" \
207207
-it jekyll/jekyll:$JEKYLL_VERSION \
@@ -227,27 +227,28 @@ will appear on the web.*
227227
#### Build site locally ####
228228

229229
To run Jekyll in a way that matches the GitHub Pages build server, run `Jekyll`
230-
with `Bundler`. Use the command
230+
with `Bundler`. See [INSTALL](INSTALL.md) for notes on how to install Jekyll
231+
locally.
231232

232-
bundle exec jekyll serve
233+
Use the command
234+
235+
bundle exec jekyll serve --watch --livereload --future --incremental
233236

234237
in the root of your repository (after switching to the gh-pages branch for
235238
project repositories), and your site should be available at
236239
<http://localhost:4000>.
237240

238-
For a full list of Jekyll commands, see the [Jekyll
239-
documentation](https://jekyllrb.com/docs/).
241+
Running Jekyll locally has the advantage that you can have it update
242+
the site continuously while you're editing files.
240243

244+
(See the [serve commandline
245+
options](https://jekyllrb.com/docs/configuration/options/#serve-command-options)
246+
for more details.)
241247

242-
##### Advanced Jekyll usage #####
248+
For a full list of Jekyll commands, see the [Jekyll
249+
documentation](https://jekyllrb.com/docs/).
243250

244-
Running Jekyll locally has the advantage that you can have it update
245-
the site continuously while you're editing files:
246251

247-
bundle exec jekyll serve --livereload
248-
249-
In this way, the site is immediately rebuilt when you save changes to
250-
a file.
251252

252253

253254
##### Updating the github-pages plugin #####
@@ -261,6 +262,12 @@ with
261262

262263
##### Problems with jekyll and required packages? #####
263264

265+
* See [INSTALL](INSTALL.md) and if in doubt, follow the latest instructions from
266+
[GitHub: Testing your GitHub Pages site locally with
267+
Jekyll](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/testing-your-github-pages-site-locally-with-jekyll)
268+
and in particular [Jekyll's installation
269+
instructions](https://jekyllrb.com/docs/installation/)
270+
264271
* **Problems with installing jekyll/github-pages?** If the standard
265272
installation for jekyll does not work for you (many people complain,
266273
for instance, *commonmarker* does not install

_config.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ url: https://www.mdanalysis.org
2424
baseurl:
2525
author:
2626
name: The MDAnalysis Team
27-
url: https://twitter.com/mdanalysis
27+
url: https://www.mdanalysis.org/pages/team/
2828
2929

3030
images: /public/images
@@ -49,6 +49,11 @@ paginate: 3
4949
feed:
5050
path: atom.xml
5151

52+
# do not build these files/dirs:
53+
# see https://jekyllrb.com/docs/configuration/options/#global-configuration
54+
# (explicitly include the defaults for jekyll 3.x)
55+
exclude: [".sass-cache/", "gemfiles/", ".jekyll-cache/", "Gemfile", "Gemfile.lock", "README.md", "**/README.md", "INSTALL.md"]
56+
5257
# Custom vars
5358
version: 2.0.0
5459

0 commit comments

Comments
 (0)