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'
if __name__ == '__main__': opts, args = getopt.getopt(sys.argv[1:], "hn:a:l:r:") app_alias = None author = '' link = '' requirements = '' for op, value in opts: if op == "-n": app_alias = value elif op == "-a": author = value elif op == "-l": link = value elif op == "-r": requirements = value elif op == "-h": usage() sys.exit() if not app_alias: usage() sys.exit() root_path = os.path.dirname(os.path.dirname(get_current_dir())) build_app_path(app_alias, root_path, author, link, requirements)
''' if __name__ == '__main__': opts, args = getopt.getopt(sys.argv[1:], "hn:a:l:r:") app_alias = None author = '' link = '' requirements = '' for op, value in opts: if op == "-n": app_alias = value elif op == "-a": author = value elif op == "-l": link = value elif op == "-r": requirements = value elif op == "-h": usage() sys.exit() if not app_alias: usage() sys.exit() root_path = os.path.dirname(os.path.dirname(get_current_dir())) build_app_path(app_alias, root_path, author, link, requirements);