-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from gadenbuie/make-sync
Add Makefile with sync designation
- Loading branch information
Showing
7 changed files
with
83 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
.PHONY: help debug sync-all sync-python sync-quarto sync-r | ||
.DEFAULT_GOAL := help | ||
|
||
help: ## Show help messages for make targets | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-18s\033[0m %s\n", $$1, $$2}' | ||
|
||
# Define the source directory for assets | ||
SRC_DIR := lib | ||
SRC_FILES := $(wildcard $(SRC_DIR)/*.js) | ||
SRC_FILES += $(wildcard $(SRC_DIR)/*.css) | ||
SRC_FILES += $(wildcard $(SRC_DIR)/*.mp3) | ||
|
||
# Read version from version distribution file | ||
VERSION_FILE := $(SRC_DIR)/version.txt | ||
VERSION := $(shell grep '^Version:' $(VERSION_FILE) | awk '{print $$2}') | ||
|
||
# Define the destination directories for different languages | ||
SYNC_DEST_PYTHON := python/countdown/assets | ||
SYNC_DEST_R := r/inst/countdown | ||
SYNC_DEST_QUARTO := quarto/_extensions/countdown/assets | ||
|
||
sync-all: sync-python sync-r sync-quarto ## Sync web assets to all subpackages | ||
|
||
sync-python: ## Sync web assets to Python package | ||
@echo "Syncing web assets to the Python package..." | ||
@test -d $(SYNC_DEST_PYTHON) || mkdir -p $(SYNC_DEST_PYTHON) | ||
cp -r $(SRC_FILES) $(SYNC_DEST_PYTHON) | ||
echo "countdown_version = '$(VERSION)'" > python/countdown/config.py | ||
|
||
sync-r: ## Sync web assets to R package | ||
@echo "Syncing web assets to R directory..." | ||
@test -d $(SYNC_DEST_R) || mkdir -p $(SYNC_DEST_R) | ||
cp -r $(SRC_FILES) $(SYNC_DEST_R) | ||
echo "countdown_version <- '$(VERSION)'" > r/R/config.R | ||
|
||
|
||
sync-quarto: ## Sync web assets to Quarto extension | ||
@echo "Syncing web assets to Quarto directory..." | ||
@test -d $(SYNC_DEST_QUARTO) || mkdir -p $(SYNC_DEST_QUARTO) | ||
cp -r $(SRC_FILES) $(SYNC_DEST_QUARTO) | ||
echo "local countdown_version = '$(VERSION)'\n\nreturn { countdownVersion = countdown_version }" > quarto/_extensions/countdown/config.lua | ||
|
||
debug: ## Print all variables for debugging | ||
@printf "\033[32m%-18s\033[0m %s\n" "VERSION" "$(VERSION)" | ||
@printf "\033[32m%-18s\033[0m %s\n" "SRC_DIR" "$(SRC_DIR)" | ||
@printf "\033[32m%-18s\033[0m %s\n" "SRC_FILES" "$(SRC_FILES)" | ||
@printf "\033[32m%-18s\033[0m %s\n" "VERSION_FILE" "$(VERSION_FILE)" | ||
@printf "\033[32m%-18s\033[0m %s\n" "SYNC_DEST_PYTHON" "$(SYNC_DEST_PYTHON)" | ||
@printf "\033[32m%-18s\033[0m %s\n" "SYNC_DEST_R" "$(SYNC_DEST_R)" | ||
@printf "\033[32m%-18s\033[0m %s\n" "SYNC_DEST_QUARTO" "$(SYNC_DEST_QUARTO)" |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Version: 0.5.0 |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
local countdown_version = '0.5.0' | ||
|
||
return { countdownVersion = countdown_version } |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
countdown_version <- '0.5.0' |
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