diff --git a/docs/configuration.rst b/docs/configuration.rst index 237e5e1..d52c874 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -195,6 +195,7 @@ If you wanna configure the deployement of your website by rsync:: settings: deploy: + ssh: true (optional need for ssh) username: beudbeud (optional need for ssh) hostname: beudibox.fr (optional need for ssh) dest: /var/www/surleschemins/build/ diff --git a/prosopopee/prosopopee.py b/prosopopee/prosopopee.py index d94ed4c..3ce83e7 100644 --- a/prosopopee/prosopopee.py +++ b/prosopopee/prosopopee.py @@ -545,17 +545,19 @@ def main(): error(os.system("which rsync > /dev/null") == 0, "I can't locate the rsync, " "please install the 'rsync' package.\n") error(Path("build").exists(), "Please build the website before launch deployment") - r_username = settings["settings"]["deploy"]["username"] - r_hostname = settings["settings"]["deploy"]["hostname"] + r_dest = settings["settings"]["deploy"]["dest"] if settings["settings"]["deploy"]["others"]: r_others = settings["settings"]["deploy"]["others"] else: r_others = '' - r_cmd = "rsync -avz --progress %s build/* %s@%s:%s" % (r_others, r_username, r_hostname, r_dest) - print r_cmd + if settings["settings"]["deploy"]["ssh"]: + r_username = settings["settings"]["deploy"]["username"] + r_hostname = settings["settings"]["deploy"]["hostname"] + r_cmd = "rsync -avz --progress %s build/* %s@%s:%s" % (r_others, r_username, r_hostname, r_dest) + else: + r_cmd = "rsync -avz --progress %s build/* %s" % (r_others, r_dest) error(os.system(r_cmd) == 0, "deployment failed") - #proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, preexec_fn=os.setsid) return Path("build").makedirs_p()