-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bat
More file actions
79 lines (68 loc) · 2.86 KB
/
setup.bat
File metadata and controls
79 lines (68 loc) · 2.86 KB
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
@ECHO off
IF NOT DEFINED _WORDPRESS_DIR (
SET /P _WORDPRESS_DIR=Please enter full path to WordPress directory:
)
SET _WORDPRESS_UPLOADS_DIR=%_WORDPRESS_DIR%\wp-content\uploads
SET _WORDPRESS_SETUP_DIR=%_WORDPRESS_UPLOADS_DIR%\.setup
IF NOT EXIST %_WORDPRESS_UPLOADS_DIR%\.git\hooks (
ECHO Could not find git hooks directory in %_WORDPRESS_UPLOADS_DIR%
SET _WORDPRESS_DIR=
SET _WORDPRESS_SETUP_DIR=
SET _WORDPRESS_UPLOADS_DIR=
EXIT /B
)
IF NOT EXIST %_WORDPRESS_SETUP_DIR% (
MD %_WORDPRESS_SETUP_DIR%
)
ECHO Symlinking hook files...
FOR %%G IN (get-wp-addons.php,functions.sh,install.sh,remove.sh,post-checkout,post-merge,pre-commit) DO (
IF NOT EXIST %_WORDPRESS_UPLOADS_DIR%\.git\hooks\%%G (
MKLINK %_WORDPRESS_UPLOADS_DIR%\.git\hooks\%%G %~dp0\%%G || (
ECHO Could not create symlinks
EXIT /B
)
) ELSE (
ECHO Found link to %_WORDPRESS_UPLOADS_DIR%\.git\hooks\%%G
)
)
WHERE httpd > NUL && (
IF NOT EXIST %_WORDPRESS_SETUP_DIR%\wp-cli.yml.example (
ECHO Detected httpd. Copying YML...
COPY %0\..\wp-cli.yml.example %_WORDPRESS_SETUP_DIR%\wp-cli.yml
COPY %0\..\wp-cli.yml.example %_WORDPRESS_SETUP_DIR%
) ELSE (
IF NOT EXIST %_WORDPRESS_SETUP_DIR%\wp-cli.yml (
COPY %_WORDPRESS_SETUP_DIR%\wp-cli.yml.example %_WORDPRESS_SETUP_DIR%\wp-cli.yml
) ELSE (
ECHO WP-CLI configuration found at %_WORDPRESS_SETUP_DIR%\wp-cli.yml
)
)
)
IF NOT EXIST %_WORDPRESS_SETUP_DIR%\wp-addons.php (
ECHO wp-addons.php was not found in the project.
IF NOT EXIST %_WORDPRESS_SETUP_DIR%\wp-addons.php.example (
ECHO Copying example wp-addons from hooks repo.
COPY %0\..\wp-addons.php.example %_WORDPRESS_SETUP_DIR%\wp-addons.php
COPY %0\..\wp-addons.php.example %_WORDPRESS_SETUP_DIR%
) ELSE (
ECHO Copying example wp-addons from project repo.
COPY %_WORDPRESS_SETUP_DIR%\wp-addons.php.example %_WORDPRESS_SETUP_DIR%\wp-addons.php
)
)
IF NOT EXIST %_WORDPRESS_SETUP_DIR%\cleanup.sh (
ECHO A cleanup script was not found in the project.
IF NOT EXIST %_WORDPRESS_SETUP_DIR%\cleanup.sh.example (
ECHO Copying example cleanup.sh from hooks repo.
COPY %0\..\cleanup.sh.example %_WORDPRESS_SETUP_DIR%\cleanup.sh
COPY %0\..\cleanup.sh.example %_WORDPRESS_SETUP_DIR%
) ELSE (
ECHO Copying example cleanup.sh from project repo.
COPY %_WORDPRESS_SETUP_DIR%\cleanup.sh.example %_WORDPRESS_SETUP_DIR%\cleanup.sh
)
)
IF NOT EXIST %_WORDPRESS_SETUP_DIR%\.gitignore (
ECHO Copying gitignore to .setup
COPY %0\..\setup.gitignore %_WORDPRESS_SETUP_DIR%\.gitignore
)
ECHO To install the site, open an msysgit terminal and enter: cd "%_WORDPRESS_UPLOADS_DIR%" ^&^& .git/hooks/post-checkout
ECHO Be sure to set the site definitions first in .git/config