git_brcal/misc/copyprod.sh

43 lines
1.5 KiB
Bash

#!/bin/bash
# This script replaces all references to the development version with the test version
# 1) Database references and paths
git grep -I "connection_data_test.json" -- '..' ':(exclude)*.sh'
git grep -I "/var/www/brecal_test/" -- '..' ':(exclude)*.sh'
# 2) Color references
# Bar colors in client: (BG_COLOR)
# Devel: #1D751F
# Test: #751D1F
# Prod: #203864
git grep -I "#751D1F" -- '..' ':(exclude)*.sh'
# 3) Assembly name references
git grep -I "BreCalTestClient" -- '..' ':(exclude)*.sh'
echo "Proceed? [N/y]"
read proceed
# for color
if [ "${proceed}" = "y" ]; then
# 1. for database references and paths
git grep -I "connection_data_test.json" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/connection_data_test.json/connection_data_prod.json/g"
git add $(git grep -Il "connection_data_prod.json" -- '..' ':(exclude)*.sh')
git grep -I "/var/www/brecal_test/" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/\/var\/www\/brecal_test\//\/var\/www\/brecal\//g"
git add $(git grep -Il "/var/www/brecal/" -- '..' ':(exclude)*.sh')
# 2. for color
git grep -Il "#751D1F" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/#751D1F/#203864/g"
git add $(git grep -Il "#203864" -- '..' ':(exclude)*.sh')
# 3. for assembly name
git grep -I "BreCalTestClient" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/BreCalTestClient/BreCalClient/g"
git add $(git grep -Il "BreCalClient" -- '..' ':(exclude)*.sh')
fi