|
1 |
| -# compiler-research.github.io |
| 1 | +# Website setup |
| 2 | + |
| 3 | + |
| 4 | +## Setup for local development |
| 5 | + |
| 6 | +#### Docker setup |
| 7 | + |
| 8 | +If you use docker, the following line will build and serve the site locally: |
| 9 | + |
| 10 | +```bash |
| 11 | +docker run --rm -v "$PWD:/srv/jekyll" -p 4000:4000 -it jekyll/jekyll:3.8 jekyll serve |
| 12 | +``` |
| 13 | + |
| 14 | +If you want to enable LiveReload (pages automatically reload when jekyll rebuilds after detecting changes), then use this instead: |
| 15 | + |
| 16 | +```bash |
| 17 | +docker run --rm -v "$PWD:/srv/jekyll" \ |
| 18 | + -p 4000:4000 -p 35729:35729 \ |
| 19 | + -it jekyll/jekyll:3.8 \ |
| 20 | + jekyll serve --livereload |
| 21 | +``` |
| 22 | + |
| 23 | +#### Standard setup |
| 24 | + |
| 25 | +Visit [this page](https://jekyllrb.com/docs/installation/) for information about installing Ruby if your current version is too old; the instructions there form the basis for what you see here, and come in variants for all major operating systems. |
| 26 | +You should have Ruby 2.4+ for Jekyll. Since versions of macOS before Catalina with 2.3 (and Apple is dropping scripting language from macOS in the future), you may want a newer version even on a mac. You can use rbenv to manage multiple ruby versions. On macOS with homebrew, you'll want: |
| 27 | + |
| 28 | +```bash |
| 29 | +brew install rbenv |
| 30 | +``` |
| 31 | + |
| 32 | +You'll need to run: |
| 33 | + |
| 34 | +```bash |
| 35 | +rbenv init |
| 36 | +# Prints out instructions |
| 37 | +``` |
| 38 | + |
| 39 | +and follow the instructions for your current shell. After you've installed rbenv on your system, use: |
| 40 | + |
| 41 | +```bash |
| 42 | +rbenv install 2.7.0 |
| 43 | +``` |
| 44 | + |
| 45 | +to get a current version of ruby. Then, inside the main iris-hep website directory, run: |
| 46 | + |
| 47 | +```bash |
| 48 | +rbenv local 2.7.0 |
| 49 | +``` |
| 50 | + |
| 51 | +This will run the Ruby you just built whenever you enter this directory. You'll want to install bundler too: |
| 52 | + |
| 53 | +```bash |
| 54 | +gem install bundle |
| 55 | +``` |
| 56 | + |
| 57 | +(You may want to add `--user-install` here if you are not using rbenv. And if |
| 58 | +you don't have permission to install, and you are using rbenv, this means you |
| 59 | +forgot to set it up with `rbenv init`.) |
| 60 | + |
| 61 | + |
| 62 | +### Running locally |
| 63 | + |
| 64 | +The site is built with Jekyll, and is easy to run locally if you have Ruby. |
| 65 | + |
| 66 | +To set up a "bundle" (local virtual environment in Python terms): |
| 67 | + |
| 68 | +```bash |
| 69 | +bundle install |
| 70 | +``` |
| 71 | + |
| 72 | +Now, you can use `bundle exec` to run a command in the new environment you just created, such as: |
| 73 | + |
| 74 | +```bash |
| 75 | +bundle exec jekyll serve |
| 76 | +``` |
| 77 | + |
| 78 | +This will incrementally rebuild if anything changes in your directory. Exit with Control-C. |
| 79 | + |
| 80 | + |
| 81 | + |
0 commit comments