This repository was archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerator
More file actions
111 lines (81 loc) · 4.13 KB
/
generator
File metadata and controls
111 lines (81 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env python
"""
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
This file is part of the Smart Developer Hub Project:
http://www.smartdeveloperhub.org
Center for Open Middleware
http://www.centeropenmiddleware.com/
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
Copyright (C) 2015 Center for Open Middleware.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
"""
# Import Generator files
from utils import download
from utils import repository
from utils import parse
from utils import code
# Import other libraries
import settings
__author__ = 'Alejandro F. Carrera'
# Main
if __name__ == '__main__':
settings.print_message(" * [%s] Started" % settings.LONGNAME)
try:
# Get and Clone Repositories
settings.print_message(" * [%s] Checking and clone Repositories ... " % settings.LONGNAME)
__repo_gl = download.get_repo_gitlab()
# Get Branches information [filter]
__gl_branches = repository.get_branches_with_filter(
__repo_gl, settings.GEN_GL_BRANCH
)
# Replace -[filter] by blank and others unnecessary branches
__gl_branches = repository.remove_info_from_branches(
__gl_branches, settings.GEN_GL_BRANCH, settings.GEN_GL_BRANCH_REMOVE
)
# Get diff between branches
__gen_branches_rt = map(lambda x: x + "-" + settings.GEN_GL_BRANCH, __gl_branches)
# Generate Pypi configuration file
code.generate_pypi_settings()
settings.print_message(" * [%s] Generating documentation ... " % settings.LONGNAME)
for i in __gen_branches_rt:
# Checkout to specific branch
repository.move_to_specific_branch(__repo_gl, i)
# Generate documentation
repository.generate_doc(i)
# Move only HTML API Docs
repository.move_docs_folder(settings.GEN_DOC_DISK_PATH + "/api", settings.GEN_DOC_DISK_PATH)
# Remove unnecessary files
repository.remove_file(settings.GEN_DOC_DISK_PATH + "/deploy_key_multiple_projects.html")
repository.remove_file(settings.GEN_DOC_DISK_PATH + "/deploy_keys.html")
repository.remove_file(settings.GEN_DOC_DISK_PATH + "/settings.html")
repository.remove_file(settings.GEN_DOC_DISK_PATH + "/services.html")
repository.remove_file(settings.GEN_DOC_DISK_PATH + "/README.html")
repository.remove_file(settings.GEN_DOC_DISK_PATH + "/oauth2.html")
repository.remove_file(settings.GEN_DOC_DISK_PATH + "/keys.html")
# !! TODO: This version is not compatible with these docs
repository.remove_file(settings.GEN_DOC_DISK_PATH + "/merge_requests.html")
repository.remove_file(settings.GEN_DOC_DISK_PATH + "/milestones.html")
repository.remove_file(settings.GEN_DOC_DISK_PATH + "/issues.html")
# Parse and generate code
md = parse.generate_meta_code(settings.GEN_DOC_DISK_PATH)
# Save Metadata Structure
code.save_json_metadata(md)
# Generate Python code
code.generate_pycode()
# Generate settings file
code.generate_settings(i.replace("-" + settings.GEN_GL_BRANCH, ""))
# Upload Pypi package
code.upload_package()
except Exception as e:
settings.print_error(" * [%s] %s" % (settings.LONGNAME, e.message))
settings.print_message(" * [%s] Finished" % settings.LONGNAME)