-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Makefile with sync designation #55
Changes from all commits
eb9cec7
c028d2e
972f497
0f696b6
f056808
e92cb98
b846fe6
77e7b70
b81046a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okidokie, we could always do: |
||
|
||
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)" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Version: 0.5.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
local countdown_version = '0.5.0' | ||
|
||
return { countdownVersion = countdown_version } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
countdown_version <- '0.5.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed this because
make help
will sort targets by name andsync-all
shows up first in the list whilesync
shows up after the other sync targets.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, the true reason why
-all
was needed :)