Feature #4426

Provide Windows compatible version of the FLOW3 Command Line Tool

Added by Bastian Waidelich almost 12 years ago. Updated almost 10 years ago.

Status:
Resolved
Priority:
Should have
Category:
Core
Start date:
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

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.


Files

flow3.bat (5.02 KB) flow3.bat Bastian Waidelich, 2009-09-03 13:54
4426_v1.patch (80.8 KB) 4426_v1.patch Bastian Waidelich, 2009-09-29 16:43
4426_v2.patch (76.3 KB) 4426_v2.patch Karsten Dambekalns, 2009-09-30 12:47
4426_v3.patch (76.2 KB) 4426_v3.patch Fixed v2 patch file Karsten Dambekalns, 2009-10-27 16:48
4426_v4.patch (73.7 KB) 4426_v4.patch Bastian Waidelich, 2010-04-15 00:58
flow3.bat (254 Bytes) flow3.bat wrapper for the flow3 script Bastian Waidelich, 2011-06-21 16:31
flow3_dev.bat (258 Bytes) flow3_dev.bat wrapper for the flow3_dev script Bastian Waidelich, 2011-06-21 16:31

Related issues

Related to TYPO3.Flow - Feature #4469: Implement a central command line controllerResolvedBastian Waidelich2009-09-07

Actions
Related to TYPO3.Flow - Feature #6681: Make the php cli executable configurable for the flow3 commandResolvedKarsten Dambekalns2010-03-03

Actions
Related to TYPO3.Flow - Feature #7216: Custom CLI Controller without Modification of flow3.shClosedBastian Waidelich2010-04-12

Actions
Related to TYPO3 Flow Base Distribution - Bug #27482: CLI not working on WindowsResolvedKarsten Dambekalns2011-06-15

Actions
#1

Updated by Bastian Waidelich almost 12 years ago

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 12 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 12 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 over 11 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 over 11 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 over 11 years ago

  • Status changed from New to Accepted
#7

Updated by Bastian Waidelich over 11 years ago

Attached is a very first version of a new FLOW3 subpackage "CLI".
It contains of three main classes:
  • "Host" abstracts console commands like output(), outputLine() and readLine() 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 a required-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 over 11 years ago

v2: The patch has been updated in some areas:
  • 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 over 11 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 over 11 years ago

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 11 years ago

  • Target version set to 1.0 alpha 8
#12

Updated by Karsten Dambekalns over 11 years ago

  • Target version changed from 1.0 alpha 8 to 1.0 alpha 9
#13

Updated by Robert Lemke over 11 years ago

  • Start date deleted (2009-09-03)
#14

Updated by Bastian Waidelich about 11 years ago

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 11 years ago

  • Target version deleted (1.0 alpha 9)
#16

Updated by Bastian Waidelich about 10 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 almost 10 years ago

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 almost 10 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 almost 10 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 almost 10 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 almost 10 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 almost 10 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 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 80 to 100

Also available in: Atom PDF