|
1 |
| -# Makefile for managing Jekyll project for blackpythondevs.github.io |
| 1 | +# Makefile for managing Jekyll project for BlackPythonDev |
2 | 2 |
|
3 | 3 | # Set up the environment by pulling the latest Ruby build definitions, installing Ruby 3.3.5,
|
4 | 4 | # as seen in the .ruby-version file, installing required gems and Python packages,
|
5 | 5 | # and configuring pre-commit hooks
|
6 | 6 |
|
7 |
| -setup: |
8 |
| - # Pull the latest ruby-build plugin updates |
9 |
| - - git -C /root/.rbenv/plugins/ruby-build pull |
| 7 | +.PHONY: setup-ruby setup-python install |
10 | 8 |
|
11 |
| - # Install Ruby version 3.3.5 using rbenv |
12 |
| - - rbenv install 3.3.5 |
13 | 9 |
|
14 |
| - # Install the necessary Ruby gems defined in the Gemfile |
| 10 | +install: setup-ruby setup-python |
| 11 | + |
| 12 | + # Install the necessary Ruby gems defined in the Gemfile |
15 | 13 | - bundle install
|
16 | 14 |
|
17 |
| - # Install Python dependencies defined in requirements-dev.txt |
| 15 | + # Install Python dependencies defined in requirements-dev.txt |
18 | 16 | - pip install -r requirements-dev.txt
|
19 | 17 |
|
20 |
| - # Set up pre-commit hooks as defined in the configuration file |
| 18 | + # Set up pre-commit hooks as defined in the configuration file |
21 | 19 | - pre-commit install
|
22 | 20 |
|
23 | 21 |
|
| 22 | +setup-ruby: |
| 23 | + # Pull the latest ruby-build plugin updates |
| 24 | + - git -C /root/.rbenv/plugins/ruby-build pull |
| 25 | + |
| 26 | + # Install Ruby version 3.3.5 using rbenv |
| 27 | + - rbenv install 3.3.5 |
| 28 | + |
| 29 | + # Set local version of ruby to 3.3.5 |
| 30 | + - rbenv local 3.3.5 |
| 31 | + |
| 32 | + |
| 33 | +setup-python: |
| 34 | + # System Build Dependencies for pyenv |
| 35 | + - sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \ |
| 36 | + libbz2-dev libreadline-dev libsqlite3-dev wget curl libncurses5-dev \ |
| 37 | + libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev |
| 38 | + |
| 39 | + # Install Pyenv |
| 40 | + - curl https://pyenv.run | bash |
| 41 | + |
| 42 | + # Add Pyenv to Environment |
| 43 | + @echo "Setting up pyenv in ~/.bash_profile, ~/.profile, and ~/.bashrc..." |
| 44 | + @if [ -f $$HOME/.bash_profile ]; then \ |
| 45 | + echo "Appending to ~/.bash_profile"; \ |
| 46 | + grep -qxF 'export PYENV_ROOT="$$HOME/.pyenv"' $$HOME/.bash_profile || echo 'export PYENV_ROOT="$$HOME/.pyenv"' >> $$HOME/.bash_profile; \ |
| 47 | + grep -qxF '[[ -d $$PYENV_ROOT/bin ]] && export PATH="$$PYENV_ROOT/bin:$$PATH"' $$HOME/.bash_profile || echo '[[ -d $$PYENV_ROOT/bin ]] && export PATH="$$PYENV_ROOT/bin:$$PATH"' >> $$HOME/.bash_profile; \ |
| 48 | + grep -qxF 'eval "$$(pyenv init -)"' $$HOME/.bash_profile || echo 'eval "$$(pyenv init -)"' >> $$HOME/.bash_profile; \ |
| 49 | + else \ |
| 50 | + echo "Appending to ~/.profile"; \ |
| 51 | + grep -qxF 'export PYENV_ROOT="$$HOME/.pyenv"' $$HOME/.profile || echo 'export PYENV_ROOT="$$HOME/.pyenv"' >> $$HOME/.profile; \ |
| 52 | + grep -qxF '[[ -d $$PYENV_ROOT/bin ]] && export PATH="$$PYENV_ROOT/bin:$$PATH"' $$HOME/.profile || echo '[[ -d $$PYENV_ROOT/bin ]] && export PATH="$$PYENV_ROOT/bin:$$PATH"' >> $$HOME/.profile; \ |
| 53 | + grep -qxF 'eval "$$(pyenv init -)"' $$HOME/.profile || echo 'eval "$$(pyenv init -)"' >> $$HOME/.profile; \ |
| 54 | + fi |
| 55 | + |
| 56 | + # Append to ~/.bashrc for interactive shells |
| 57 | + @echo "Appending to ~/.bashrc" |
| 58 | + @grep -qxF 'export PYENV_ROOT="$$HOME/.pyenv"' $$HOME/.bashrc || echo 'export PYENV_ROOT="$$HOME/.pyenv"' >> $$HOME/.bashrc |
| 59 | + @grep -qxF '[[ -d $$PYENV_ROOT/bin ]] && export PATH="$$PYENV_ROOT/bin:$$PATH"' $$HOME/.bashrc || echo '[[ -d $$PYENV_ROOT/bin ]] && export PATH="$$PYENV_ROOT/bin:$$PATH"' >> $$HOME/.bashrc |
| 60 | + @grep -qxF 'eval "$$(pyenv init -)"' $$HOME/.bashrc || echo 'eval "$$(pyenv init -)"' >> $$HOME/.bashrc |
| 61 | + |
| 62 | + @echo "Pyenv setup completed." |
| 63 | + |
| 64 | + # Install Python version |
| 65 | + - pyenv install 3.11.7 |
| 66 | + |
| 67 | + # Set local python to 3.11.7 |
| 68 | + - pyenv local 3.11.7 |
| 69 | + |
| 70 | + |
24 | 71 | # Start the Jekyll development server
|
25 | 72 | start:
|
26 | 73 | bundle exec jekyll serve
|
|
0 commit comments