generated from devcontainers/feature-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
467b15d
commit 270bff9
Showing
5 changed files
with
52 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,17 @@ | ||
#!/usr/bin/env bash | ||
# This script installs AsciiDoc and all necessary tools for a DevContainer feature. | ||
# This script installs AsciiDoctor and related tools for a DevContainer feature. | ||
|
||
# Exit script on any error | ||
set -e | ||
|
||
# Default version for AsciiDoctor (if not specified) | ||
ASCIIDOCTOR_VERSION="${ASCIIDOCTOR_VERSION:-latest}" | ||
# Update package lists and install Ruby | ||
echo "Updating package lists and installing Ruby..." | ||
apt-get update -y && apt-get install -y ruby | ||
|
||
# Default version for AsciiDoctor PDF (if not specified) | ||
ASCIIDOCTOR_PDF_VERSION="${ASCIIDOCTOR_PDF_VERSION:-latest}" | ||
# Install RubyGems | ||
echo "Installing AsciiDoctor and related gems..." | ||
gem install asciidoctor asciidoctor-pdf asciidoctor-diagram asciidoctor-kroki | ||
|
||
# Default version for AsciiDoctor Diagram (if not specified) | ||
ASCIIDOCTOR_DIAGRAM_VERSION="${ASCIIDOCTOR_DIAGRAM_VERSION:-latest}" | ||
|
||
# Function to install system dependencies | ||
install_dependencies() { | ||
echo "Updating package lists..." | ||
apt-get update -y | ||
|
||
echo "Installing essential dependencies..." | ||
apt-get install -y \ | ||
ruby | ||
} | ||
|
||
# Function to install AsciiDoctor (optional faster alternative) | ||
install_asciidoctor() { | ||
if [ "$ASCIIDOCTOR_VERSION" = "latest" ]; then | ||
echo "Installing the latest version of AsciiDoctor via RubyGems..." | ||
gem install asciidoctor | ||
else | ||
echo "Installing AsciiDoctor (version $ASCIIDOCTOR_VERSION) via RubyGems..." | ||
gem install asciidoctor -v "$ASCIIDOCTOR_VERSION" | ||
fi | ||
} | ||
|
||
# Function to install AsciiDoctor PDF (optional faster alternative) | ||
install_asciidoctor_pdf() { | ||
if [ "$ASCIIDOCTOR_PDF_VERSION" = "latest" ]; then | ||
echo "Installing the latest version of AsciiDoctor PDF via RubyGems..." | ||
gem install asciidoctor-pdf | ||
else | ||
echo "Installing AsciiDoctor PDF (version $ASCIIDOCTOR_PDF_VERSION) via RubyGems..." | ||
gem install asciidoctor-pdf -v "$ASCIIDOCTOR_PDF_VERSION" | ||
fi | ||
} | ||
|
||
# Function to install AsciiDoctor Diagram (optional faster alternative) | ||
install_asciidoctor_diagram() { | ||
if [ "$ASCIIDOCTOR_DIAGRAM_VERSION" = "latest" ]; then | ||
echo "Installing the latest version of AsciiDoctor Diagram via RubyGems..." | ||
gem install asciidoctor-diagram | ||
else | ||
echo "Installing AsciiDoctor Diagram (version $ASCIIDOCTOR_DIAGRAM_VERSION) via RubyGems..." | ||
gem install asciidoctor-diagram -v "$ASCIIDOCTOR_DIAGRAM_VERSION" | ||
fi | ||
} | ||
|
||
# Function to clean up after installation | ||
cleanup() { | ||
echo "Cleaning up unnecessary packages and cache..." | ||
apt-get autoremove -y | ||
apt-get clean | ||
rm -rf /var/lib/apt/lists/* | ||
} | ||
|
||
# Main installation process | ||
install_dependencies | ||
install_asciidoctor | ||
install_asciidoctor_pdf | ||
install_asciidoctor_diagram | ||
cleanup | ||
|
||
# Verification of the installations | ||
echo "Verifying installation..." | ||
if command -v asciidoctor >/dev/null 2>&1; then | ||
echo "AsciiDoctor installed successfully." | ||
else | ||
echo "Error: AsciiDoctor installation failed." >&2 | ||
exit 1 | ||
fi | ||
|
||
if command -v asciidoctor-pdf >/dev/null 2>&1; then | ||
echo "AsciiDoctor PDF installed successfully." | ||
else | ||
echo "Error: AsciiDoctor PDF installation failed." >&2 | ||
exit 1 | ||
fi | ||
# Clean up unnecessary packages and cache | ||
echo "Cleaning up unnecessary packages and cache..." | ||
apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters