This repository has been archived by the owner on Jan 6, 2025. It is now read-only.
forked from bitpay/wordpress-ecommerce-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup
executable file
·93 lines (92 loc) · 2.9 KB
/
setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env bash
if [ "$1" == '' ]
then
DB_USER='root'
DB_PASS='bitpay'
else
DB_USER=$1
DB_PASS=$2
fi
echo $SHELL
export DB_USER=$DB_USER
export DB_PASS=$DB_PASS
echo "Removing conflicting files..."
rm -rf wordpress
rm -rf wpsc-merchants
rm -rf build
rm bitpay_table.sql
rm tests\\php_input.txt
sudo rm -rf /tmp/wordpress
sudo rm -rf /tmp/wordpress-tests-lib
sudo rm -rf /tmp/wordpress.tar.gz
rm wp-cli.yml
mysqladmin --force -u $DB_USER -p$DB_PASS drop wordpress_test
echo "Creating wp-cli.yml..."
echo "path: wordpress
debug: truea
core config:
site_url: http://localhost
dbname: wordpress_test
dbuser: $DB_USER
dbpass: $DB_PASS
dbhost: 127.0.0.1
extra-php: |
define( 'WP_DEBUG', true );
\$table_prefix = 'wptests_';
core install:
url: http://localhost
title: BitPay Wordpress
admin_user: bitpay
admin_password: bitpay
admin_email: [email protected]" >> wp-cli.yml
if [ -e composer.lock ]
then
echo "Running Composer update..."
composer update
else
echo "Running Composer Install..."
composer install
fi
echo "Creating test database..."
mysqladmin -u $DB_USER -p$DB_PASS create wordpress_test
echo "Checking if wp-cli is working..."
bin/wp --info
echo "Installing wordpress..."
bin/wp core download --debug
bin/wp core config --debug
bin/wp core install --debug
echo "Setting up wordpress plugins..."
bin/wp plugin install wp-e-commerce --version=3.8.14.3 --activate
echo "Setting up wordpress test files..."
bin/wp scaffold plugin-tests wp-e-commerce
echo "Setting up Bitpay key storage table..."
echo 'CREATE TABLE IF NOT EXISTS `wptests_bitpay_keys` (
`id` int(11) not null auto_increment,
`private_key` varchar(1000) not null,
`public_key` varchar(1000) not null,
`sin` varchar(250) not null,
`token` varchar(2000) not null,
`network` varchar(250) not null,
`facade` varchar(250) not null,
`user_id` varchar(250) not null,
`enable_all` varchar(250) not null,
`in_use` varchar(250) not null,
`paired` varchar(250) not null,
`created_at` datetime not null,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' >> bitpay_table.sql
mysql -u $DB_USER -p$DB_PASS wordpress_test < bitpay_table.sql
sudo bash wordpress/wp-content/plugins/wp-e-commerce/bin/install-wp-tests.sh wordpress_test $DB_USER $DB_PASS localhost latest
sudo mkdir /tmp/wordpress/wp-content/uploads
echo "Building BitPay Plugin Directory..."
mkdir wpsc-merchants
mkdir wpsc-merchants/bitpay
mkdir wpsc-merchants/bitpay/lib
cp -avr src/assets wpsc-merchants/bitpay
cp -avr src/templates wpsc-merchants/bitpay
cp src/bitpay.merchant.php wpsc-merchants/
cp LICENSE wpsc-merchants/
cp README.md wpsc-merchants/
cp CHANGELOG wpsc-merchants/
cp -avr vendor/bitpay/php-client/src/* wpsc-merchants/bitpay/lib
cp -avr wpsc-merchants/* wordpress/wp-content/plugins/wp-e-commerce/wpsc-merchants