def generate_controller(args):
controller_template = os.path.join(dirname(abspath(__file__)), '<STR_LIT>')<EOL>test_template = os.path.join(dirname(abspath(__file__)), '<STR_LIT>')<EOL>controller_name = args.get('<STR_LIT>')<EOL>current_path = os.getcwd()<EOL>logger.info('<STR_LIT>')<EOL>if not controller_name:<EOL><INDENT>logger.warning('<STR_LIT>')<EOL>return<EOL><DEDENT>with open(controller_template, '<STR_LIT:r>') as template_file:<EOL><INDENT>controller_file_path = os.path.join(current_path, '<STR_LIT>',<EOL>controller_name + '<STR_LIT>')<EOL>with open(controller_file_path, '<STR_LIT>') as controller_file:<EOL><INDENT>for line in template_file:<EOL><INDENT>new_line = line.replace('<STR_LIT>', controller_name)<EOL>controller_file.write(new_line)<EOL><DEDENT><DEDENT><DEDENT>logger.info("<STR_LIT>" % _relative_path(controller_file_path))<EOL>with open(test_template, '<STR_LIT:r>') as template_file:<EOL><INDENT>test_file_path = os.path.join(current_path, '<STR_LIT>',<EOL>'<STR_LIT>' % controller_name)<EOL>with open(test_file_path, '<STR_LIT>') as test_file:<EOL><INDENT>for line in template_file:<EOL><INDENT>new_line = line.replace('<STR_LIT>', controller_name).replace('<STR_LIT>', controller_name.title())<EOL>test_file.write(new_line)<EOL><DEDENT><DEDENT><DEDENT>logger.info("<STR_LIT>" % _relative_path(test_file_path))<EOL>assets_dir_path = os.path.join(current_path, '<STR_LIT>' % controller_name)<EOL>_mkdir_p(assets_dir_path)<EOL>_generate_form(controller_name)<EOL>logger.info('<STR_LIT>')<EOL>
Generate controller, include the controller file, template & css & js directories.