diff --git a/README.md b/README.md index 0719b5f..c776d31 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ On success, `ntk init` logs the new theme ID and name, and persists the theme ID To sync files between your local directory and the store, use `ntk push` to upload and `ntk pull` to download. Both upload or download the whole theme by default, and both accept file paths as positional arguments to limit the operation to specific files. > [!NOTE] -> File paths are relative to the theme root. `ntk push` only uploads files inside the theme directories (`assets`, `checkout`, `configs`, `layouts`, `locales`, `partials`, `sass`, `templates`) with valid theme file extensions — a path outside of them is skipped silently, not reported as an error. +> File paths are relative to the theme root. `ntk push` only uploads files inside the theme directories (`assets`, `configs`, `layouts`, `locales`, `partials`, `sass`, `templates`) with valid theme file extensions — a path outside of them is skipped silently, not reported as an error. `ntk pull` still downloads the `checkout` directory, but `ntk push` skips it: the store does not accept uploads to it. | Example | Command | | ------- | ------- | diff --git a/ntk/conf.py b/ntk/conf.py index b6ff190..c13c41e 100644 --- a/ntk/conf.py +++ b/ntk/conf.py @@ -41,7 +41,6 @@ "assets/**/*.webm", "assets/**/*.mp3", "assets/**/*.pdf", - "checkout/**/*.html", "configs/**/*.json", "layouts/**/*.html", "partials/**/*.html", diff --git a/setup.py b/setup.py index 8acb5cd..dd45803 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import find_packages, setup -__version__ = '1.2.0' +__version__ = '1.3.0' tests_require = [ "flake8", diff --git a/tests/test_command.py b/tests/test_command.py index 13e1a14..2c18a7a 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -1,4 +1,5 @@ import os +import tempfile import unittest from unittest.mock import call, MagicMock, mock_open, patch @@ -410,6 +411,21 @@ def test_get_accept_files_filters_invalid_extensions_from_provided_filenames( ]) self.assertEqual(result, [valid_file]) + def test_get_accept_files_skips_checkout_directory(self): + """The store API rejects uploads to checkout/ (#37), so push never selects it.""" + cwd = os.getcwd() + with tempfile.TemporaryDirectory() as theme_dir: + os.chdir(theme_dir) + try: + os.makedirs('checkout') + os.makedirs('templates') + open('checkout/checkout.html', 'w').close() + open('templates/index.html', 'w').close() + self.assertEqual(self.command._get_accept_files([]), [os.path.abspath('templates/index.html')]) + self.assertEqual(self.command._get_accept_files(['checkout/checkout.html']), []) + finally: + os.chdir(cwd) + @patch("ntk.command.Command._get_accept_files", autospec=True) def test_push_command_with_filenames_should_upload_only_specified_files( self, mock_get_accept_files