Feature #4426 » flow3.bat

Bastian Waidelich, 2009-09-03 13:54

 
1
@ECHO off
2
: ###############################################################################
3
: #
4
: # This script belongs to the FLOW3 framework.
5
: #
6
: # It is free software; you can redistribute it and/or modify it under
7
: # the terms of the GNU Lesser General Public License as published by the
8
: # Free Software Foundation, either version 3 of the License, or (at your
9
: # option) any later version.
10
: #
11
: # This script is distributed in the hope that it will be useful, but
12
: # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
13
: # TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
14
: # General Public License for more details.
15
: #
16
: # You should have received a copy of the GNU Lesser General Public
17
: # License along with the script.
18
: # If not, see http://www.gnu.org/licenses/lgpl.html
19
: #
20
: # The TYPO3 project - inspiring people to share!
21
: #
22
: ###############################################################################
23

    
24
: ##
25
: #
26
: # @package FLOW3
27
: # @author Tobias Liebig <mail_typo3@etobi.de>
28
: # @author Bastian Waidelich <bastian@typo3.org>
29
: # @version $Id$
30
: # @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
31
: #
32

    
33
: # Configuration
34

    
35
SET PHP=php.exe
36
SET BOOTSTRAP=Packages/Framework/FLOW3/Scripts/FLOW3.php
37

    
38
SET FLOW3ROOTPATH=.
39
SET FLOW3WEBPATH=%FLOW3ROOTPATH%/Web
40

    
41
: # check minimum argument count
42
REM IF "%2%" == "" GOTO printUsage
43

    
44
SET CONTEXT=Development
45
SET PACKAGE=
46
SET SUBPACKAGES=
47
SET CONTROLLER=
48
SET ACTION=
49
SET ARGUMENTS=
50

    
51
IF "%1%" == "help" GOTO printUsage
52
IF "%1%" == "--help" GOTO printUsage
53
IF "%1%" == "-h" GOTO printUsage
54

    
55
IF "%1%" == "--production" SET CONTEXT=Production
56
IF "%1%" == "-p" SET CONTEXT=Production
57

    
58

    
59
IF "%1%" == "package" (
60
	SET PACKAGE=FLOW3
61
	SET SUBPACKAGES=Package
62
	SET CONTROLLER=Manager
63
	IF "%2%" == "create" (
64
		IF "%3%" == "" (
65
			ECHO Please specify a package-key
66
			GOTO printUsage
67
		)
68
	)
69
	IF "%2%" == "activate" (
70
		IF "%3%" == "" (
71
			ECHO Please specify a package-key
72
			GOTO printUsage
73
		)
74
	)
75
	IF "%2%" == "deactivate" (
76
		IF "%3%" == "" (
77
			ECHO Please specify a package-key
78
			GOTO printUsage
79
		)
80
	)
81
	IF "%2%" == "delete" (
82
		IF "%3%" == "" (
83
			ECHO Please specify a package-key
84
			GOTO printUsage
85
		)
86
	)
87
	if "%2%" == "list" (
88
		SET ACTION=list%3
89
	) ELSE (
90
		SET ACTION=%2
91
		SET ARGUMENTS=--package-key=%3
92
	)
93
	GOTO execute
94
)
95

    
96
IF "%PACKAGE%" == "" GOTO printUsage
97
IF "%CONTROLLER%" == "" GOTO printUsage
98
IF "%ACTION%" == "" GOTO printUsage
99

    
100
: # ECHO P %PACKAGE%
101
: # ECHO S %SUBPACKAGES%
102
: # ECHO C %CONTROLLER%
103
: # ECHO A %ACTION%
104
: # ECHO A %ARGUMENTS%
105

    
106
GOTO end
107

    
108
:execute
109

    
110
: # execute the command
111
	SET FLOW3_CONTEXT=%CONTEXT%
112
	SET FLOW3_ROOTPATH=%FLOW3ROOTPATH%
113
	SET FLOW3_WEBPATH=%FLOW3WEBPATH%
114

    
115
	%PHP% "%FLOW3ROOTPATH%/%BOOTSTRAP%" %PACKAGE% %SUBPACKAGES% %CONTROLLER% %ACTION% %ARGUMENTS%
116
	GOTO end
117

    
118
:printUsage
119
	ECHO FLOW3 Command Line Interface
120
	ECHO .
121
	ECHO usage: "flow3 <options> <command>"
122
	ECHO .
123
	ECHO Options:
124
	ECHO .
125
	ECHO   -h, --help        - print this message
126
	ECHO   -p, --production  - execute in production context
127
	ECHO .
128
	ECHO Available commands:
129
	ECHO .
130
	ECHO   "package list available"           - list available packages
131
	ECHO   "package list active"              - list active packages
132
	ECHO   "package create <package-key>"     - create a new package
133
	ECHO   "package activate <package-key>"   - activate a package
134
	ECHO   "package deactivate <package-key>" - deactivate a package
135
	ECHO   "package delete <package-key>"     - delete a package
136
	ECHO .
137
	ECHO   "cache flush"                      - flush all caches
138
	ECHO .
139
	ECHO   "testing <package-key> <output-directory> [<testcase> [<coverage-directory>]]"
140
	ECHO      - run unit tests
141
	ECHO        "<package-key> Package to test (mandatory)"
142
	ECHO        "<output-directory> path to write the logfile.xml (mandatory)"
143
	ECHO        "<testcase> only run this testcase (optional)"
144
	ECHO        "<coverage-directory> path to write the clover.xml (optional)"
145
	ECHO .
146
	ECHO   "kickstart package <package-key>"
147
	ECHO      - kickstart a new package, including a standard controller
148
	ECHO        "<package-key> Package for the controller (mandatory)"
149
	ECHO .
150
	ECHO   "kickstart controller <package-key> [<controller-name>]"
151
	ECHO      - generate a controller
152
	ECHO        "<package-key> Package for the controller (mandatory)"
153
	ECHO        "<controller-name> Name of the controller, can also be a comma separated list of multiple controller names (optional)"
154
	ECHO .
155
	ECHO   "kickstart model <package-key> <model-name>"
156
	ECHO      - generate a model
157
	ECHO        "<package-key> Package for the model (mandatory)"
158
	ECHO        "<model-name> Name of the model (mandatory)"
159
	ECHO .
160
	ECHO   "kickstart repository <package-key> [<model-name>]"
161
	ECHO      - generate a repository
162
	ECHO        "<package-key> Package for the controller (mandatory)"
163
	ECHO        "<model-name> Name of the model the repository is for (mandatory)"
164
	ECHO .
165
	GOTO end
166

    
167
:end
168
	ECHO ---
(1-1/7)