Skip to content

Commit

Permalink
Merge branch 'feature/libs-blocks-merge' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
iruzevic committed Nov 3, 2019
2 parents dc2614f + bbbe17e commit 0cbbb74
Show file tree
Hide file tree
Showing 10 changed files with 347 additions and 44 deletions.
51 changes: 51 additions & 0 deletions eightshift-projects/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Wordpress files
wp-admin
wp-includes
/license.txt
/readme.html
/wp-activate.php
/index.php
/wp-blog-header.php
/wp-comments-post.php
/wp-config-sample.php
/wp-config.php
/wp-cron.php
/wp-links-opml.php
/wp-load.php
/wp-login.php
/wp-mail.php
/wp-settings.php
/wp-signup.php
/wp-trackback.php
/xmlrpc.php

# Content
!wp-content/plugins/

# Theme
wp-content/*
!wp-content/mu-plugins/
!wp-content/plugins/
!wp-content/themes/
/wp-content/themes/index.php

# Ignore these plugins from the core
wp-content/plugins/hello.php
wp-content/plugins/akismet/
/wp-content/plugins/index.php

# Ignore specific themes
wp-content/themes/twenty*/

# Mac OS custom attribute store and thumbnails
*.DS_Store
._*

# Error logs
error_log.txt
wordfence-waf.php
wflogs

# Databases and exports
latest_dump.tar.gz
latest_dump
28 changes: 28 additions & 0 deletions eightshift-projects/README-project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Project info

## Database
Before you start developing ask a lead developer to export you the latest version of the database.

## Development environment
* `feature` branch
* Development is done localy on your computer
* Create `feature/feature-name` branch from `master` and create pull request to `staging` branch
```
http://dev.boilerplate.com/
```

## Staging server
* `staging` branch
* QA testing and client tests and approvals
* Never merge `staging` to `master` branch.
```
https://staging.boilerplate.com/
```

## Production server
* `master` branch
* Create pull request from `feature` branch to `master` when it is production ready
* **NO OVERRIDING THE DATABASE**
```
https://boilerplate.com/
```
10 changes: 10 additions & 0 deletions eightshift-projects/bin/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

function build() {
cd wp-content/themes/eightshift-boilerplate;
npm install
composer install --no-dev --no-scripts
npm run build
}

build
41 changes: 41 additions & 0 deletions eightshift-projects/bin/db-export.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env sh

# Prettyfiers
BLUE='\033[0;36m'
RED='\033[0;31m'
BBLUE="\033[1;36m"
NC='\033[0m' # No Color

# Create temp folder
if [ ! -d "db_dump" ]; then
echo -e "${BLUE}Creating temp db_dump folder!${NC}"
mkdir db_dump
fi

# Export latest db
wp db export db_dump/latest.sql
echo -e "${BLUE}Exporting db to db_dump/latest.sql${NC}"

# Remove old dump
if [ -f "latest_dump.tar.gz" ]; then
echo -e "${BLUE}Removing old compressed latest.tar.gz file!${NC}"
rm latest_dump.tar.gz
fi

# Exit if folders are not existing
if [ ! -d "db_dump" ] || [ ! -d "wp-content/uploads/" ]; then
echo -e "${RED}Fail! Folders are missing!${NC}"
exit 1
fi

# Compress folders
tar czf latest_dump.tar.gz db_dump/ wp-content/uploads/
echo -e "${BLUE}Compressing folders success!${NC}"

# Remove temp folder
if [ -d "db_dump" ]; then
rm -rf db_dump
echo -e "${BLUE}Removing temp db_dump folder!${NC}"
fi

echo -e "${BBLUE}Export complete! File is located in root folder latest_dump.tar.gz${NC}"
46 changes: 46 additions & 0 deletions eightshift-projects/bin/db-import-production-to-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env sh

# Prettyfiers
BLUE='\033[0;36m'
RED='\033[0;31m'
BBLUE="\033[1;36m"
NC='\033[0m' # No Color

# Check if dump exists
if [ ! -f "latest_dump.tar.gz" ]; then
echo "${RED}Fail! File latest_dump.tar.gz doesn't exist!${NC}"
exit 1
fi

# Remove temp folder
rm -rf latest_dump

# Create temp folder
if [ ! -d "latest_dump" ]; then
echo "${BLUE}Creating temp latest_dump folder!${NC}"
mkdir latest_dump
fi

tar zxf latest_dump.tar.gz -C latest_dump
echo "${BLUE}Exporting folders success!${NC}"

# Clear the database of all tables
wp db export
wp db reset

# Import database
echo "${BLUE}Database import and search replace in progress...${NC}"
wp db import latest_dump/db_dump/latest.sql

# Search and replace for URL
wp search-replace boilerplate.com dev.boilerplate.com --url=boilerplate.com --all-tables --network

# Search and replace for https to http
wp search-replace https://dev.boilerplate.com http://dev.boilerplate.com --all-tables --network

echo "${BLUE}Flushing cache, removing transients and resetting premalinks!${NC}"
wp cache flush
wp transient delete --all
wp rewrite flush

echo "${BBLUE}Finished! Success!${NC}"
43 changes: 43 additions & 0 deletions eightshift-projects/bin/db-import-production-to-staging.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env sh

# Prettyfiers
BLUE='\033[0;36m'
RED='\033[0;31m'
BBLUE="\033[1;36m"
NC='\033[0m' # No Color

# Check if dump exists
if [ ! -f "latest_dump.tar.gz" ]; then
echo "${RED}Fail! File latest_dump.tar.gz doesn't exist!${NC}"
exit 1
fi

# Remove temp folder
rm -rf latest_dump

# Create temp folder
if [ ! -d "latest_dump" ]; then
echo "${BLUE}Creating temp latest_dump folder!${NC}"
mkdir latest_dump
fi

tar zxf latest_dump.tar.gz -C latest_dump
echo "${BLUE}Exporting folders success!${NC}"

# Clear the database of all tables
wp db export
wp db reset

# Import database
echo "${BLUE}Database import and search replace in progress...${NC}"
wp db import latest_dump/db_dump/latest.sql

# Search and replace for URL
wp search-replace boilerplate.com staging.boilerplate.com --url=boilerplate.com --all-tables --network

echo "${BLUE}Flushing cache, removing transients and resetting premalinks!${NC}"
wp cache flush
wp transient delete --all
wp rewrite flush

echo "${BBLUE}Finished! Success!${NC}"
46 changes: 46 additions & 0 deletions eightshift-projects/bin/db-import-staging-to-dev.sh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env sh

# Prettyfiers
BLUE='\033[0;36m'
RED='\033[0;31m'
BBLUE="\033[1;36m"
NC='\033[0m' # No Color

# Check if dump exists
if [ ! -f "latest_dump.tar.gz" ]; then
echo "${RED}Fail! File latest_dump.tar.gz doesn't exist!${NC}"
exit 1
fi

# Remove temp folder
rm -rf latest_dump

# Create temp folder
if [ ! -d "latest_dump" ]; then
echo "${BLUE}Creating temp latest_dump folder!${NC}"
mkdir latest_dump
fi

tar zxf latest_dump.tar.gz -C latest_dump
echo "${BLUE}Exporting folders success!${NC}"

# Clear the database of all tables
wp db export
wp db reset

# Import database
echo "${BLUE}Database import and search replace in progress...${NC}"
wp db import latest_dump/db_dump/latest.sql

# Search and replace for URL
wp search-replace staging.boilerplate.com dev.boilerplate.com --url=staging.boilerplate.com --all-tables --network

# Search and replace for https to http
wp search-replace https://dev.boilerplate.com http://dev.boilerplate.com --all-tables --network

echo "${BLUE}Flushing cache, removing transients and resetting premalinks!${NC}"
wp cache flush
wp transient delete --all
wp rewrite flush

echo "${BBLUE}Finished! Success!${NC}"
10 changes: 10 additions & 0 deletions eightshift-projects/bin/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

function deploy() {
cd wp-content/themes/eightshift-boilerplate;
npm install
composer install --no-dev --no-scripts
npm run build
}

deploy
2 changes: 2 additions & 0 deletions eightshift-projects/ci-exclude.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/wp-content/themes/eightshift-boilerplate/node_modules
.git
Loading

0 comments on commit 0cbbb74

Please sign in to comment.