Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "choosealicense.com",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
"remoteEnv": {
"PATH": "/home/vscode/.rbenv/shims:/home/vscode/.rbenv/bin:${containerEnv:PATH}"
},
"postCreateCommand": "bash .devcontainer/post-create.sh"
}
97 changes: 97 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/env bash
set -euo pipefail

for cmd in curl git sed; do
if ! command -v "${cmd}" >/dev/null 2>&1; then
echo "${cmd} is required for .devcontainer/post-create.sh"
exit 1
fi
done

if command -v apt-get >/dev/null 2>&1; then
packages=(
build-essential
cmake
pkg-config
libffi-dev
libyaml-dev
libssl-dev
zlib1g-dev
libreadline-dev
libgdbm-dev
libncurses-dev
libssh2-1-dev
)

missing_packages=()
for package in "${packages[@]}"; do
if ! dpkg-query -W -f='${Status}' "${package}" 2>/dev/null | grep -q 'install ok installed'; then
missing_packages+=("${package}")
fi
done

if [[ ${#missing_packages[@]} -gt 0 ]]; then
echo "Installing Ruby build dependencies: ${missing_packages[*]}"
if command -v sudo >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y "${missing_packages[@]}"
else
apt-get update
apt-get install -y "${missing_packages[@]}"
fi
fi
fi

echo "Initializing/updating git submodules"
git submodule update --init --recursive

versions_json="$(curl -fsSL https://pages.github.com/versions.json)" || {
echo "Failed to fetch https://pages.github.com/versions.json"
exit 1
}

pages_ruby_version="$(
printf '%s' "${versions_json}" |
sed -n 's/.*"ruby"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' |
head -n 1
)"

echo "GitHub Pages Ruby version: ${pages_ruby_version}"

if [[ -z "${pages_ruby_version}" ]]; then
echo "Could not determine Ruby version from https://pages.github.com/versions.json"
exit 1
fi

if [[ ! -d "$HOME/.rbenv" ]]; then
git clone --depth 1 https://github.com/rbenv/rbenv.git "$HOME/.rbenv"
fi

if [[ ! -d "$HOME/.rbenv/plugins/ruby-build" ]]; then
mkdir -p "$HOME/.rbenv/plugins"
git clone --depth 1 https://github.com/rbenv/ruby-build.git "$HOME/.rbenv/plugins/ruby-build"
fi

export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
eval "$(rbenv init - bash)"

rbenv install -s "${pages_ruby_version}"
rbenv global "${pages_ruby_version}"
rbenv rehash

for profile in "$HOME/.bashrc" "$HOME/.zshrc"; do
if [[ -f "$profile" ]] && ! grep -q 'rbenv init - bash' "$profile"; then
{
echo
echo '# Load rbenv'
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"'
echo 'eval "$(rbenv init - bash)"'
} >> "$profile"
fi
done

gem install bundler --no-document
rbenv rehash
mkdir -p "$HOME/.local/bin"
ln -sf "$HOME/.rbenv/shims/bundle" "$HOME/.local/bin/bundle"
bundle install
2 changes: 1 addition & 1 deletion _licenses/gpl-2.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of
note: The Free Software Foundation recommends taking the additional step of adding a boilerplate notice to the top of each file. The boilerplate can be found at the end of the license.

using:
AliSQL: https://github.com/alibaba/AliSQL/blob/master/COPYING
Discourse: https://github.com/discourse/discourse/blob/master/LICENSE.txt
Jellyfin: https://github.com/jellyfin/jellyfin/blob/master/LICENSE
OBS Studio: https://github.com/obsproject/obs-studio/blob/master/COPYING

permissions:
- commercial-use
Expand Down
2 changes: 1 addition & 1 deletion _licenses/gpl-3.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ note: The Free Software Foundation recommends taking the additional step of addi
using:
Ansible: https://github.com/ansible/ansible/blob/devel/COPYING
Bash: https://git.savannah.gnu.org/cgit/bash.git/tree/COPYING
GIMP: https://git.gnome.org/browse/gimp/tree/COPYING
uBlock Origin: https://github.com/gorhill/uBlock/blob/master/LICENSE.txt

permissions:
- commercial-use
Expand Down
Loading