def git(force=False): """Creates a new git repo for this project""" m = 'This will remove the current .git directory, do you want to continue?' if force or confirm(m, default=False): # remove wordpress-skeleton.git metadata local('rm -rf .git') # setup a new repository local('git init') local('cp -f %s .gitignore' % Skeleton.asset('gitignore.sample')) local('git add .') local('git commit -m "Initial commit."') # TODO: create origin? this is probably not needed # if os.path.exists('/files/Git/projects/'): # repo = '/files/Git/projects/%s.git' % options['name'] # if not os.path.exists(repo): # local('git clone --bare . %s' % repo) # local('git remote add origin %s' % repo) # local('git config branch.master.remote origin') # local('git config branch.master.merge refs/heads/master') # else: # print("\nCan't create origin. Skipping") else: puts('Ok. Nothing was touched!')
def replace(pattern, replacement): """Replace strings in database records""" prepare() host = options['project.mysql.host'] db = options['project.mysql.db'] username = options['project.mysql.user'] password = options['project.mysql.password'] path = Skeleton.asset('searchandreplace.php') args = (path, pattern, replacement, host, username, password, db) local('php %s %s %s %s %s %s %s true' % args)
def wordpress(version=None): """Download latest stable version of WordPress""" if version is None: basename = 'latest.tar.gz' else: basename = 'wordpress-%s.tar.gz' % version if os.path.exists(os.path.join(os.getcwd(), basename)): os.unlink(os.path.join(os.getcwd(), basename)) local('wget http://wordpress.org/%s' % basename) local('tar -xf %s' % basename) local('cp -fR wordpress/* .') local('rm -rf wordpress') local('mkdir -pm 0777 wp-content/uploads') local('cp -f %s .htaccess' % Skeleton.asset('htaccess.sample')) local('rm %s' % basename)