Skip to content

Commit 834210b

Browse files
authored
Create Makefile (#534)
* create Makefile We needed to make a makefile such that developers can easily set up their local environments * Updated Makefile to include Python version
1 parent 7ad2826 commit 834210b

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

Makefile

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Makefile for managing Jekyll project for BlackPythonDev
2+
3+
# Set up the environment by pulling the latest Ruby build definitions, installing Ruby 3.3.5,
4+
# as seen in the .ruby-version file, installing required gems and Python packages,
5+
# and configuring pre-commit hooks
6+
7+
.PHONY: setup-ruby setup-python install
8+
9+
10+
install: setup-ruby setup-python
11+
12+
# Install the necessary Ruby gems defined in the Gemfile
13+
- bundle install
14+
15+
# Install Python dependencies defined in requirements-dev.txt
16+
- pip install -r requirements-dev.txt
17+
18+
# Set up pre-commit hooks as defined in the configuration file
19+
- pre-commit install
20+
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+
71+
# Start the Jekyll development server
72+
start:
73+
bundle exec jekyll serve
74+
75+
76+
# Start the Jekyll server in detached mode (runs in the background)
77+
start-detach:
78+
bundle exec jekyll serve --detach
79+
80+
81+
# Stop the detached Jekyll server (Kill the background Jekyll process)
82+
stop-detach:
83+
pkill -f jekyll

0 commit comments

Comments
 (0)