def getActions(views): output = '' for view in views: action_name = cognosys.camelCase(view) action_name = action_name[0].lower() + action_name[1:] + 'Action' output += action_skelleton % action_name return output
def createController(cog_name, controller_name, views): views_path = cognosys.views_path(cog_name) + controller_name + os.sep if not os.path.isdir(views_path): os.makedirs(views_path) controller_name = cognosys.camelCase(controller_name) + 'Controller' # create view 'index' by default if not 'index' in views: views.insert(0, 'index') controller_actions = getActions(views) f = open(cognosys.controllers_path(cog_name) + controller_name + '.php', 'w') f.write(controller_skelleton % (cog_name, controller_name, controller_actions)) print ' created controller: ' + os.path.basename(f.name) f.close() createViews(views_path, views)