wexample-filestate 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,113 @@
1
+ Metadata-Version: 2.1
2
+ Name: wexample-filestate
3
+ Version: 0.0.2
4
+ Summary: A tool for managing file states, with configuration files in YAML.
5
+ Home-page: https://github.com/wexample/python-filestate
6
+ Author: weeger
7
+ Author-email: contact@wexample.com
8
+ License: UNKNOWN
9
+ Platform: UNKNOWN
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.6
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+
17
+ # filestate
18
+
19
+ `filestate` is a Python package that allows you to manage the state of files and directories using YAML configuration files.
20
+
21
+ ## Features
22
+
23
+ - **Apply and Modify Permissions and Ownership**: Manage file and directory permissions and ownership individually or recursively.
24
+ - **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`).
25
+ - **Create Files Using Templates and Placeholders**: Generate files from templates with dynamic placeholders.
26
+
27
+ ## Installation
28
+
29
+ Install `filestate` with pip:
30
+
31
+ pip install wexample-filestate
32
+
33
+ ## Usage
34
+
35
+ ### Configuration File Example
36
+
37
+ ```yaml
38
+ # example.yaml
39
+ files:
40
+ - path: /path/to/file
41
+ owner: user
42
+ group: group
43
+ mode: '0644'
44
+ directories:
45
+ - path: /path/to/directory
46
+ recursive: true
47
+ mode: '0755'
48
+ create: true
49
+ templates:
50
+ - path: /path/to/output/file
51
+ template: /path/to/template/file
52
+ placeholders:
53
+ placeholder1: value1
54
+ placeholder2: value2
55
+ ```
56
+
57
+ ## Usage
58
+
59
+ Here's how you can use filestate in your Python code:
60
+
61
+ ```
62
+ from filestate import FileStateManager
63
+
64
+ # Initialize the state manager with the root directory
65
+ state_manager = FileStateManager('root/directory/')
66
+
67
+ # Configure the state manager from a YAML configuration file
68
+ state_manager.configure_from_file('configuration.yaml')
69
+
70
+ # Perform a dry run to see what changes would be made
71
+ result = state_manager.dry_run()
72
+ result.print()
73
+
74
+ # Check if the configuration can be successfully applied
75
+ if state_manager.succeed():
76
+ # Apply the configuration
77
+ state_manager.apply()
78
+ else:
79
+ print("Configuration could not be applied successfully.")
80
+
81
+ ```
82
+
83
+ ### Applying and Modifying Permissions
84
+
85
+ ```
86
+ state_manager = FileStateManager('/var/www/')
87
+ state_manager.configure({
88
+ 'files': [
89
+ {'path': '/var/www/index.html', 'owner': 'www-data', 'group': 'www-data', 'mode': '0644'},
90
+ {'path': '/var/www/css/', 'recursive': True, 'owner': 'www-data', 'group': 'www-data', 'mode': '0755'}
91
+ ]
92
+ })
93
+ state_manager.apply()
94
+ ```
95
+
96
+ ### Applying and Modifying Permissions
97
+
98
+ ```
99
+ state_manager = FileStateManager('/project/')
100
+ state_manager.configure({
101
+ 'directories': [
102
+ {'path': '/project/src/Entity/', 'create': True},
103
+ {'path': '/project/src/Repository/', 'create': True, 'pattern': 'Entity/*Entity.php', 'target': 'Repository/*Repository.php'}
104
+ ]
105
+ })
106
+ state_manager.apply()
107
+ ```
108
+
109
+ ## License
110
+
111
+ This project is licensed under the MIT License - see the LICENSE file for details.
112
+
113
+
@@ -0,0 +1,95 @@
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
+ files:
24
+ - path: /path/to/file
25
+ owner: user
26
+ group: group
27
+ mode: '0644'
28
+ directories:
29
+ - path: /path/to/directory
30
+ recursive: true
31
+ mode: '0755'
32
+ create: true
33
+ templates:
34
+ - path: /path/to/output/file
35
+ template: /path/to/template/file
36
+ placeholders:
37
+ placeholder1: value1
38
+ placeholder2: value2
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ Here's how you can use filestate in your Python code:
44
+
45
+ ```
46
+ from filestate import FileStateManager
47
+
48
+ # Initialize the state manager with the root directory
49
+ state_manager = FileStateManager('root/directory/')
50
+
51
+ # Configure the state manager from a YAML configuration file
52
+ state_manager.configure_from_file('configuration.yaml')
53
+
54
+ # Perform a dry run to see what changes would be made
55
+ result = state_manager.dry_run()
56
+ result.print()
57
+
58
+ # Check if the configuration can be successfully applied
59
+ if state_manager.succeed():
60
+ # Apply the configuration
61
+ state_manager.apply()
62
+ else:
63
+ print("Configuration could not be applied successfully.")
64
+
65
+ ```
66
+
67
+ ### Applying and Modifying Permissions
68
+
69
+ ```
70
+ state_manager = FileStateManager('/var/www/')
71
+ state_manager.configure({
72
+ 'files': [
73
+ {'path': '/var/www/index.html', 'owner': 'www-data', 'group': 'www-data', 'mode': '0644'},
74
+ {'path': '/var/www/css/', 'recursive': True, 'owner': 'www-data', 'group': 'www-data', 'mode': '0755'}
75
+ ]
76
+ })
77
+ state_manager.apply()
78
+ ```
79
+
80
+ ### Applying and Modifying Permissions
81
+
82
+ ```
83
+ state_manager = FileStateManager('/project/')
84
+ state_manager.configure({
85
+ 'directories': [
86
+ {'path': '/project/src/Entity/', 'create': True},
87
+ {'path': '/project/src/Repository/', 'create': True, 'pattern': 'Entity/*Entity.php', 'target': 'Repository/*Repository.php'}
88
+ ]
89
+ })
90
+ state_manager.apply()
91
+ ```
92
+
93
+ ## License
94
+
95
+ 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',
5
+ version=open('version.txt').read(),
6
+ author='weeger',
7
+ author_email='contact@wexample.com',
8
+ description='A tool for managing file states, with configuration files in YAML.',
9
+ long_description=open('README.md').read(),
10
+ long_description_content_type='text/markdown',
11
+ url='https://github.com/wexample/python-filestate',
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
+ 'pydantic',
20
+ 'pyyaml',
21
+ 'wexample-helpers',
22
+ 'wexample-helpers-yaml'
23
+ ],
24
+ python_requires='>=3.6',
25
+ )
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.1
2
+ Name: wexample-filestate
3
+ Version: 0.0.2
4
+ Summary: A tool for managing file states, with configuration files in YAML.
5
+ Home-page: https://github.com/wexample/python-filestate
6
+ Author: weeger
7
+ Author-email: contact@wexample.com
8
+ License: UNKNOWN
9
+ Platform: UNKNOWN
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.6
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+
17
+ # filestate
18
+
19
+ `filestate` is a Python package that allows you to manage the state of files and directories using YAML configuration files.
20
+
21
+ ## Features
22
+
23
+ - **Apply and Modify Permissions and Ownership**: Manage file and directory permissions and ownership individually or recursively.
24
+ - **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`).
25
+ - **Create Files Using Templates and Placeholders**: Generate files from templates with dynamic placeholders.
26
+
27
+ ## Installation
28
+
29
+ Install `filestate` with pip:
30
+
31
+ pip install wexample-filestate
32
+
33
+ ## Usage
34
+
35
+ ### Configuration File Example
36
+
37
+ ```yaml
38
+ # example.yaml
39
+ files:
40
+ - path: /path/to/file
41
+ owner: user
42
+ group: group
43
+ mode: '0644'
44
+ directories:
45
+ - path: /path/to/directory
46
+ recursive: true
47
+ mode: '0755'
48
+ create: true
49
+ templates:
50
+ - path: /path/to/output/file
51
+ template: /path/to/template/file
52
+ placeholders:
53
+ placeholder1: value1
54
+ placeholder2: value2
55
+ ```
56
+
57
+ ## Usage
58
+
59
+ Here's how you can use filestate in your Python code:
60
+
61
+ ```
62
+ from filestate import FileStateManager
63
+
64
+ # Initialize the state manager with the root directory
65
+ state_manager = FileStateManager('root/directory/')
66
+
67
+ # Configure the state manager from a YAML configuration file
68
+ state_manager.configure_from_file('configuration.yaml')
69
+
70
+ # Perform a dry run to see what changes would be made
71
+ result = state_manager.dry_run()
72
+ result.print()
73
+
74
+ # Check if the configuration can be successfully applied
75
+ if state_manager.succeed():
76
+ # Apply the configuration
77
+ state_manager.apply()
78
+ else:
79
+ print("Configuration could not be applied successfully.")
80
+
81
+ ```
82
+
83
+ ### Applying and Modifying Permissions
84
+
85
+ ```
86
+ state_manager = FileStateManager('/var/www/')
87
+ state_manager.configure({
88
+ 'files': [
89
+ {'path': '/var/www/index.html', 'owner': 'www-data', 'group': 'www-data', 'mode': '0644'},
90
+ {'path': '/var/www/css/', 'recursive': True, 'owner': 'www-data', 'group': 'www-data', 'mode': '0755'}
91
+ ]
92
+ })
93
+ state_manager.apply()
94
+ ```
95
+
96
+ ### Applying and Modifying Permissions
97
+
98
+ ```
99
+ state_manager = FileStateManager('/project/')
100
+ state_manager.configure({
101
+ 'directories': [
102
+ {'path': '/project/src/Entity/', 'create': True},
103
+ {'path': '/project/src/Repository/', 'create': True, 'pattern': 'Entity/*Entity.php', 'target': 'Repository/*Repository.php'}
104
+ ]
105
+ })
106
+ state_manager.apply()
107
+ ```
108
+
109
+ ## License
110
+
111
+ This project is licensed under the MIT License - see the LICENSE file for details.
112
+
113
+
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ wexample_filestate.egg-info/PKG-INFO
5
+ wexample_filestate.egg-info/SOURCES.txt
6
+ wexample_filestate.egg-info/dependency_links.txt
7
+ wexample_filestate.egg-info/requires.txt
8
+ wexample_filestate.egg-info/top_level.txt
@@ -0,0 +1,4 @@
1
+ pydantic
2
+ pyyaml
3
+ wexample-helpers
4
+ wexample-helpers-yaml