Feature #4426
Provide Windows compatible version of the FLOW3 Command Line Tool
Status: | Resolved | Start date: | ||
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Bastian Waidelich | % Done: | 100% |
|
Category: | Core | |||
Target version: | TYPO3 Flow Base Distribution - 1.0 beta 1 | |||
PHP Version: | Complexity: | |||
Has patch: |
Description
FLOW3 distribution comes with an easy to use command line tool (see http://flow3.typo3.org/documentation/tutorials/getting-started/gettingstarted.kickstart/#gettingstarted.kickstart.commandlinetool).
For the good old Windows users we should supply a similar batch version of the script.
Related issues
Associated revisions
[TASK] Simplify CLI use, add batch file
Removes the two scripts for Development and Production context and
keeps one script instead. To change the context, use the environment
variable FLOW3_CONTEXT.
Also adds a flow3.bat file for use on Windows.
Change-Id: Idd7d74c6c4a2ad4b88f3d5849681d2bb289e94b9
Fixes: #27482
Resolves: #4426
History
#1 Updated by Bastian Waidelich almost 6 years ago
- File flow3.bat added
Attached is a very first (incomplete) version of a batch script "ported" from the FLOW3 Command Line Tool to Windows batch.
The good news: If placed next to the original "flow3" script, it will work directly as described in the tutorial ("flow3 package create foo") as *.bat files take precedence over files without extension.
The bad news: Windows batch sucks and there is a lot of duplication.. If someone is familiar with this "language", please help!
#2 Updated by Bastian Waidelich almost 6 years ago
Thought:
In order to avoid too much duplication the script might be turned into a PHP script that is only invoked by the CLI..
#3 Updated by Irene Höppner almost 6 years ago
I know somebody who can do that script, but he said the current version is too hard.... if we move the main stuff to php, he would do the windows-script.
#4 Updated by Karsten Dambekalns almost 6 years ago
We should definitely move the logic to PHP and use shell / batch only to invoke that. The same style works well for PEAR, phpunit, phpcs, ... Any chance to get this done until end of this month to have it in alpha 5?
#5 Updated by Bastian Waidelich almost 6 years ago
Karsten Dambekalns wrote:
We should definitely move the logic to PHP and use shell / batch only to invoke that. [...]
Any chance to get this done until end of this month to have it in alpha 5?
I was playing around with a script, that is able to determine possible parameters and method descriptions for configured actions..
You would configure the possible commands like
cli: commandSets: package: controller: F3\FLOW3\Package\Controller\ManagerController actions: [listAvailable, listActive, create, activate, deactivate, delete] cache: controller: F3\FLOW3\Cache\Controller\ManagerController actions: [flush] testing: controller: F3\Testing\Controller\CLIController actions: [run] kickstart: controller: F3\Kickstart\Controller\KickstartController actions: [generatePackage, generateController, generateModel, generateRepository]
In my first tests this worked quite well.. Though, as discussed @ t3con09, this requires configuration manager & mvc framework to work. If there was a syntax error in one of the classes, there is no possibility to execute commands.
I'd suggest to implement something like that anyways, and later think about some fallback mechanism.
I'll clean up my prototype and upload it here, but I can't promise to be done until next week..
#6 Updated by Karsten Dambekalns almost 6 years ago
- Status changed from New to Accepted
#7 Updated by Bastian Waidelich almost 6 years ago
- File 4426_v1.patch added
- % Done changed from 0 to 80
It contains of three main classes:
- "Host" abstracts console commands like
output()
,outputLine()
andreadLine()
and allows you to register commands - "Command" can contain CommandArguments and may be registered at the Host
- "CommandArgument" very simple class, that exists of the properties
name
,description
and arequired
-flag
Additionally the patch replaces the current "flow3" shell script by a simplified version that forwards control to the new CLI script FLOW3/Scripts/FLOW3CLI.php. Last but not least the patch comes with a "translated" batch version for windows.
Note: This is experimental and not yet complete. Besides, there are still some issues to be solved (like actually firing the actions, a fallback)
#8 Updated by Karsten Dambekalns almost 6 years ago
- File 4426_v2.patch added
- shell script works now
- reflection service changes
- reading from STDIN has been simplified
- some comment and style cleanup
All in all it works and seems the way to go!
#9 Updated by Bastian Waidelich almost 6 years ago
Karsten Dambekalns wrote:
Hi Karsten,
v2: The patch has been updated in some areas:
I can't apply your patch for some reason - can you please recreate it only for FLOW3 package?
Thanks
Bastian
#10 Updated by Karsten Dambekalns almost 6 years ago
- File 4426_v3.patch added
Bastian Waidelich wrote:
I can't apply your patch for some reason - can you please recreate it only for FLOW3 package?
Probably the problem caused by the superfluous line at line 1004 that manifests itself as an error on line 991 when patching. Try again with v3.
As soon as my subversion build is through I can hopefully create patches with line numbers again, then I can create a seperate patch for FLOW3...
#11 Updated by Karsten Dambekalns over 5 years ago
- Target version set to 1.0 alpha 8
#12 Updated by Karsten Dambekalns over 5 years ago
- Target version changed from 1.0 alpha 8 to 1.0 alpha 9
#13 Updated by Robert Lemke over 5 years ago
- Start date deleted (
2009-09-03)
#14 Updated by Bastian Waidelich over 5 years ago
- File 4426_v4.patch added
- Category set to Core
- Status changed from Accepted to Needs Feedback
Attached version works for me. With following snippet pasted to "Settings.yaml":
FLOW3: cli: commandSets: foo: controller: F3\FLOW3\Package\Controller\PackageManagerController actions: [create, delete] bar: controller: F3\Kickstart\Controller\KickstartController actions: [generatePackage]
But I'm not happy with it, because it is pretty slow to load up (at least on Windows) and it relies on a lot of parts of the framework..
An option might be to store the avaivable commands in a text file and add a command that recreates that textfile on request.
Please test and give feedback
#15 Updated by Robert Lemke about 5 years ago
- Target version deleted (
1.0 alpha 9)
#16 Updated by Bastian Waidelich about 4 years ago
With the current implementation, this issue is (almost) resolved.
We still need a small batch wrapper as described above.
Apart from that, unfortunately interactive shell won't be possible on Windows.. readline_read_history()
and readline_completion_function()
are not available on PHP for Windows.. The current shellCommand should check the existence of this functions to avoid fatal errors.
#17 Updated by Bastian Waidelich about 4 years ago
- File flow3.bat added
- File flow3_dev.bat added
- Target version set to 1.0 beta 1
Attached are two very simple batch wrappers for the flow3/flow3_dev scripts allowing it to use the CLI commands from the normal Windows bash.
Place the scripts in Packages/Framework/FLOW3/Scripts
and create a symlink at the root of your installation (or put them directly in the root).
NOTE: Make sure to verify that flow3 & flow3_dev are symlinked correctly (see #27482)
#18 Updated by Mr. Hudson about 4 years ago
- Status changed from Needs Feedback to Under Review
Patch set 1 of change Ie4b3d9d5f620572b926b7f975102b2b09471c42b has been pushed to the review server.
It is available at http://review.typo3.org/3049
#19 Updated by Mr. Hudson about 4 years ago
Patch set 1 of change Ibfae85839e4620e584af141e62c3c5886f575a4e has been pushed to the review server.
It is available at http://review.typo3.org/3053
#20 Updated by Mr. Hudson about 4 years ago
Patch set 1 of change Idd7d74c6c4a2ad4b88f3d5849681d2bb289e94b9 has been pushed to the review server.
It is available at http://review.typo3.org/3056
#21 Updated by Mr. Hudson about 4 years ago
Patch set 2 of change Idd7d74c6c4a2ad4b88f3d5849681d2bb289e94b9 has been pushed to the review server.
It is available at http://review.typo3.org/3056
#22 Updated by Mr. Hudson about 4 years ago
Patch set 3 of change Idd7d74c6c4a2ad4b88f3d5849681d2bb289e94b9 has been pushed to the review server.
It is available at http://review.typo3.org/3056
#23 Updated by Sebastian Kurfuerst almost 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 80 to 100