forked from craftercms/craftercms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.gradle
49 lines (44 loc) · 1.89 KB
/
run.gradle
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
/*
* Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
apply from: "commons.gradle"
ext.runAuthoringEnvironment = { command, profileRequired, socialRequired ->
if (file("${authoringEnvDir}/bin/crafter.sh").exists()) {
// Run authoring tasks
execCommand(command, "${authoringEnvDir}/bin")
} else {
throw new GradleException("Authoring environment not deployed correctly. Please redeploy.")
}
}
ext.runDeliveryEnvironment = { command, profileRequired, socialRequired ->
if (file("${deliveryEnvDir}/bin/crafter.sh").exists()) {
// Run delivery tasks
execCommand(command, "${deliveryEnvDir}/bin")
} else {
throw new GradleException("Delivery environment not deployed correctly. Please redeploy.")
}
}
ext.runEnvironment = { environment, command, profileRequired, socialRequired ->
def cmd = ["${crafterCmd}"] + command
// Run tasks per environment
if (environment == "authoring") {
runAuthoringEnvironment(cmd, profileRequired, socialRequired)
} else if (environment == "delivery") {
runDeliveryEnvironment(cmd, profileRequired, socialRequired)
} else {
logger.error("Unknown environment \"" + environment + "\"")
throw new GradleException("Unknown environment \"" + environment + "\"")
}
}