def build_app_path(alias, root_path, author='', link='', requirements=''): # make backend dirs server_path = root_path + '/server/Application/' + alias[0].upper( ) + alias[1:] print 'Making backend application directory: ' + server_path try: os.mkdir(server_path) except OSError: print 'Server Application Path Exists' backend_dirs = [ 'Controller', 'Event', 'Locale', 'Schema', 'Service', 'Model' ] for dir in backend_dirs: tmp_dir = server_path + '/' + dir + '/' print 'Making backend sub directory: ' + tmp_dir try: os.mkdir(tmp_dir) except OSError: print 'Target exists' # config.yml config_yml_content = get_template(root_path, 'config.yml', alias) config_yml_content = config_yml_content.replace('*author*', author) config_yml_content = config_yml_content.replace('*link*', link) config_yml_content = config_yml_content.replace('*requirements*', requirements) print 'Writing config.yml' write_by_template(server_path + '/config.yml', config_yml_content) # front-end front_path = root_path + '/ones/apps/' + alias print 'Making front-end directory: ' + front_path try: os.mkdir(front_path) except OSError: print 'Front-end Path Exists' print 'Making front-end scripts ...' main_script = get_template(root_path, 'main.js', alias) model_script = get_template(root_path, 'model.js', alias) write_by_template(front_path + '/main.js', main_script) write_by_template(front_path + '/model.js', model_script) print 'Adding to GIT...' os.chdir(server_path) os.system('git add *') os.chdir(front_path) os.system('git add *') print 'finished'
def build_app_path(alias, root_path, author="", link="", requirements=""): # make backend dirs server_path = root_path + "/server/Application/" + alias.capitalize() print "Making backend application directory: " + server_path try: os.mkdir(server_path) except OSError: print "Server Application Path Exists" backend_dirs = ["Controller", "Event", "Locale", "Schema", "Service", "Model"] for dir in backend_dirs: tmp_dir = server_path + "/" + dir + "/" print "Making backend sub directory: " + tmp_dir try: os.mkdir(tmp_dir) except OSError: print "Target exists" # config.yml config_yml_content = get_template(root_path, "config.yml", alias) config_yml_content = config_yml_content.replace("*author*", author) config_yml_content = config_yml_content.replace("*link*", link) config_yml_content = config_yml_content.replace("*requirements*", requirements) print "Writing config.yml" write_by_template(server_path + "/config.yml", config_yml_content) # front-end front_path = root_path + "/ones/apps/" + alias print "Making front-end directory: " + front_path try: os.mkdir(front_path) except OSError: print "Front-end Path Exists" print "Making front-end scripts ..." main_script = get_template(root_path, "main.js", alias) model_script = get_template(root_path, "model.js", alias) write_by_template(front_path + "/main.js", main_script) write_by_template(front_path + "/model.js", model_script) print "Adding to GIT..." os.chdir(server_path) os.system("git add *") os.chdir(front_path) os.system("git add *") print "finished"
def build_module(alias, module): root_path = os.path.dirname(os.path.dirname(get_current_dir())) app_path = root_path + '/server/Application/' + alias.capitalize() #module = module.capitalize() need_to_write = ['Controller', 'Event', 'Model', 'Service'] for ntw in need_to_write: print 'Creating %s %s...' % (module, ntw) tmp_path = '%s/%s/%s%s.class.php' % ( app_path, ntw, module, ntw ) content = get_template(root_path, ntw + '_php', alias.capitalize()) content = content.replace('*module*', module) write_by_template(tmp_path, content) print 'Adding to GIT...' os.chdir(app_path) os.system('git add */*') print 'finished'
def build_module(alias, module): root_path = os.path.dirname(os.path.dirname(get_current_dir())) app_path = root_path + '/server/Application/' + alias[0].upper( ) + alias[1:] #module = module[0].upper() + module[1:] need_to_write = ['Controller', 'Event', 'Model', 'Service'] for ntw in need_to_write: print 'Creating %s %s...' % (module, ntw) tmp_path = '%s/%s/%s%s.class.php' % (app_path, ntw, module, ntw) content = get_template(root_path, ntw + '_php', alias[0].upper() + alias[1:]) content = content.replace('*module*', module) write_by_template(tmp_path, content) print 'Adding to GIT...' os.chdir(app_path) os.system('git add */*') print 'finished'
def build_app_path(alias, root_path, author='', link='', requirements=''): # make backend dirs server_path = root_path + '/server/Application/' + alias[0].upper() + alias[1:] print 'Making backend application directory: ' + server_path try: os.mkdir(server_path) except OSError: print 'Server Application Path Exists' backend_dirs = [ 'Controller', 'Event', 'Locale', 'Schema', 'Service', 'Model' ] for dir in backend_dirs: tmp_dir = server_path + '/' + dir + '/' print 'Making backend sub directory: ' + tmp_dir try: os.mkdir(tmp_dir) except OSError: print 'Target exists' # config.yml config_yml_content = get_template(root_path, 'config.yml', alias) config_yml_content = config_yml_content.replace('*author*', author) config_yml_content = config_yml_content.replace('*link*', link) config_yml_content = config_yml_content.replace('*requirements*', requirements) print 'Writing config.yml' write_by_template(server_path + '/config.yml', config_yml_content) # front-end front_path = root_path + '/ones/apps/' + alias print 'Making front-end directory: ' + front_path try: os.mkdir(front_path) except OSError: print 'Front-end Path Exists' print 'Making front-end scripts ...' main_script = get_template(root_path, 'main.js', alias) model_script = get_template(root_path, 'model.js', alias) write_by_template(front_path + '/main.js', main_script) write_by_template(front_path + '/model.js', model_script) print 'Adding to GIT...' os.chdir(server_path) os.system('git add *') os.chdir(front_path) os.system('git add *') print 'finished'