We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
`# Makefile
DEPLOYMENT := your_deployment_name
find_recent_dir: @if [ "$(shell uname)" = "Darwin" ]; then recent_dir=$$(find "$(PWD)/bundles" -maxdepth 1 -type d -name "$(basename $(DEPLOYMENT))" -exec stat -f '%m %N' {} + 2>/dev/null | sort -n | tail -n1 | cut -d' ' -f2-); else recent_dir=$$(find "$(PWD)/bundles" -maxdepth 1 -type d -name "$(basename $(DEPLOYMENT))" -exec stat --format='%Y %n' {} + 2>/dev/null | sort -n | tail -n1 | cut -d' ' -f2-); fi; if [ -z "$$recent_dir" ]; then echo "No directory found matching the base name of $(DEPLOYMENT)"; else echo "The most recently modified directory is: $$recent_dir"; fi
deploy: find_recent_dir @echo "Deploying to the most recent directory..." # Here you can add additional commands to deploy to the directory found `
The text was updated successfully, but these errors were encountered:
terrancej
No branches or pull requests
`# Makefile
Define the DEPLOYMENT variable
DEPLOYMENT := your_deployment_name
Define the rule to find the most recently modified directory using find
find_recent_dir:
@if [ "$(shell uname)" = "Darwin" ]; then
recent_dir=$$(find "$(PWD)/bundles" -maxdepth 1 -type d -name "$(basename $(DEPLOYMENT))" -exec stat -f '%m %N' {} + 2>/dev/null | sort -n | tail -n1 | cut -d' ' -f2-);
else
recent_dir=$$(find "$(PWD)/bundles" -maxdepth 1 -type d -name "$(basename $(DEPLOYMENT))" -exec stat --format='%Y %n' {} + 2>/dev/null | sort -n | tail -n1 | cut -d' ' -f2-);
fi;
if [ -z "$$recent_dir" ]; then
echo "No directory found matching the base name of $(DEPLOYMENT)";
else
echo "The most recently modified directory is: $$recent_dir";
fi
Example usage of the find_recent_dir rule
deploy: find_recent_dir
@echo "Deploying to the most recent directory..."
# Here you can add additional commands to deploy to the directory found `
The text was updated successfully, but these errors were encountered: