#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import absolute_import

import os
import os.path
from fabric.api import env, local, run
from fabric.colors import blue
import fabric.contrib.project as project

# Remote host and username
env.hosts = []
env.user = ""
env.colorize_errors = True

# Local output path
env.local_output = os.path.join(
    os.path.abspath(os.path.dirname(__file__)),
    "output/")
# Remote path to deploy output
env.remote_output = ""


def update_simiki():
    print(blue("Old Version: "))
    run("simiki -V")
    run("pip install -U simiki")
    print(blue("New Version: "))
    run("simiki -V")

def deploy():
    project.rsync_project(
        local_dir = env.local_output,
        remote_dir = env.remote_output.rstrip("/") + "/",
        delete =True
    )

def g():
    local("simiki generate")

def p():
    local("simiki preview")

def gp():
    g()
    p()

@@ -105,16 +105,37 @@
 os.path%0A
+from sys import exit%0A
 from fab
@@ -195,16 +195,21 @@
 ort blue
+, red
 %0Aimport 
@@ -498,16 +498,57 @@
 t = %22%22%0A%0A
+# Other options%0Aenv.rsync_delete = False%0A
 %0Adef upd
@@ -713,24 +713,523 @@
 f deploy():%0A
+    if not env.remote_output:%0A        if env.rsync_delete:%0A            print(red(%22You can't enable env.rsync_delete option %22%0A                %22if env.remote_output is not set!!!%22))%0A            print(blue(%22Exit%22))%0A            exit()%0A%0A        print(red(%22Warning: env.remote_output directory is not set!%5Cn%22%0A                    %22This will cause some problems!!!%22))%0A        ans = raw_input(red(%22Do you want to continue? (y/N) %22))%0A        if ans != %22y%22:%0A            print(blue(%22Exit%22))%0A            exit()%0A%0A
     project.
@@ -1355,19 +1355,32 @@
 delete =
-Tru
+ env.rsync_delet
 e%0A    )%0A

Fix serious problem using rsync