def get_remote_db(): "Download the latest database from the server and load it onto your local database" dbsettings = get_db_settings() with cd(env.path): if dbsettings['engine']=='mysql': run('mysqldump -u%(user)s -p%(pass)s %(name)s > database' % dbsettings ) elif dbsettings['engine']=='postgresql' or dbsettings['engine']=='postgresql_psycopg2': run('psql -u%(user)s -p%(pass)s %(name)s > database' % dbsettings) get(env.path+'/database', 'database') if dbsettings['engine']=='mysql': local('echo "create database if not exists %(name)s;" | mysql -u%(user)s -p%(pass)s' % dbsettings) local('mysql -u%(user)s -p%(pass)s %(name)s < database' % dbsettings) elif dbsettings['engine']=='postgresql' or dbsettings['engine']=='postgresql_psycopg2': run('echo "create database if not exists %(name)s;" | psql -u%(user)s -p%(pass)s' % dbsettings)
def get_remote_db(): "Download the latest database from the server and load it onto your local database" dbsettings = get_db_settings() with cd(env.path): if dbsettings['engine'] == 'mysql': run('mysqldump -u%(user)s -p%(pass)s %(name)s > database' % dbsettings) elif dbsettings['engine'] == 'postgresql' or dbsettings[ 'engine'] == 'postgresql_psycopg2': run('psql -u%(user)s -p%(pass)s %(name)s > database' % dbsettings) get(env.path + '/database', 'database') if dbsettings['engine'] == 'mysql': local( 'echo "create database if not exists %(name)s;" | mysql -u%(user)s -p%(pass)s' % dbsettings) local('mysql -u%(user)s -p%(pass)s %(name)s < database' % dbsettings) elif dbsettings['engine'] == 'postgresql' or dbsettings[ 'engine'] == 'postgresql_psycopg2': run('echo "create database if not exists %(name)s;" | psql -u%(user)s -p%(pass)s' % dbsettings)
def put_local_db(): "Dump your local database and load it onto the servers databse" dbsettings = get_db_settings() if dbsettings['engine']=='mysql': local('mysqldump -u%s -p%s %s > database' %\ (settings.DATABASE_USER, settings.DATABASE_PASSWORD, settings.DATABASE_NAME)) put('database', 'database') local('mysql -u%s -p%s %s < database' %\ (settings.DATABASE_USER, settings.DATABASE_PASSWORD, settings.DATABASE_NAME)) elif dbsettings['engine']=='postgresql' or dbsettings['engine']=='postgresql_psycopg2': local('mysqldump -u%s -p%s %s > database' %\ (settings.DATABASE_USER, settings.DATABASE_PASSWORD, settings.DATABASE_NAME)) put('database', 'database') local('mysql -u%s -p%s %s < database' %\ (settings.DATABASE_USER, settings.DATABASE_PASSWORD, settings.DATABASE_NAME))
def put_local_db(): "Dump your local database and load it onto the servers databse" dbsettings = get_db_settings() if dbsettings['engine'] == 'mysql': local('mysqldump -u%s -p%s %s > database' %\ (settings.DATABASE_USER, settings.DATABASE_PASSWORD, settings.DATABASE_NAME)) put('database', 'database') local('mysql -u%s -p%s %s < database' %\ (settings.DATABASE_USER, settings.DATABASE_PASSWORD, settings.DATABASE_NAME)) elif dbsettings['engine'] == 'postgresql' or dbsettings[ 'engine'] == 'postgresql_psycopg2': local('mysqldump -u%s -p%s %s > database' %\ (settings.DATABASE_USER, settings.DATABASE_PASSWORD, settings.DATABASE_NAME)) put('database', 'database') local('mysql -u%s -p%s %s < database' %\ (settings.DATABASE_USER, settings.DATABASE_PASSWORD, settings.DATABASE_NAME))
def checkout_local(): local('svn co %s %s' % (env.svnurl, env.path))
def add(file): "Add files to the repository" local('svn add %s' % file)
def commit(): "Save changes to version control" local('svn commit')
def update_local(): "Pull changes from version control" local('svn update')
def commit(): "Save changes to version control" local('git commit -a')
def update_local(): "Pull changes from version control" local('git pull')
def add(file): "Add files to the repository" local('svn add %s' %file)
def push(): "Pull changes from version control" local('git push')