-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UP] Start working with workspace resource
- Loading branch information
1 parent
ae98b04
commit a2268c7
Showing
15 changed files
with
148 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
5 changes: 0 additions & 5 deletions
5
src/otoolbox/administrator.py → src/otoolbox/args/administrator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
def run(): | ||
print("hello from otoolbox: develoepr") | ||
|
||
|
||
def init_cli(parent_parser, **kwargs): | ||
|
||
return parent_parser |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import os | ||
import logging | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
class WorkspaceResource(): | ||
def __init__( | ||
self, | ||
path, | ||
title = None, | ||
description = None, | ||
constructors = None, | ||
destructors = None, | ||
validators = None | ||
): | ||
self.path = path | ||
self.title = title | ||
self.description = description if description else [] | ||
self.constructors = constructors if constructors else [] | ||
self.destructors = destructors if destructors else [] | ||
self.validators = validators if validators else [] | ||
|
||
# internals | ||
self.validation_errors = [] | ||
self.is_valied = False | ||
|
||
|
||
class WorkspaceResourceGroup(): | ||
def __init__(self): | ||
self.resources = [] | ||
|
||
def append(self, resource:WorkspaceResource): | ||
self.resources.append(resource) | ||
################################################################### | ||
# constructors | ||
################################################################### | ||
def makedir(context): | ||
pass | ||
|
||
|
||
|
||
################################################################### | ||
# validators | ||
################################################################### | ||
def is_readable(context): | ||
pass | ||
|
||
def is_dir(context): | ||
pass | ||
|
||
def is_file(context:WorkspaceResource): | ||
pass | ||
|
||
|
||
|
||
################################################################### | ||
# destructors | ||
################################################################### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Odoonix Toolbox | ||
|
||
This is a maintainer tool from odoonix |
0
src/otoolbox/banner.txt → src/otoolbox/data/banner.txt
100755 → 100644
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from otoolbox import env | ||
from otoolbox import base | ||
from otoolbox.base import WorkspaceResource | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
################################################################### | ||
# init | ||
################################################################### | ||
(env | ||
.add_resource(WorkspaceResource( | ||
path=env.get_workspace_path("README.md"), | ||
name="Workspace README", | ||
description="A readme that shows parts of the workspace", | ||
constructors=[ | ||
env.constructor_copy_resource("data/WORKSPACE_README.md") | ||
], | ||
destructors=[ | ||
base.delete_file | ||
], | ||
validators=[ | ||
base.is_file, | ||
base.is_readable | ||
] | ||
)) | ||
) |