def __init__(self, debug): self.localhost = './' self.debug = debug self.logpath = '/home/nicolas/Bureau' self.SqlFile = File('Sql').get_instence() self.PhpFile = File('Php').get_instence()
def __init__(self, debug=False): self.localhost = './' self.logpath = '/home/nicolas/Bureau' self.HtmlFile = File('Html').get_instence() self.JsFile = File('Js').get_instence() self.debug = debug
class htaccess(Utils): def __init__(self, debug): self.localhost = './' self.debug = debug self.HtaccessFile = File('Htaccess').get_instence() """ @command htaccess @syntax python main.py htaccess do create -p project=<value> @method create @arg str project """ def create(self, args): args = self.args(args) project = self.get_from_args('project', args) self.HtaccessFile.create(self.localhost + project) self.fill( self.localhost + project, '', 'htaccess', 'Options +FollowSymlinks -Indexes\n' + 'RewriteEngine On\n\n') """ @command htaccess @syntax python main.py htaccess do add rule -p project=<value> path=<value> dest=<value> @method add rule @arg str project @arg str path @arg str dest """ def add_rule(self, args): args = self.args(args) project = self.get_from_args('project', args) path = self.get_from_args('path', args) dest = self.get_from_args('dest', args) if dest is None: dest = self.get_from_args('destination', args) self.fill( self.localhost + project, '', 'htaccess', self.file_get_contents(self.localhost + project, '', 'htaccess') + '\nRewriteRule ^' + path + '$ ' + dest + ' [L]')
class php(Utils): def __init__(self, debug=False): self.localhost = './' self.logpath = '/home/nicolas/Bureau' self.PhpFile = File('Php').get_instence() self.debug = debug """ @command php @syntax python main.py php do create file -p name=<value> project=<value> content=<value> @method create file @arg str name @arg str project @arg? str content """ def create_file(self, args): args = self.args(args) name = self.get_from_args('name', args) project = self.get_from_args('project', args) if self.get_from_args('content', args): content = self.get_from_args('content', args) else: content = '<?php\n' + \ ' class Hello {\n' + \ ' public static function World() {\n' + \ ' echo "Hello World";\n' + \ ' }\n' + \ ' }\n' self.PhpFile.create(self.localhost + project, name) self.PhpFile.cover(self.localhost + project, name, content) """ @command php @syntax python main.py php do rm file -p name=<value> project=<value> @method rm file @arg str name @arg str project """ def rm_file(self, args): args = self.args(args) name = self.get_from_args('name', args) project = self.get_from_args('project', args) self.PhpFile.remove(self.localhost + project, name)
class js(Utils): def __init__(self, debug): self.localhost = './' self.logpath = '/home/nicolas/Bureau' self.JsFile = File('Js').get_instence() self.debug = debug """ @command js @syntax python main.py js do create script -p name=<value> project=<value> content=<value> @method create script @arg str name @arg str project @arg? str content """ def create_script(self, args): args = self.args(args) name = self.get_from_args('name', args) project = self.get_from_args('project', args) if self.get_from_args('content', args): content = self.get_from_args('content', args) else: content = 'let alert = () => {\n alert( \'Hello World\' );\n};\n' self.JsFile.create(self.localhost + project, name) self.JsFile.cover(self.localhost + project, name, content) """ @command js @syntax python main.py js do rm script -p name=<value> project=<value> @method rm script @arg str name @arg str project """ def rm_script(self, args): args = self.args(args) name = self.get_from_args('name', args) project = self.get_from_args('project', args) self.JsFile.remove(self.localhost + project + '/js', name)
def __init__(self, debug): self.localhost = './' self.debug = debug self.HtaccessFile = File('Htaccess').get_instence()
class html(Utils): def __init__(self, debug=False): self.localhost = './' self.logpath = '/home/nicolas/Bureau' self.HtmlFile = File('Html').get_instence() self.JsFile = File('Js').get_instence() self.debug = debug """ @command html @syntax python main.py html do create file -p name=<value> title=<value> project=<value> content=<value> scripts=<value> @method create file @arg str name @arg str title @arg str project @arg? str content @arg? int scripts """ def create_file(self, args): args = self.args(args) title = self.get_from_args('title', args) name = self.get_from_args('name', args) project = self.get_from_args('project', args) content = self.get_from_args('content', args) scripts = self.get_from_args('scripts', args) if scripts is not None: scripts = int(scripts) scripts_str = '' if scripts is not None: for i in range(0, scripts): script_name = 'script.js' if i > 0: script_name = 'script' + str(i) + '.js' scripts_str += '\t\t<script src="js/' + script_name + '"></script>\n' self.JsFile.create(self.localhost + project, script_name.split('.')[0]) self.HtmlFile.create(self.localhost + project, name) self.HtmlFile.cover(self.localhost + project, name, title, content, scripts_str) """ @command html @syntax python main.py html do rm file -p name=<value> project=<value> @method rm file @arg str name @arg str project """ def rm_file(self, args): args = self.args(args) name = str(self.get_from_args('name', args)) project = str(self.get_from_args('project', args)) self.rmfile(self.localhost + project, name, 'html')
def __init__(self, debug): self.localhost = './' self.debug = debug self.logpath = '/home/nicolas/Bureau' self.ImageFile = File('Image').get_instence()
class image(Utils): def __init__(self, debug): self.localhost = './' self.debug = debug self.logpath = '/home/nicolas/Bureau' self.ImageFile = File('Image').get_instence() """ @command image @syntax python main.py image do create image -p title=<value> project=<value> longueur=<value> largeure=<value> @method create image @arg str title @arg str project @arg int longueur @arg int largeure """ def create_image(self, args): args = self.args(args) project = self.get_from_args('project', args) title = self.get_from_args('title', args) longueur = self.get_from_args('L', args) if longueur is None: longueur = '500' largeure = self.get_from_args('l', args) if largeure is None: largeure = '500' content = '<?xml version="1.0" encoding="utf-8"?>\n' \ '<svg version="1.1" ' \ 'xmlns="http://www.w3.org/2000/svg" ' \ 'xmlns:xlink="http://www.w3.org/1999/xlink" ' \ 'width="' + largeure + 'px" ' \ 'height="' + longueur + 'px">' if not self.is_file(self.localhost + project + '/images/' + title + '.svg'): self.ImageFile.create(self.localhost + project, title) self.fill(self.localhost + project + '/images/', title, 'svg', content) """ @command image @syntax python main.py image do create image -p title=<value> project=<value> longueur=<value> largeure=<value> bordercolor=<value> bgcolor=<value> border_opacity=<value> border_size=<value> gb_opacity=<value> @method create image @arg str title @arg str project @arg int longueur @arg int largeure @arg str bordercolor @arg str bgcolor @arg int border_opacity @arg int border_size @arg int gb_opacity """ def carre(self, args): args = self.args(args) project = self.get_from_args('project', args) title = self.get_from_args('title', args) longueur = self.get_from_args('L', args) if longueur is None: longueur = '500' largeure = self.get_from_args('l', args) if largeure is None: largeure = '500' bordercolor = self.get_from_args('color', args) # stroke if bordercolor is None: bordercolor = '#000000' bgcolor = self.get_from_args('bgcolor', args) # fill if bgcolor is None: bgcolor = 'none' border_size = self.get_from_args('border_size', args) if border_size is None: border_size = '1' border_opacity = self.get_from_args('border_opacity', args) if border_opacity is None: border_opacity = '1' bg_opacity = self.get_from_args('bg_opacity', args) if bg_opacity is None: bg_opacity = '1' content = self.file_get_contents(self.localhost + project + '/images/', title, 'svg') content += '<rect' \ ' style="fill:' + bgcolor + ';fill-opacity:' + bg_opacity + ';stroke:' + bordercolor + ';stroke-width:' + border_size + ';stroke-opacity:' + border_opacity + '"' \ ' width="360"' \ ' height="360"' \ ' x="' + largeure + '"' \ ' y="' + longueur + '" />' self.fill(self.localhost + project + '/images/', title, 'svg', content) """ @command image @syntax python main.py image do close image -p title=<value> project=<value> @method create image @arg str title @arg str project """ def close_image(self, args): args = self.args(args) project = self.get_from_args('project', args) title = self.get_from_args('title', args) content = self.file_get_contents(self.localhost + project + '/images/', title, 'svg') content += '</svg>' self.fill(self.localhost + project + '/images/', title, 'svg', content)
def __init__(self, debug=False): self.localhost = './' self.HtmlDir = Dir('Html').get_instence() self.CssDir = Dir('Css').get_instence() self.PhpDir = Dir('Php').get_instence() self.JsDir = Dir('Js').get_instence() self.SqlDir = Dir('Sql').get_instence() self.ImgDir = Dir('Image').get_instence() self.HtmlFile = File('Html').get_instence() self.CssFile = File('Css').get_instence() self.PhpFile = File('Php').get_instence() self.JsFile = File('Js').get_instence() self.SqlFile = File('Sql').get_instence() self.ImgFile = File('Image').get_instence() self.HtaccessFile = File('Htaccess').get_instence() self.logpath = '/home/nicolas/Bureau' self.debug = debug
class project(Utils): def __init__(self, debug=False): self.localhost = './' self.HtmlDir = Dir('Html').get_instence() self.CssDir = Dir('Css').get_instence() self.PhpDir = Dir('Php').get_instence() self.JsDir = Dir('Js').get_instence() self.SqlDir = Dir('Sql').get_instence() self.ImgDir = Dir('Image').get_instence() self.HtmlFile = File('Html').get_instence() self.CssFile = File('Css').get_instence() self.PhpFile = File('Php').get_instence() self.JsFile = File('Js').get_instence() self.SqlFile = File('Sql').get_instence() self.ImgFile = File('Image').get_instence() self.HtaccessFile = File('Htaccess').get_instence() self.logpath = '/home/nicolas/Bureau' self.debug = debug """ @command project @syntax python main.py project do initialize -p name=<value> @method initialize @arg string name """ def initialize(self, args): name = self.get_from_args('name', args) if self.localhost != '': name = self.localhost + name self.HtmlDir.create(name) self.CssDir.create(name) self.PhpDir.create(name) self.JsDir.create(name) self.SqlDir.create(name) self.ImgDir.create(name) """ @command project @syntax python main.py project do create file @method create file @arg string name """ def create_file(self, name): self.HtmlFile.create(self.localhost + '/' + name, 'index.html') self.CssFile.create(self.localhost + '/' + name, 'style.css') self.PhpFile.create(self.localhost + '/' + name, 'script.php') self.JsFile.create(self.localhost + '/' + name, 'script.js') self.SqlFile.create(self.localhost + '/' + name, 'base.sql') self.ImgFile.create(self.localhost + '/' + name, 'image.svg') self.HtaccessFile.create(self.localhost + '/' + name) """ @command project @syntax python main.py project do create global -p project=<value> @method create file @arg string projectname """ def create_global(self, args): args = self.args(args) projectname = self.get_from_args('project', args) server('project do initialize -p name=' + projectname).start_command() server('html do create file -p name=index title=Accueil project=' + projectname + ' content=<h1>|Hello|Je|suis|sur|le|projet|qui|s\'appel|' + projectname + '|</h1>') \ .start_command() server('php do create file -p name=script1 project=' + projectname).start_command() server('css do create file -p name=style project=' + projectname).start_command() server('js do create script -p name=script1 project=' + projectname).start_command() """ @command css @syntax python main.py project do test logger -p text_a_logger=<value> @method create file @arg str text_a_logger """ def test_logger(self, args): text_a_logger = self.get_from_args('text_a_logger', args) logs = self.logger( ('xml', 'json', 'text'), (text_a_logger + ' xml', text_a_logger + ' json', text_a_logger + ' text'), (self.logpath + '/logs/' + 'log.xml', self.logpath + '/logs/' + 'log.json', self.logpath + '/logs/' + 'text.log'), (Utils.NEUTRE, Utils.SUCCESS, Utils.ERROR)) for log in logs: print(log) print(self.debug)