mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
License & doc generator
This commit is contained in:
parent
e4a69c5e95
commit
f84011673a
11 changed files with 324 additions and 1 deletions
|
@ -1,6 +1,28 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" License
|
||||
|
||||
Copyright (C) 2013 YunoHost
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, see http://www.gnu.org/licenses
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
Generate JSON specification files API
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import yaml
|
||||
|
@ -91,7 +113,7 @@ def main():
|
|||
name = arg_params['full'][2:]
|
||||
else:
|
||||
name = name[2:]
|
||||
name = name.replace('-', '_')
|
||||
name = name.replace('-', '_')
|
||||
|
||||
if 'nargs' in arg_params:
|
||||
if arg_params['nargs'] == '*':
|
||||
|
|
111
generate_function_doc.py
Executable file
111
generate_function_doc.py
Executable file
|
@ -0,0 +1,111 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" License
|
||||
|
||||
Copyright (C) 2013 YunoHost
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, see http://www.gnu.org/licenses
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
Generate function header documentation
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
def main():
|
||||
"""
|
||||
|
||||
"""
|
||||
with open('action_map.yml') as f:
|
||||
action_map = yaml.load(f)
|
||||
|
||||
resources = {}
|
||||
|
||||
del action_map['general_arguments']
|
||||
for category, category_params in action_map.items():
|
||||
if 'category_help' not in category_params: category_params['category_help'] = ''
|
||||
|
||||
with open('yunohost_'+ category, 'r') as f:
|
||||
lines = f.readlines()
|
||||
with open('yunohost_'+ category, 'w') as f:
|
||||
in_block = False
|
||||
for line in lines:
|
||||
if re.search(r'^""" yunohost_'+ category, line):
|
||||
in_block = True
|
||||
if in_block:
|
||||
if re.search(r'^"""', line):
|
||||
in_block = False
|
||||
f.write('\n')
|
||||
f.write(category_params['category_help'] +'\n')
|
||||
f.write('"""' +'\n')
|
||||
else:
|
||||
f.write(line)
|
||||
|
||||
for action, action_params in category_params['actions'].items():
|
||||
if 'action_help' not in action_params:
|
||||
action_params['action_help'] = ''
|
||||
|
||||
help_lines = [
|
||||
' """',
|
||||
' '+ action_params['action_help'],
|
||||
''
|
||||
]
|
||||
|
||||
if 'arguments' in action_params:
|
||||
help_lines.append(' Keyword argument:')
|
||||
for arg_name, arg_params in action_params['arguments'].items():
|
||||
if 'help' in arg_params:
|
||||
help = ' -- '+ arg_params['help']
|
||||
else:
|
||||
help = ''
|
||||
name = arg_name.replace('-', '_')
|
||||
if name[0] == '_':
|
||||
required = False
|
||||
if 'full' in arg_params:
|
||||
name = arg_params['full'][2:]
|
||||
else:
|
||||
name = name[2:]
|
||||
name = name.replace('-', '_')
|
||||
|
||||
help_lines.append(' '+ name + help)
|
||||
|
||||
help_lines.append(' """')
|
||||
help_lines.append('')
|
||||
|
||||
with open('yunohost_'+ category, 'r') as f:
|
||||
lines = f.readlines()
|
||||
with open('yunohost_'+ category, 'w') as f:
|
||||
in_block = False
|
||||
first_quotes = True
|
||||
for line in lines:
|
||||
if re.search(r'^def '+ category +'_'+ action, line):
|
||||
in_block = True
|
||||
if in_block:
|
||||
if re.search(r'^ """', line):
|
||||
if first_quotes:
|
||||
first_quotes = False
|
||||
else:
|
||||
in_block = False
|
||||
for help_line in help_lines:
|
||||
f.write(help_line +'\n')
|
||||
else:
|
||||
f.write(line)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
22
yunohost.py
22
yunohost.py
|
@ -1,5 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" License
|
||||
|
||||
Copyright (C) 2013 YunoHost
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, see http://www.gnu.org/licenses
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
YunoHost core classes & functions
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
try:
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" License
|
||||
|
||||
Copyright (C) 2013 YunoHost
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, see http://www.gnu.org/licenses
|
||||
|
||||
"""
|
||||
|
||||
""" yunohost_app.py
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" License
|
||||
|
||||
Copyright (C) 2013 YunoHost
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, see http://www.gnu.org/licenses
|
||||
|
||||
"""
|
||||
|
||||
""" yunohost_backup.py
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" License
|
||||
|
||||
Copyright (C) 2013 YunoHost
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, see http://www.gnu.org/licenses
|
||||
|
||||
"""
|
||||
|
||||
""" yunohost_domain.py
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import datetime
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" License
|
||||
|
||||
Copyright (C) 2013 YunoHost
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, see http://www.gnu.org/licenses
|
||||
|
||||
"""
|
||||
|
||||
""" yunohost_dyndns.py
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import requests
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" License
|
||||
|
||||
Copyright (C) 2013 YunoHost
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, see http://www.gnu.org/licenses
|
||||
|
||||
"""
|
||||
|
||||
""" yunohost_firewall.py
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
try:
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" License
|
||||
|
||||
Copyright (C) 2013 YunoHost
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, see http://www.gnu.org/licenses
|
||||
|
||||
"""
|
||||
|
||||
""" yunohost_monitor.py
|
||||
"""
|
||||
import xmlrpclib
|
||||
import json
|
||||
import psutil
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" License
|
||||
|
||||
Copyright (C) 2013 YunoHost
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, see http://www.gnu.org/licenses
|
||||
|
||||
"""
|
||||
|
||||
""" yunohost_tools.py
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import yaml
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" License
|
||||
|
||||
Copyright (C) 2013 YunoHost
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, see http://www.gnu.org/licenses
|
||||
|
||||
"""
|
||||
|
||||
""" yunohost_user.py
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import ldap
|
||||
|
|
Loading…
Add table
Reference in a new issue