@@ -0,0 +1,2239 @@
+from cuisine import user_ensure, dir_ensure, user_passwd, package_ensure, run, package_upgrade_apt, package_update_apt, package_update, dir_exists, file_link%0Afrom fabric.context_managers import cd%0Afrom fabric.decorators import hosts%0Afrom fabric.state import env%0A%0AHOSTS=%5B''%5D  # add host here%0A%0AROOT_USER='root' # root user%0AROOT_PASS=''     # password%0A%0ARTD_USER='rtd_user'%0ARTD_PASS='rtd_pass_123'%0A%0ARTD_CLONE='git://github.com/johncosta/readthedocs.org.git'%0ARTD_CLONE_NAME=%22readthedocs.org%22%0ARTD_INITIAL_VERSION='v0.1'%0A%0A@hosts(HOSTS)%0Adef user_setup():%0A    %22%22%22 Creates a read the docs user %22%22%22%0A    env.user=ROOT_USER%0A    env.password=ROOT_PASS%0A%0A    user_ensure(RTD_USER, home='/opt/rtd')%0A    user_passwd(RTD_USER, RTD_PASS )%0A%0A@hosts(HOSTS)%0Adef package_setup():%0A    %22%22%22 Install all the required packages %22%22%22%0A    env.user=ROOT_USER%0A    env.password=ROOT_PASS%0A%0A    package_update_apt()%0A    package_update()%0A%0A    package_ensure(%22supervisor nginx%22)%0A    package_ensure(%22git-core gitosis%22)%0A    package_ensure(%22python-pip python-dev build-essential%22)%0A    run(%22aptitude install memcached -y%22)%0A%0A    run(%22easy_install pip%22)%0A    run(%22pip install virtualenv%22)%0A    run(%22pip install virtualenvwrapper%22)%0A%0A@hosts(HOSTS)%0Adef project_layout():%0A    %22%22%22 Makes project directories %22%22%22%0A    env.user=RTD_USER%0A    env.password=RTD_PASS%0A%0A    dir_ensure(%22/opt/rtd/apps/readthedocs%22, recursive=True)%0A    dir_ensure(%22/opt/rtd/htdocs%22)%0A    dir_ensure(%22/opt/rtd/tmp%22)%0A    dir_ensure(%22/opt/rtd/logs%22)%0A%0A@hosts(HOSTS)%0Adef make_virtualenv():%0A    %22%22%22 builds project in virtual environment %22%22%22%0A    env.user=RTD_USER%0A    env.password=RTD_PASS%0A%0A    # build the virtualenv%0A    with cd(%22/opt/rtd/apps/readthedocs%22):%0A        if not dir_exists(%22/opt/rtd/apps/readthedocs/%25s%22 %25 RTD_INITIAL_VERSION):%0A            run(%22virtualenv %25s%22 %25 RTD_INITIAL_VERSION)%0A        if not dir_exists(%22/opt/rtd/apps/readthedocs/current%22):%0A            file_link(%22/opt/rtd/apps/readthedocs/%25s%22 %25 RTD_INITIAL_VERSION, %22/opt/rtd/apps/readthedocs/current%22)%0A%0A    # clone the repo%0A    with cd(%22/opt/rtd/apps/readthedocs/%25s%22 %25 RTD_INITIAL_VERSION):%0A        if not dir_exists(%22/opt/rtd/apps/readthedocs/%25s/%25s%22 %25 (RTD_INITIAL_VERSION, RTD_CLONE_NAME)):%0A            run(%22git clone %25s %25s%22 %25 ( RTD_CLONE, RTD_CLONE_NAME) )

add fab build for ubuntu