Skip to content

Commit

Permalink
Add stub work for proxy targets
Browse files Browse the repository at this point in the history
  • Loading branch information
rnixx committed Jun 17, 2024
1 parent 64da216 commit a84678e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 7 deletions.
23 changes: 23 additions & 0 deletions src/mxmake/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,3 +525,26 @@ def template_variables(self):
if not site["extension_ids"]:
site["extension_ids"] = ["plone.volto:default"]
return vars


##############################################################################
# proxy targets template
##############################################################################


@template("proxy")
class ProxyMk(MxIniBoundTemplate):
description: str = "Contains proxy targets for Makefiles of source folders"
target_name = "proxy.mk"
template_name = "proxy.mk"

@property
def target_folder(self) -> Path:
return mxmake_files()

@property
def template_variables(self):
targets = {}
for key, value in self.settings.items():
...
return targets
42 changes: 35 additions & 7 deletions src/mxmake/tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Template(templates.Template):
"makefile": templates.Makefile,
"mx.ini": templates.MxIni,
"pip-conf": templates.PipConf,
"proxy": templates.ProxyMk,
"run-coverage": templates.CoverageScript,
"run-tests": templates.TestScript,
"topics.md": templates.Topics,
Expand Down Expand Up @@ -830,13 +831,6 @@ def test_MxIni(self, tempdir):
@testing.template_directory()
def test_PloneSite_all_defaults(self, tempdir):
mxini = tempdir / "mx.ini"
with mxini.open("w") as fd:
fd.write(
"[settings]\n"
"\n"
"[mxmake-plone-site]\n"
"distribution = mxmake.test:default\n"
)
with mxini.open("w") as fd:
fd.write("[settings]\n")
configuration = mxdev.Configuration(mxini, hooks=[hook.Hook()])
Expand Down Expand Up @@ -928,3 +922,37 @@ def asbool(value: str|bool|None) -> bool:
''',
f.read(),
)

@testing.template_directory()
def test_ProxyMk(self, tempdir):
mxini = tempdir / "mx.ini"
with mxini.open("w") as fd:
fd.write(
"[settings]\n"
"\n"
"[mxmake-proxy]\n"
"folder1 = *\n"
"folder2 =\n"
" applications.plone\n"
" i18n-lingua\n"
)
configuration = mxdev.Configuration(mxini, hooks=[hook.Hook()])
factory = templates.template.lookup("proxy")
template = factory(configuration, templates.get_template_environment())

self.assertEqual(template.description, "Contains proxy targets for Makefiles of source folders")
self.assertEqual(template.target_folder, utils.mxmake_files())
self.assertEqual(template.target_name, "proxy.mk")
self.assertEqual(template.template_name, "proxy.mk")
self.assertEqual(
template.template_variables,
{}
)

#template.write()
#with (tempdir / "proxy.mk").open() as f:
# self.checkOutput(
# '''
# ''',
# f.read(),
# )

0 comments on commit a84678e

Please sign in to comment.