Install script for CakePHP-1.1.16.5421

-----BEGIN WEBFACTION INSTALL SCRIPT-----
#!/usr/local/bin/python2.5

"""
CakePHP 1.1.16.5421

Notes:
-After you deploy your CakePHP application you'll need to submit a support ticket so that we can give the apache user write access to ~/webapps/(Application Name)/app/tmp/.
-If CakePHP isn't going to be web accessible at / you'll need to update the following line in ~/webapps/(Application Name)/.htaccess accordingly:

RewriteBase /

"autostart": "not applicable"
"extra info": "leave empty"

"""

import sys
import xmlrpclib

def create(app_name, server, session_id):
    app = server.create_app(session_id, app_name, 'static', False, '')

    # Download, extract, and organize.
    cmd = (
        'wget http://wiki.webfaction.com/attachment/wiki/CakePHP-1.1.16.5421Install/cake_1.1.16.5421.tar.gz?format=raw -O cake_1.1.16.5421.tar.gz > /dev/null 2>&1;'
        'tar fxz cake_1.1.16.5421.tar.gz;'
        'mv --target-directory=. cake_1.1.16.5421/* cake_1.1.16.5421/.htaccess;'
    )
    server.system(session_id, cmd)

    str = (
        'RewriteEngine on\n'
        'RewriteBase /\n'
        'RewriteRule ^$ app/webroot/ [L]\n'
        'RewriteRule (.*) app/webroot/$1 [L]\n'
    )
    server.write_file(session_id, '.htaccess', str)

    # Clean Up
    server.system(session_id, 'rm -fr cake_1.1.16.5421/ cake_1.1.16.5421.tar.gz index.html')

    print app['id']

def delete(app_name, server, session_id):
    server.delete_app(session_id, app_name)

if __name__ == '__main__':
    action, username, password, machine, app_name, autostart, extra_info = sys.argv[1:]
    server = xmlrpclib.Server('https://api.webfaction.com/')
    session_id, account = server.login(username, password, machine)

    locals()[action](app_name, server, session_id)
-----END WEBFACTION INSTALL SCRIPT-----

Attachments