def cmd_deploy(args, config): label = args.label[0] commit = args.commit[0] gondor_dirname = ".gondor" try: project_root = utils.find_nearest(os.getcwd(), gondor_dirname) except OSError: error("unable to find a .gondor directory.\n") tar_path, tarball_path = None, None try: out("Reading configuration... ") local_config = ConfigParser.RawConfigParser() local_config.read(os.path.join(project_root, gondor_dirname, "config")) endpoint = config_value(local_config, "gondor", "endpoint", DEFAULT_ENDPOINT) site_key = local_config.get("gondor", "site_key") vcs = local_config.get("gondor", "vcs") app_config = { "requirements_file": config_value(local_config, "app", "requirements_file"), "wsgi_entry_point": config_value(local_config, "app", "wsgi_entry_point"), "migrations": config_value(local_config, "app", "migrations"), "staticfiles": config_value(local_config, "app", "staticfiles"), "site_media_url": config_value(local_config, "app", "site_media_url"), } include_files = [x.strip() for x in config_value(local_config, "files", "include", "").split("\n") if x] out("[ok]\n") if vcs == "git": try: repo_root = utils.find_nearest(os.getcwd(), ".git") except OSError: error("unable to find a .git directory.\n") try: git = utils.find_command("git") except utils.BadCommand, e: error(e.args[0]) check, sha = utils.run_proc([git, "rev-parse", commit]) if check != 0: error("could not map '%s' to a SHA\n" % commit) if commit == "HEAD": commit = sha tar_path = os.path.abspath(os.path.join(repo_root, "%s-%s.tar" % (label, sha))) cmd = [git, "archive", "--format=tar", commit, "-o", tar_path] elif vcs == "hg": try: repo_root = utils.find_nearest(os.getcwd(), ".hg") except OSError: error("unable to find a .hg directory.\n") try: hg = utils.find_command("hg") except utils.BadCommand, e: error(e.args[0])
def cmd_deploy(args, env, config): label = args.label[0] commit = args.commit[0] tar_path, tarball_path = None, None try: if config["gondor.vcs"] == "git": try: git = utils.find_command("git") except utils.BadCommand, e: error(e.args[0]) check, sha = utils.run_proc([git, "rev-parse", commit]) if check != 0: error("could not map '%s' to a SHA\n" % commit) if commit == "HEAD": commit = sha tar_path = os.path.abspath(os.path.join(env["repo_root"], "%s-%s.tar" % (label, sha))) cmd = [git, "archive", "--format=tar", commit, "-o", tar_path] elif config["gondor.vcs"] == "hg": try: hg = utils.find_command("hg") except utils.BadCommand, e: error(e.args[0])