Skip to content
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

feat: allow to download multiple files and folders #16

Merged
merged 11 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
[run]
branch = True
data_file = .coverage
source = filesmanager
source=filesmanager
omit =
tests
filesmanager/settings
filesmanager/locale/*
filesmanager/static
test_settings.py
*/migrations/*
*admin.py
*/static/*
*/templates/*
*/settings/*
*/locale/*
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8']
toxenv: [quality, docs, django32, django40]
toxenv: [quality, django32, django40]

steps:
- uses: actions/checkout@v3
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ pip-log.txt
coverage.xml
htmlcov/


# Virtual environments
/venv/
/venv-*/
/.venv/
/.venv-*/

# The Silver Searcher
.agignore
Expand Down Expand Up @@ -71,3 +75,4 @@ requirements/private.txt
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pii_report/*
15 changes: 0 additions & 15 deletions .readthedocs.yml

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ Change Log
Unreleased
**********

0.5.0 - 2023-11-24
**********************************************

Added
=====

* Allow to download multiple files and folders.

0.4.0 - 2023-11-23
**********************************************

Expand Down
119 changes: 60 additions & 59 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,32 @@
.DEFAULT_GOAL := help

.PHONY: dev.clean dev.build dev.run upgrade help requirements
.PHONY: extract_translations compile_translations
.PHONY: detect_changed_source_translations dummy_translations build_dummy_translations
.PHONY: validate_translations pull_translations push_translations symlink_translations install_transifex_clients

REPO_NAME := xblock-filesmanager
PACKAGE_NAME := filesmanager
EXTRACT_DIR := $(PACKAGE_NAME)/locale/en/LC_MESSAGES
EXTRACTED_DJANGO := $(EXTRACT_DIR)/django-partial.po
EXTRACTED_DJANGOJS := $(EXTRACT_DIR)/djangojs-partial.po
EXTRACTED_TEXT := $(EXTRACT_DIR)/text.po
JS_TARGET := public/js/translations
TRANSLATIONS_DIR := $(PACKAGE_NAME)/translations
.PHONY: clean clean_tox compile_translations coverage diff_cover dummy_translations \
extract_translations fake_translations help pull_translations push_translations \
quality requirements selfcheck test test-all upgrade validate install_transifex_client

help:
@perl -nle'print $& if m{^[\.a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}'

install-test:
pip install -qr requirements/test.txt
.DEFAULT_GOAL := help

install-dev:
pip install -qr requirements/dev.txt
# For opening files in a browser. Use like: $(BROWSER)relative/path/to/file.html
BROWSER := python -m webbrowser file://$(CURDIR)/

install: install-test
help: ## display this help message
@echo "Please use \`make <target>' where <target> is one of"
@awk -F ':.*?## ' '/^[a-zA-Z]/ && NF==2 {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort

quality: ## Run the quality checks
pylint --rcfile=pylintrc filesmanager
python setup.py -q sdist
twine check dist/*
clean: ## remove generated byte code, coverage reports, and build artifacts
find . -name '__pycache__' -exec rm -rf {} +
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
coverage erase
rm -fr build/
rm -fr dist/
rm -fr *.egg-info

test: ## Run the tests
mkdir -p var
rm -rf .coverage
python -m coverage run --rcfile=.coveragerc -m pytest
clean_tox: ## clear tox requirements cache
rm -fr .tox

covreport: ## Show the coverage results
python -m coverage report -m --skip-covered
coverage: clean ## generate and view HTML coverage report
pytest --cov-report html
$(BROWSER)htmlcov/index.html

# Define PIP_COMPILE_OPTS=-v to get more information during make upgrade.
PIP_COMPILE = pip-compile --upgrade $(PIP_COMPILE_OPTS)
Expand All @@ -59,52 +49,63 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy
sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp
mv requirements/test.tmp requirements/test.txt

quality: ## check coding style with pycodestyle and pylint
tox -e quality

piptools: ## install pinned version of pip-compile and pip-sync
pip install -r requirements/pip.txt
pip install -r requirements/pip-tools.txt

requirements: piptools ## install development environment requirements
requirements: clean_tox piptools ## install development environment requirements
pip-sync -q requirements/dev.txt requirements/private.*

dev.clean:
-docker rm $(REPO_NAME)-dev
-docker rmi $(REPO_NAME)-dev
test: clean ## run tests in the current virtualenv
pytest

dev.build:
docker build -t $(REPO_NAME)-dev $(CURDIR)
diff_cover: test ## find diff lines that need test coverage
diff-cover coverage.xml

dev.run: dev.clean dev.build ## Clean, build and run test image
docker run -p 8000:8000 -v $(CURDIR):/usr/local/src/$(REPO_NAME) --name $(REPO_NAME)-dev $(REPO_NAME)-dev
test-all: quality ## run tests on every supported Python/Django combination
tox

validate: quality test ## run tests and quality checks

selfcheck: ## check that the Makefile is well-formed
@echo "The Makefile is well-formed."

## Localization targets

extract_translations: symlink_translations ## extract strings to be translated, outputting .po files
cd $(PACKAGE_NAME) && i18n_tool extract
mv $(EXTRACTED_DJANGO) $(EXTRACTED_TEXT)
if [ -f "$(EXTRACTED_DJANGOJS)" ]; then cat $(EXTRACTED_DJANGOJS) >> $(EXTRACTED_TEXT); rm $(EXTRACTED_DJANGOJS); fi
extract_translations: ## extract strings to be translated, outputting .mo files
cd filesmanager && i18n_tool extract --no-segment

compile_translations: symlink_translations ## compile translation files, outputting .mo files for each supported language
cd $(PACKAGE_NAME) && i18n_tool generate
python manage.py compilejsi18n --namespace $(PACKAGE_NAME)i18n --output $(JS_TARGET)
compile_translations: ## compile translation files, outputting .po files for each supported language
cd filesmanager && i18n_tool generate

detect_changed_source_translations:
cd $(PACKAGE_NAME) && i18n_tool changed
cd filesmanager && i18n_tool changed

dummy_translations: ## generate dummy translation (.po) files
cd $(PACKAGE_NAME) && i18n_tool dummy
ifeq ($(OPENEDX_ATLAS_PULL),)
pull_translations: ## Pull translations from Transifex
tx pull -t -a -f --mode reviewed --minimum-perc=1
else
# Experimental: OEP-58 Pulls translations using atlas
pull_translations:
find filesmanager/conf/locale -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \;
atlas pull $(OPENEDX_ATLAS_ARGS) translations/xblock-filesmanager/filesmanager/conf/locale:filesmanager/conf/locale
python manage.py compilemessages

build_dummy_translations: dummy_translations compile_translations ## generate and compile dummy translation files
@echo "Translations have been pulled via Atlas and compiled."
endif

validate_translations: build_dummy_translations detect_changed_source_translations ## validate translations
push_translations: ## push source translation files (.po) from Transifex
tx push -s

pull_translations: ## pull translations from transifex
cd $(PACKAGE_NAME) && i18n_tool transifex pull
dummy_translations: ## generate dummy translation (.po) files
cd filesmanager && i18n_tool dummy

push_translations: extract_translations ## push translations to transifex
cd $(PACKAGE_NAME) && i18n_tool transifex push
build_dummy_translations: extract_translations dummy_translations compile_translations ## generate and compile dummy translation files

symlink_translations:
if [ ! -d "$(TRANSLATIONS_DIR)" ]; then ln -s locale/ $(TRANSLATIONS_DIR); fi
validate_translations: build_dummy_translations detect_changed_source_translations ## validate translations

install_transifex_client: ## Install the Transifex client
# Instaling client will skip CHANGELOG and LICENSE files from git changes
Expand Down
Loading