Skip to content

Commit 82f89f1

Browse files
committed
Updated Makefile to include Python version
1 parent 95fdf93 commit 82f89f1

File tree

2 files changed

+57
-10
lines changed

2 files changed

+57
-10
lines changed

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.2
1+
3.3.5

Makefile

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,73 @@
1-
# Makefile for managing Jekyll project for blackpythondevs.github.io
1+
# Makefile for managing Jekyll project for BlackPythonDev
22

33
# Set up the environment by pulling the latest Ruby build definitions, installing Ruby 3.3.5,
44
# as seen in the .ruby-version file, installing required gems and Python packages,
55
# and configuring pre-commit hooks
66

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
108

11-
# Install Ruby version 3.3.5 using rbenv
12-
- rbenv install 3.3.5
139

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
1513
- bundle install
1614

17-
# Install Python dependencies defined in requirements-dev.txt
15+
# Install Python dependencies defined in requirements-dev.txt
1816
- pip install -r requirements-dev.txt
1917

20-
# Set up pre-commit hooks as defined in the configuration file
18+
# Set up pre-commit hooks as defined in the configuration file
2119
- pre-commit install
2220

2321

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+
2471
# Start the Jekyll development server
2572
start:
2673
bundle exec jekyll serve

0 commit comments

Comments
 (0)