wexample-wex-addon-dev-php 0.0.1__tar.gz → 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wexample-wex-addon-dev-php
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Python dev addon for wex
5
5
  Author-Email: weeger <contact@wexample.com>
6
6
  License: MIT
@@ -10,7 +10,7 @@ Classifier: Operating System :: OS Independent
10
10
  Project-URL: homepage, https://github.com/wexample/python-wex-dev-python
11
11
  Requires-Python: >=3.10
12
12
  Requires-Dist: pydantic<3,>=2
13
- Requires-Dist: wexample-wex-core==6.0.44
13
+ Requires-Dist: wexample-wex-core==6.0.45
14
14
  Provides-Extra: dev
15
15
  Requires-Dist: pytest; extra == "dev"
16
16
  Requires-Dist: wexample-filestate-php==0.0.1; extra == "dev"
@@ -20,7 +20,7 @@ Description-Content-Type: text/markdown
20
20
 
21
21
  Python dev addon for wex
22
22
 
23
- Version: 0.0.1
23
+ Version: 0.0.2
24
24
 
25
25
  ## Requirements
26
26
 
@@ -29,7 +29,7 @@ Version: 0.0.1
29
29
  ## Dependencies
30
30
 
31
31
  - pydantic>=2,<3
32
- - wexample-wex-core==6.0.44
32
+ - wexample-wex-core==6.0.45
33
33
 
34
34
  ## Installation
35
35
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Python dev addon for wex
4
4
 
5
- Version: 0.0.1
5
+ Version: 0.0.2
6
6
 
7
7
  ## Requirements
8
8
 
@@ -11,7 +11,7 @@ Version: 0.0.1
11
11
  ## Dependencies
12
12
 
13
13
  - pydantic>=2,<3
14
- - wexample-wex-core==6.0.44
14
+ - wexample-wex-core==6.0.45
15
15
 
16
16
  ## Installation
17
17
 
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
6
6
 
7
7
  [project]
8
8
  name = "wexample-wex-addon-dev-php"
9
- version = "0.0.1"
9
+ version = "0.0.2"
10
10
  description = "Python dev addon for wex"
11
11
  authors = [
12
12
  { name = "weeger", email = "contact@wexample.com" },
@@ -19,7 +19,7 @@ classifiers = [
19
19
  ]
20
20
  dependencies = [
21
21
  "pydantic>=2,<3",
22
- "wexample-wex-core==6.0.44",
22
+ "wexample-wex-core==6.0.45",
23
23
  ]
24
24
 
25
25
  [project.readme]
@@ -43,7 +43,7 @@ distribution = true
43
43
 
44
44
  [tool.pdm.build]
45
45
  includes = [
46
- "src/wexample_wex_addon_dev_php/py.typed",
46
+ "src/wexample_wex_addon_dev_php/*",
47
47
  ]
48
48
  package-dir = "src"
49
49
  packages = [
@@ -0,0 +1,7 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_wex_core.common.abstract_addon_manager import AbstractAddonManager
4
+
5
+
6
+ class PhpAddonManager(AbstractAddonManager):
7
+ pass
@@ -0,0 +1,28 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_config.const.types import DictConfig
4
+ from wexample_wex_addon_dev_php.workdir.php_workdir import PhpWorkdir
5
+
6
+
7
+ class PhpLaravelWorkdir(PhpWorkdir):
8
+ def prepare_value(self, raw_value: DictConfig | None = None) -> DictConfig:
9
+ from wexample_filestate.const.disk import DiskItemType
10
+
11
+ raw_value = super().prepare_value(raw_value)
12
+
13
+ children = raw_value["children"]
14
+
15
+ children.extend(
16
+ [
17
+ {
18
+ "name": "tests",
19
+ "type": DiskItemType.DIRECTORY,
20
+ "should_exist": True,
21
+ "children": [
22
+ self._create_python_file_children_filter(),
23
+ ],
24
+ },
25
+ ]
26
+ )
27
+
28
+ return raw_value
@@ -0,0 +1,7 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_wex_addon_dev_php.workdir.php_workdir import PhpWorkdir
4
+
5
+
6
+ class PhpPackageWorkdir(PhpWorkdir):
7
+ pass
@@ -0,0 +1,27 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_core.workdir.framework_packages_suite_workdir import (
6
+ FrameworkPackageSuiteWorkdir,
7
+ )
8
+
9
+ if TYPE_CHECKING:
10
+ from pathlib import Path
11
+
12
+ from wexample_wex_core.workdir.code_base_workdir import CodeBaseWorkdir
13
+
14
+
15
+ class PhpPackagesSuiteWorkdir(FrameworkPackageSuiteWorkdir):
16
+ def _get_children_package_workdir_class(self) -> type[CodeBaseWorkdir]:
17
+ from wexample_wex_addon_dev_php.workdir.php_package_workdir import (
18
+ PhpPackageWorkdir,
19
+ )
20
+
21
+ return PhpPackageWorkdir
22
+
23
+ def _get_children_package_directory_name(self) -> str:
24
+ return "composer"
25
+
26
+ def _child_is_package_directory(self, entry: Path) -> bool:
27
+ return entry.is_dir() and (entry / "composer.json").is_file()
@@ -0,0 +1,7 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_wex_addon_dev_php.workdir.php_workdir import PhpWorkdir
4
+
5
+
6
+ class PhpSymfonyWorkdir(PhpWorkdir):
7
+ pass
@@ -0,0 +1,59 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_config.const.types import DictConfig
4
+ from wexample_filestate.config_option.children_file_factory_config_option import (
5
+ ChildrenFileFactoryConfigOption,
6
+ )
7
+ from wexample_filestate.const.disk import DiskItemType
8
+ from wexample_wex_core.workdir.code_base_workdir import CodeBaseWorkdir
9
+
10
+
11
+ class PhpWorkdir(CodeBaseWorkdir):
12
+ def prepare_value(self, raw_value: DictConfig | None = None) -> DictConfig:
13
+ raw_value = super().prepare_value(raw_value=raw_value)
14
+ from wexample_helpers.helpers.array import array_dict_get_by
15
+
16
+ # Ensure a composer.json file exists for any PHP package project
17
+ children = raw_value["children"]
18
+
19
+ children.append(
20
+ {
21
+ "name": "composer.json",
22
+ "type": DiskItemType.FILE,
23
+ "should_exist": True,
24
+ }
25
+ )
26
+
27
+ # Add rules to .gitignore
28
+ array_dict_get_by("name", ".gitignore", children).setdefault(
29
+ "should_contain_lines", []
30
+ ).extend(
31
+ [
32
+ ".php-cs-fixer.cache",
33
+ ".scannerwork",
34
+ "/vendor",
35
+ ]
36
+ )
37
+
38
+ return raw_value
39
+
40
+ def get_dependencies(self) -> list[str]:
41
+ # TODO search in composer.json
42
+ return []
43
+
44
+ def _create_php_file_children_filter(self) -> ChildrenFileFactoryConfigOption:
45
+ from wexample_filestate.config_option.children_filter_config_option import (
46
+ ChildrenFilterConfigOption,
47
+ )
48
+ from wexample_filestate.const.disk import DiskItemType
49
+ from wexample_filestate_php.file.php_file import PhpFile
50
+
51
+ return ChildrenFilterConfigOption(
52
+ pattern={
53
+ "class": PhpFile,
54
+ "name_pattern": r"^.*\.php$",
55
+ "type": DiskItemType.FILE,
56
+ "python": [],
57
+ },
58
+ recursive=True,
59
+ )