def wrapped(parser, options, args): config = utils.project_config() if not os.path.isfile(config._filename): parser.error('It look like you are not in a valid pytheon project') elif not config.deploy.project_name: parser.error('It look like you are not in a valid pytheon project') return func(parser, options, args, config)
def create(parser, options, args): """create your pytheon project""" binary = utils.vcs_binary() global_config = utils.user_config() if not os.path.isfile(global_config._filename): global_config.pytheon = dict( username=options.username or utils.get_input('Username'), ) global_config.write() rc = global_config.pytheon config = utils.project_config(filename=options.buildout) if not os.path.isfile(config._filename): if not options.project_name: options.project_name = utils.get_input('Project name', default=os.path.basename(os.getcwd())) config.deploy = dict( version='1', use='gunicorn', project_name=options.project_name, ) if options.project_name: config.deploy.project_name = options.project_name config.write() kw = dict(username=rc.username, project_name=config.deploy.project_name) if binary == 'git': remote = os.environ.get('PYTHEON_REMOTE', '[email protected]:%(project_name)s.git').rstrip('/') remote = remote % kw utils.call(binary, 'remote', 'add', 'pytheon', remote, silent=True) else: remote = os.environ.get('PYTHEON_REMOTE', '[email protected]/%(project_name)s').rstrip('/') remote = remote % kw filename = '.hg/hgrc' config = Config.from_file(filename) config.paths.pytheon = remote config.write() commit(binary, config._filename) return http.request('/v1/applications', name=config.deploy.project_name)