wexample-filestate-git 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.1
2
+ Name: wexample-filestate-git
3
+ Version: 0.0.2
4
+ Summary: An extension for "filestate" package, which adds GIT management operations.
5
+ Home-page: https://github.com/wexample/python-filestate-git
6
+ Author: weeger
7
+ Author-email: contact@wexample.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+
15
+ # filestate
16
+
17
+ `filestate` is a Python package that allows you to manage the state of files and directories using YAML configuration files.
18
+
19
+ ## Features
20
+
21
+ - **Apply and Modify Permissions and Ownership**: Manage file and directory permissions and ownership individually or recursively.
22
+ - **Create, Modify, and Delete Directories**: Use patterns and regex to create, modify, and delete directories and subdirectories (e.g., ensure each `Entity/MyEntity.php` file has a corresponding `Repository/MyEntityRepository.php`).
23
+ - **Create Files Using Templates and Placeholders**: Generate files from templates with dynamic placeholders.
24
+
25
+ ## Installation
26
+
27
+ Install `filestate` with pip:
28
+
29
+ pip install wexample-filestate
30
+
31
+ ## Usage
32
+
33
+ ### Configuration File Example
34
+
35
+ ```yaml
36
+ # example.yaml
37
+ children:
38
+ - path: /path/to/file
39
+ owner: user
40
+ group: group
41
+ mode: '0644'
42
+ - path: /path/to/directory
43
+ recursive: true
44
+ mode: '0755'
45
+ create: true
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ Here's how you can use filestate in your Python code:
51
+
52
+ ```
53
+ from filestate import FileStateManager
54
+
55
+ # Initialize the state manager with the root directory
56
+ state_manager = FileStateManager('root/directory/')
57
+
58
+ # Configure the state manager from a YAML configuration file
59
+ state_manager.configure_from_file('configuration.yaml')
60
+
61
+ # Perform a dry run to see what changes would be made
62
+ result = state_manager.dry_run()
63
+ result.print()
64
+
65
+ # Check if the configuration can be successfully applied
66
+ if state_manager.succeed():
67
+ # Apply the configuration
68
+ state_manager.apply()
69
+ else:
70
+ print("Configuration could not be applied successfully.")
71
+
72
+ ```
73
+
74
+ ### Applying and Modifying Permissions
75
+
76
+ ```
77
+ state_manager = FileStateManager('/var/www/')
78
+ state_manager.configure({
79
+ 'files': [
80
+ {'path': '/var/www/index.html', 'owner': 'www-data', 'group': 'www-data', 'mode': '0644'},
81
+ {'path': '/var/www/css/', 'recursive': True, 'owner': 'www-data', 'group': 'www-data', 'mode': '0755'}
82
+ ]
83
+ })
84
+ state_manager.apply()
85
+ ```
86
+
87
+ ### Applying and Modifying Permissions
88
+
89
+ ```
90
+ state_manager = FileStateManager('/project/')
91
+ state_manager.configure({
92
+ 'directories': [
93
+ {'path': '/project/src/Entity/', 'create': True},
94
+ {'path': '/project/src/Repository/', 'create': True, 'pattern': 'Entity/*Entity.php', 'target': 'Repository/*Repository.php'}
95
+ ]
96
+ })
97
+ state_manager.apply()
98
+ ```
99
+
100
+ ## Testing
101
+
102
+ pytest -s pip/filestate/tests/
103
+
104
+ ## License
105
+
106
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,92 @@
1
+ # filestate
2
+
3
+ `filestate` is a Python package that allows you to manage the state of files and directories using YAML configuration files.
4
+
5
+ ## Features
6
+
7
+ - **Apply and Modify Permissions and Ownership**: Manage file and directory permissions and ownership individually or recursively.
8
+ - **Create, Modify, and Delete Directories**: Use patterns and regex to create, modify, and delete directories and subdirectories (e.g., ensure each `Entity/MyEntity.php` file has a corresponding `Repository/MyEntityRepository.php`).
9
+ - **Create Files Using Templates and Placeholders**: Generate files from templates with dynamic placeholders.
10
+
11
+ ## Installation
12
+
13
+ Install `filestate` with pip:
14
+
15
+ pip install wexample-filestate
16
+
17
+ ## Usage
18
+
19
+ ### Configuration File Example
20
+
21
+ ```yaml
22
+ # example.yaml
23
+ children:
24
+ - path: /path/to/file
25
+ owner: user
26
+ group: group
27
+ mode: '0644'
28
+ - path: /path/to/directory
29
+ recursive: true
30
+ mode: '0755'
31
+ create: true
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ Here's how you can use filestate in your Python code:
37
+
38
+ ```
39
+ from filestate import FileStateManager
40
+
41
+ # Initialize the state manager with the root directory
42
+ state_manager = FileStateManager('root/directory/')
43
+
44
+ # Configure the state manager from a YAML configuration file
45
+ state_manager.configure_from_file('configuration.yaml')
46
+
47
+ # Perform a dry run to see what changes would be made
48
+ result = state_manager.dry_run()
49
+ result.print()
50
+
51
+ # Check if the configuration can be successfully applied
52
+ if state_manager.succeed():
53
+ # Apply the configuration
54
+ state_manager.apply()
55
+ else:
56
+ print("Configuration could not be applied successfully.")
57
+
58
+ ```
59
+
60
+ ### Applying and Modifying Permissions
61
+
62
+ ```
63
+ state_manager = FileStateManager('/var/www/')
64
+ state_manager.configure({
65
+ 'files': [
66
+ {'path': '/var/www/index.html', 'owner': 'www-data', 'group': 'www-data', 'mode': '0644'},
67
+ {'path': '/var/www/css/', 'recursive': True, 'owner': 'www-data', 'group': 'www-data', 'mode': '0755'}
68
+ ]
69
+ })
70
+ state_manager.apply()
71
+ ```
72
+
73
+ ### Applying and Modifying Permissions
74
+
75
+ ```
76
+ state_manager = FileStateManager('/project/')
77
+ state_manager.configure({
78
+ 'directories': [
79
+ {'path': '/project/src/Entity/', 'create': True},
80
+ {'path': '/project/src/Repository/', 'create': True, 'pattern': 'Entity/*Entity.php', 'target': 'Repository/*Repository.php'}
81
+ ]
82
+ })
83
+ state_manager.apply()
84
+ ```
85
+
86
+ ## Testing
87
+
88
+ pytest -s pip/filestate/tests/
89
+
90
+ ## License
91
+
92
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,25 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='wexample-filestate-git',
5
+ version=open('version.txt').read(),
6
+ author='weeger',
7
+ author_email='contact@wexample.com',
8
+ description='An extension for "filestate" package, which adds GIT management operations.',
9
+ long_description=open('README.md').read(),
10
+ long_description_content_type='text/markdown',
11
+ url='https://github.com/wexample/python-filestate-git',
12
+ packages=find_packages(),
13
+ classifiers=[
14
+ 'Programming Language :: Python :: 3',
15
+ 'License :: OSI Approved :: MIT License',
16
+ 'Operating System :: OS Independent',
17
+ ],
18
+ install_requires=[
19
+ 'gitpython',
20
+ 'pydantic',
21
+ 'wexample-filestate',
22
+ 'wexample-helpers',
23
+ ],
24
+ python_requires='>=3.6',
25
+ )
@@ -0,0 +1,12 @@
1
+
2
+ from wexample_filestate.test.abstract_state_manager_test import AbstractStateManagerTest
3
+ from wexample_filestate_git.test.mixin.test_git_state_manager_mixin import TestGitFileStateManagerMixin
4
+
5
+
6
+ class TestGitFileStateManager(TestGitFileStateManagerMixin, AbstractStateManagerTest):
7
+ def test_setup(self):
8
+ from wexample_filestate_git.operations_provider.git_operations_provider import GitOperationsProvider
9
+ from wexample_filestate_git.options_provider.git_options_provider import GitOptionsProvider
10
+
11
+ assert GitOptionsProvider in self.state_manager.options_providers
12
+ assert GitOperationsProvider in self.state_manager.operations_providers
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.1
2
+ Name: wexample-filestate-git
3
+ Version: 0.0.2
4
+ Summary: An extension for "filestate" package, which adds GIT management operations.
5
+ Home-page: https://github.com/wexample/python-filestate-git
6
+ Author: weeger
7
+ Author-email: contact@wexample.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+
15
+ # filestate
16
+
17
+ `filestate` is a Python package that allows you to manage the state of files and directories using YAML configuration files.
18
+
19
+ ## Features
20
+
21
+ - **Apply and Modify Permissions and Ownership**: Manage file and directory permissions and ownership individually or recursively.
22
+ - **Create, Modify, and Delete Directories**: Use patterns and regex to create, modify, and delete directories and subdirectories (e.g., ensure each `Entity/MyEntity.php` file has a corresponding `Repository/MyEntityRepository.php`).
23
+ - **Create Files Using Templates and Placeholders**: Generate files from templates with dynamic placeholders.
24
+
25
+ ## Installation
26
+
27
+ Install `filestate` with pip:
28
+
29
+ pip install wexample-filestate
30
+
31
+ ## Usage
32
+
33
+ ### Configuration File Example
34
+
35
+ ```yaml
36
+ # example.yaml
37
+ children:
38
+ - path: /path/to/file
39
+ owner: user
40
+ group: group
41
+ mode: '0644'
42
+ - path: /path/to/directory
43
+ recursive: true
44
+ mode: '0755'
45
+ create: true
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ Here's how you can use filestate in your Python code:
51
+
52
+ ```
53
+ from filestate import FileStateManager
54
+
55
+ # Initialize the state manager with the root directory
56
+ state_manager = FileStateManager('root/directory/')
57
+
58
+ # Configure the state manager from a YAML configuration file
59
+ state_manager.configure_from_file('configuration.yaml')
60
+
61
+ # Perform a dry run to see what changes would be made
62
+ result = state_manager.dry_run()
63
+ result.print()
64
+
65
+ # Check if the configuration can be successfully applied
66
+ if state_manager.succeed():
67
+ # Apply the configuration
68
+ state_manager.apply()
69
+ else:
70
+ print("Configuration could not be applied successfully.")
71
+
72
+ ```
73
+
74
+ ### Applying and Modifying Permissions
75
+
76
+ ```
77
+ state_manager = FileStateManager('/var/www/')
78
+ state_manager.configure({
79
+ 'files': [
80
+ {'path': '/var/www/index.html', 'owner': 'www-data', 'group': 'www-data', 'mode': '0644'},
81
+ {'path': '/var/www/css/', 'recursive': True, 'owner': 'www-data', 'group': 'www-data', 'mode': '0755'}
82
+ ]
83
+ })
84
+ state_manager.apply()
85
+ ```
86
+
87
+ ### Applying and Modifying Permissions
88
+
89
+ ```
90
+ state_manager = FileStateManager('/project/')
91
+ state_manager.configure({
92
+ 'directories': [
93
+ {'path': '/project/src/Entity/', 'create': True},
94
+ {'path': '/project/src/Repository/', 'create': True, 'pattern': 'Entity/*Entity.php', 'target': 'Repository/*Repository.php'}
95
+ ]
96
+ })
97
+ state_manager.apply()
98
+ ```
99
+
100
+ ## Testing
101
+
102
+ pytest -s pip/filestate/tests/
103
+
104
+ ## License
105
+
106
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,16 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ tests/test_git_file_state_manager.py
5
+ wexample_filestate_git/__init__.py
6
+ wexample_filestate_git.egg-info/.gitignore
7
+ wexample_filestate_git.egg-info/PKG-INFO
8
+ wexample_filestate_git.egg-info/README.md
9
+ wexample_filestate_git.egg-info/SOURCES.txt
10
+ wexample_filestate_git.egg-info/dependency_links.txt
11
+ wexample_filestate_git.egg-info/requires.txt
12
+ wexample_filestate_git.egg-info/setup.py
13
+ wexample_filestate_git.egg-info/top_level.txt
14
+ wexample_filestate_git.egg-info/version.txt
15
+ wexample_filestate_git.egg-info/.wex/.env
16
+ wexample_filestate_git.egg-info/.wex/config.yml
@@ -0,0 +1,4 @@
1
+ gitpython
2
+ pydantic
3
+ wexample-filestate
4
+ wexample-helpers
@@ -0,0 +1 @@
1
+ wexample_filestate_git