Skip to content

Commit

Permalink
Remove one layer in the backend folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ericof committed May 16, 2024
1 parent 6861170 commit 910a048
Show file tree
Hide file tree
Showing 30 changed files with 43 additions and 305 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8"?>
<layers>
<layer interface="{{ cookiecutter.python_package_name }}.interfaces.IBrowserLayer"
name="{{ cookiecutter.python_package_name }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>
<?xml version='1.0' encoding='utf-8'?>
<metadata>
<version>{{ cookiecutter.__profile_version }}</version>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8"?>
<theme>
<name>barceloneta</name>
<enabled>true</enabled>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8"?>
<object meta_type="Plone Types Tool"
name="portal_types"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8"?>
<layers>
<layer name="{{ cookiecutter.python_package_name }}"
remove="true"
Expand Down
10 changes: 3 additions & 7 deletions project/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
context: OrderedDict = {{cookiecutter}}


BACKEND_ADDON_REMOVE = [
".github",
".git"
]
BACKEND_ADDON_REMOVE = [".github", ".git"]

FRONTEND_ADDON_REMOVE = [".github"]

Expand Down Expand Up @@ -52,9 +49,8 @@ def prepare_devops(context: OrderedDict, output_dir: Path):

def generate_backend_addon(context, output_dir):
"""Run Plone Addon generator."""
# Go to backend/src/
output_dir = output_dir / "backend" / "src"
folder_name = context.get("python_package_name")
output_dir = output_dir
folder_name = "backend"
# Do not initialize the repository
context["__backend_addon_git_initialize"] = "0"
generator.generate_subtemplate(
Expand Down
1 change: 0 additions & 1 deletion project/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def context(cookieplone_root) -> dict:
}



@pytest.fixture(scope="session")
def context_devops_cache(context) -> dict:
"""Cookiecutter context."""
Expand Down
22 changes: 11 additions & 11 deletions project/tests/test_project_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

BACKEND_FILES = [
".dockerignore",
".gitattributes",
".gitignore",
"Dockerfile.acceptance",
"Dockerfile",
Expand All @@ -28,14 +27,14 @@ def test_backend_top_level_files(cutter_result, filename: str):

BACKEND_PACKAGE_FILES_PYTEST = [
"src/ploneorgbr/setup.py",
"src/plonegov.ploneorgbr/src/plonegov/ploneorgbr/configure.zcml",
"src/plonegov.ploneorgbr/src/plonegov/ploneorgbr/dependencies.zcml",
"src/plonegov.ploneorgbr/src/plonegov/ploneorgbr/permissions.zcml",
"src/plonegov.ploneorgbr/src/plonegov/ploneorgbr/profiles.zcml",
"src/plonegov.ploneorgbr/src/plonegov/ploneorgbr/testing.py",
"src/ploneorgbr/tests/conftest.py",
"src/ploneorgbr/tests/setup/test_setup_install.py",
"src/ploneorgbr/tests/setup/test_setup_uninstall.py",
"src/plonegov/ploneorgbr/configure.zcml",
"src/plonegov/ploneorgbr/dependencies.zcml",
"src/plonegov/ploneorgbr/permissions.zcml",
"src/plonegov/ploneorgbr/profiles.zcml",
"src/plonegov/ploneorgbr/testing.py",
"tests/conftest.py",
"tests/setup/test_setup_install.py",
"tests/setup/test_setup_uninstall.py",
]


Expand All @@ -48,10 +47,11 @@ def test_backend_package_files_pytest(cutter_result, filename: str):


FILES_TO_BE_REMOVED = [
"src/plonegov.ploneorgbr/.github",
"src/plonegov.ploneorgbr/.git",
".github",
".git",
]


@pytest.mark.parametrize("filename", FILES_TO_BE_REMOVED)
def test_backend_package_files_removed(cutter_result, filename: str):
"""Test backend package files are removed."""
Expand Down
4 changes: 2 additions & 2 deletions project/tests/test_project_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import pytest

CACHE_FILES = [
"backend/src/plonegov.ploneorgbr/src/plonegov/ploneorgbr/profiles/default/registry/plone.cachepurging.interfaces.ICachePurgingSettings.xml",
"backend/src/plonegov.ploneorgbr/src/plonegov/ploneorgbr/profiles/default/registry/plone.caching.interfaces.ICacheSettings.xml",
"backend/src/plonegov/ploneorgbr/profiles/default/registry/plone.cachepurging.interfaces.ICachePurgingSettings.xml",
"backend/src/plonegov/ploneorgbr/profiles/default/registry/plone.caching.interfaces.ICacheSettings.xml",
"devops/varnish/Dockerfile",
"devops/varnish/etc/varnish.vcl",
]
Expand Down
8 changes: 4 additions & 4 deletions project/tests/test_project_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def test_valid_json_files(cutter_result, filepath: str):
[".github/workflows/frontend.yml", "github-workflow"],
[".github/workflows/manual_deploy.yml", "github-workflow"],
[".github/workflows/varnish.yml", "github-workflow"],
[
"backend/src/plonegov.ploneorgbr/.pre-commit-config.yaml",
"pre-commit-config",
],
[".pre-commit-config.yaml", "pre-commit-config"],
["backend/.pre-commit-config.yaml", "pre-commit-config"],
["frontend/.pre-commit-config.yaml", "pre-commit-config"],
["docker-compose.yml", "docker-compose"],
["frontend/package.json", "package"],
["frontend/packages/volto-ploneorgbr/package.json", "package"],
["frontend/packages/volto-ploneorgbr/tsconfig.json", "tsconfig"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ repos:
- id: sub-pre-commit
alias: backend
name: "pre-commit for backend/"
args: ["-p", "backend/src/ploneorg.brasil"]
files: "^backend/src/ploneorg.brasil/.*"
args: ["-p", "backend/"]
files: "^backend/.*"
stages: ["commit"]
- id: sub-pre-commit
alias: frontend
Expand Down
15 changes: 7 additions & 8 deletions project/{{ cookiecutter.__folder_name }}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ MAKEFLAGS+=--warn-undefined-variables
MAKEFLAGS+=--no-builtin-rules

CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
GIT_FOLDER=$(BACKEND_FOLDER)/.git
GIT_FOLDER=$(CURRENT_DIR)/.git

PROJECT_NAME={{ cookiecutter.project_slug }}
STACK_NAME={{ cookiecutter.__devops_stack_name }}

PRE_COMMIT = pipx run --spec "pre-commit=={{ cookiecutter.__pre_commit_version }}"
PRE_COMMIT=pipx run --spec 'pre-commit=={{ cookiecutter.__pre_commit_version }}' pre-commit

# We like colors
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
Expand Down Expand Up @@ -81,14 +81,14 @@ backend-test: ## Test backend codebase
install: ## Install
@echo "Install Backend & Frontend"
if [ -d $(GIT_FOLDER) ]; then $(PRE_COMMIT) install; else echo "$(RED) Not installing pre-commit$(RESET)";fi
$(MAKE) install-backend
$(MAKE) install-frontend
$(MAKE) backend-install
$(MAKE) frontend-install

.PHONY: start
start: ## Start
@echo "Starting application"
$(MAKE) start-backend
$(MAKE) start-frontend
$(MAKE) backend-start
$(MAKE) frontend-start

.PHONY: clean
clean: ## Clean installation
Expand All @@ -99,8 +99,7 @@ clean: ## Clean installation
.PHONY: check
check: ## Lint and Format codebase
@echo "Lint and Format codebase"
$(MAKE) -C "./backend/" check
$(MAKE) -C "./frontend/" check
$(PRE_COMMIT) run -a

.PHONY: i18n
i18n: ## Update locales
Expand Down

This file was deleted.

43 changes: 0 additions & 43 deletions project/{{ cookiecutter.__folder_name }}/backend/.gitignore

This file was deleted.

139 changes: 0 additions & 139 deletions project/{{ cookiecutter.__folder_name }}/backend/Makefile

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions project/{{ cookiecutter.__folder_name }}/backend/mx.ini

This file was deleted.

Loading

0 comments on commit 910a048

Please sign in to comment.