mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-04-29 17:20:21 -05:00
enhance: add symlink display to binder build output
- Show '_quarto.yml → config/<target>' during all build operations - Added symlink display to build_single, build_multiple_unified, and build_full methods - Enhanced status command to show clearer symlink arrow format - Updated BINDER.md documentation with symlink troubleshooting section - Provides clear visibility of which configuration is active during builds
This commit is contained in:
22
binder
22
binder
@@ -84,9 +84,9 @@ class BookBinder:
|
||||
"""Get current configuration status"""
|
||||
if self.active_config.is_symlink():
|
||||
target = self.active_config.readlink()
|
||||
active_config = str(target)
|
||||
active_config = f"_quarto.yml → {target}"
|
||||
else:
|
||||
active_config = "No symlink found"
|
||||
active_config = "⚠️ _quarto.yml is not a symlink"
|
||||
|
||||
# Check for commented lines
|
||||
html_commented = 0
|
||||
@@ -566,6 +566,11 @@ class BookBinder:
|
||||
# Setup correct configuration symlink for the format
|
||||
self.setup_symlink(format_type)
|
||||
|
||||
# Show current symlink configuration
|
||||
if self.active_config.is_symlink():
|
||||
target = self.active_config.readlink()
|
||||
console.print(f"[dim] 🔗 Using config: _quarto.yml → {target}[/dim]")
|
||||
|
||||
try:
|
||||
# Ensure config is clean (remove any render restrictions)
|
||||
self.ensure_clean_config(config_file)
|
||||
@@ -657,6 +662,11 @@ class BookBinder:
|
||||
# Setup correct configuration symlink for the format
|
||||
self.setup_symlink(format_type)
|
||||
|
||||
# Show current symlink configuration
|
||||
if self.active_config.is_symlink():
|
||||
target = self.active_config.readlink()
|
||||
console.print(f"[dim] 🔗 Using config: _quarto.yml → {target}[/dim]")
|
||||
|
||||
try:
|
||||
# Ensure config is clean (remove any render restrictions)
|
||||
self.ensure_clean_config(config_file)
|
||||
@@ -890,6 +900,12 @@ class BookBinder:
|
||||
|
||||
# Setup config
|
||||
config_name = self.setup_symlink(format_type)
|
||||
|
||||
# Show current symlink configuration
|
||||
if self.active_config.is_symlink():
|
||||
target = self.active_config.readlink()
|
||||
console.print(f"[dim] 🔗 Using config: _quarto.yml → {target}[/dim]")
|
||||
|
||||
if format_type == "html":
|
||||
render_to = "html"
|
||||
elif format_type == "pdf":
|
||||
@@ -900,8 +916,6 @@ class BookBinder:
|
||||
|
||||
render_cmd = ["quarto", "render", "--to", render_to]
|
||||
|
||||
console.print(f"[blue] 🔗 Using {config_name}[/blue]")
|
||||
|
||||
# Show the raw command being executed
|
||||
cmd_str = " ".join(render_cmd)
|
||||
console.print(f"[blue] 💻 Command: {cmd_str}[/blue]")
|
||||
|
||||
@@ -148,9 +148,13 @@ The binder automatically manages Quarto configurations:
|
||||
|
||||
- **`_quarto-html.yml`**: Website build configuration
|
||||
- **`_quarto-pdf.yml`**: Academic PDF build configuration
|
||||
- **`_quarto.yml`**: Symlink to active configuration
|
||||
- **`_quarto.yml`**: **Symlink** to active configuration (currently → `config/_quarto-html.yml`)
|
||||
|
||||
Use `./binder switch <format>` to change the active configuration.
|
||||
**Important**: The `_quarto.yml` file is a symlink that points to the active configuration. This allows the binder to quickly switch between HTML and PDF build modes without copying files.
|
||||
|
||||
**Quarto Executable**: The system quarto executable (`/Applications/quarto/bin/quarto`) is NOT a symlink - it's a regular executable file.
|
||||
|
||||
Use `./binder switch <format>` to change the active configuration symlink.
|
||||
|
||||
## Development Workflow
|
||||
|
||||
@@ -200,6 +204,11 @@ Use `./binder switch <format>` to change the active configuration.
|
||||
- The binder detected a previous fast build configuration
|
||||
- Run `./binder clean` to restore normal configuration
|
||||
|
||||
**"Symlink issues"**
|
||||
- If `_quarto.yml` is not a symlink: `ln -sf config/_quarto-html.yml book/_quarto.yml`
|
||||
- Check current symlink target: `ls -la book/_quarto.yml`
|
||||
- The symlink should point to either `config/_quarto-html.yml` or `config/_quarto-pdf.yml`
|
||||
|
||||
### Performance Tips
|
||||
|
||||
- Use fast builds (`./binder build chapter html`) for development
|
||||
|
||||
Reference in New Issue
Block a user