don't copy .files into the SSG output dir
they may be vim swap files and that kind of garbage Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
parent
6d7987cfae
commit
8aabd93273
@ -97,6 +97,9 @@ class StaticSiteGenerator(object):
|
|||||||
|
|
||||||
# process and copy files
|
# process and copy files
|
||||||
for file_ in files:
|
for file_ in files:
|
||||||
|
if file_[0] == '.':
|
||||||
|
cprint(f"skipping {file_}", 'yellow')
|
||||||
|
continue
|
||||||
self.build_file_in_destination(source_dir, base_dir, file_, dest_dir, convert_markdown)
|
self.build_file_in_destination(source_dir, base_dir, file_, dest_dir, convert_markdown)
|
||||||
|
|
||||||
def build_subdir_in_destination(self, source_dir: str, base_dir: str, subdir: str, dest_dir: str) -> None:
|
def build_subdir_in_destination(self, source_dir: str, base_dir: str, subdir: str, dest_dir: str) -> None:
|
||||||
|
1
tests/instance/pages/.ignored-file.md
Normal file
1
tests/instance/pages/.ignored-file.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
this is ignored
|
@ -88,3 +88,13 @@ def test_build_in_destination():
|
|||||||
assert os.path.exists(os.path.join(tmpdir, 'index.html'))
|
assert os.path.exists(os.path.join(tmpdir, 'index.html'))
|
||||||
assert os.path.exists(os.path.join(tmpdir, 'subdir', 'index.md'))
|
assert os.path.exists(os.path.join(tmpdir, 'subdir', 'index.md'))
|
||||||
assert os.path.exists(os.path.join(tmpdir, 'subdir', 'index.html'))
|
assert os.path.exists(os.path.join(tmpdir, 'subdir', 'index.html'))
|
||||||
|
|
||||||
|
|
||||||
|
def test_build_in_destination_ignores_dot_files():
|
||||||
|
"""Test the ability to walk a source and populate the destination."""
|
||||||
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
|
src_dir = os.path.join(HERE, 'instance')
|
||||||
|
generator = ssg.StaticSiteGenerator(src_dir, tmpdir)
|
||||||
|
generator.build_in_destination(os.path.join(src_dir, 'pages'), tmpdir)
|
||||||
|
|
||||||
|
assert not os.path.exists(os.path.join(tmpdir, '.ignored-file.md'))
|
||||||
|
Loading…
Reference in New Issue
Block a user