Hi Robby, that would be indeed more interesting, so users can test their pipeline have to be put on production. More cycles tonight, I'll let you know ASAP! :) All the best, Simo
http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Wed, Nov 2, 2011 at 11:27 AM, Robby Pelssers <robby.pelss...@nxp.com> wrote: > Hi Simone, > > I was wondering if it would be possible to instead read a (reusable) sitemap > from the command line instead and just provide some match pattern to execute > a specific pipeline. Not sure if I'm just naïve here but it would make sense > to me on first sight. > > {code} > Usage: c3pipe [options] > Options: > > -f, --file point to an existing sitemap > -p --pattern the pattern to be handled by the sitemap > > Robby > > -----Original Message----- > From: simone.trip...@gmail.com [mailto:simone.trip...@gmail.com] On Behalf Of > Simone Tripodi > Sent: Tuesday, November 01, 2011 9:21 PM > To: dev@cocoon.apache.org > Subject: Meet Cocoon CLI > > Hi all guys, > I took advantage from today that's been a vacation day here to play > and experiment a little a new cocoon application I proposed time ago, > called cocoon-cli. > I had a private conversation with Cedri Beust, the author of > JCommander, that gave me a little suggestion how to NOT make a CLI > application :P > > So, what I did today is replicating the Apache Ant/Maven behavior, I > mean, cocoon-cli is a console application that takes in input an XML > pipeline descriptor - called c3p.xml by default - that looks like very > similar to ant build.xml file: > > {code} > <pipelines name="Cocoon Pipelines test" default="id0"> > > <pipeline id="id0"> > <generator src="${user.dir}/src/test/resources/missing-elements.xml" /> > <serializer /> > </pipeline> > > <pipeline id="id1"> > <generator src="${user.dir}/src/test/resources/missing-elements.xml" /> > <serializer /> > </pipeline> > > </pipelines> > {code} > > as you can see, it reminds the Ant build XML format, <pipeline> > elements can be associated, as concept, to <target>s, each pipeline > has an id (and an optional description) and the user can specify a > default one has to be executed if no specific one (or more) are > specified in the CLI. > Note that it supports the ${} variables, both Environment and System > Properties. > > Available commands are: > > {code} > Usage: c3pipe [options] <pipeline IDs>*. > Options: > -X, --debug Produce execution debug output. > Default: false > -f, --file Force the use of an alternate c3p file. > Default: > /Users/simonetripodi/Documents/workspace/cocoon-root/cocoon-cli/target/cocoon-cli-3.0.0-beta-1-SNAPSHOT/c3p.xml > -h, --help Display help information. > Default: false > -p, --pipeshelp Print pipelines help information. > Default: false > -v, --version Display version information. > Default: false > {code} > > typing `-p`, like Ant, enlists the available pipelines in the actual > descriptor: > > {code} > $ c3pipe -p > [INFO] > [INFO] > ------------------------------------------------------------------------ > [INFO] Apache Cocoon 3 > [INFO] > ------------------------------------------------------------------------ > [INFO] > [INFO] Apache Cocoon 3 - Pipeline 'Cocoon Pipelines test' (default: id0) > [INFO] id0 (non-caching) - Description not available > [INFO] id1 (non-caching) - Description not available > [INFO] > [INFO] > ------------------------------------------------------------------------ > [INFO] Apache Cocoon 3 SUCCESS > [INFO] Total time: 0s > [INFO] Finished at: Tue Nov 01 20:58:48 CET 2011 > [INFO] Final Memory: 10M/493M > [INFO] > ------------------------------------------------------------------------ > {code} > > when executing one (or more) pipeline(s), it prints the output in the sysout > > {code} > [INFO] > [INFO] > ------------------------------------------------------------------------ > [INFO] Apache Cocoon 3 > [INFO] > ------------------------------------------------------------------------ > [INFO] > [INFO] Executing default Pipeline 'id0' > <?xml version="1.0" encoding="UTF-8"?><!-- > Licensed to the Apache Software Foundation (ASF) under one > or more contributor license agreements. See the NOTICE file > distributed with this work for additional information > regarding copyright ownership. The ASF licenses this file > to you under the Apache License, Version 2.0 (the > "License"); you may not use this file except in compliance > with the License. You may obtain a copy of the License at > > http://www.apache.org/licenses/LICENSE-2.0 > > Unless required by applicable law or agreed to in writing, > software distributed under the License is distributed on an > "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > KIND, either express or implied. See the License for the > specific language governing permissions and limitations > under the License. > --><!-- $Id: missing-elements.xml 1195964 2011-11-01 12:40:02Z > simonetripodi $ --><pipelines > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Valid > Pipeline" default="id0"> > <pipeline id="id0"/> > </pipelines>[INFO] Default pipeline 'id0' executed > [INFO] > [INFO] > ------------------------------------------------------------------------ > [INFO] Apache Cocoon 3 SUCCESS > [INFO] Total time: 0s > [INFO] Finished at: Tue Nov 01 21:08:35 CET 2011 > [INFO] Final Memory: 13M/493M > [INFO] > ------------------------------------------------------------------------ > {code} > > To package it, it is enough launching `mvn package` under > /cocoon-cli[1], its execution will produce .tar.gaz and .zip packages > under /cocoon-cli/target, that contain a multi-platform application > which directories tree looks like the Maven one: > > . > ├── README > ├── bin > │ ├── c3pipe > │ └── c3pipe.bat > ├── lib > ├── cocoon-cli-3.0.0-beta-1-SNAPSHOT.jar > ├── cocoon-pipeline-3.0.0-beta-1-SNAPSHOT.jar > ├── cocoon-sax-3.0.0-beta-1-SNAPSHOT.jar > ├── cocoon-util-3.0.0-beta-1-SNAPSHOT.jar > ├── cocoon-xml-2.0.2.jar > ├── commons-beanutils-1.8.3.jar > ├── commons-digester3-3.1.jar > ├── jcl-over-slf4j-1.6.1.jar > ├── jcommander-1.17.jar > ├── logback-classic-0.9.29.jar > ├── logback-core-0.9.29.jar > └── slf4j-api-1.6.1.jar > > TODOs: > 1) the XSchema is incomplete and doesn't support yet all the > components we have (optionals included); > 2) consequence of 1), the XML parser doesn't ingest all the components; > 3) adding a way to serialize the output to files instead of sysout only; > 4) passing more properties using the -D option in the CLI; > 5) adding a debugger support, ATM the debug option doesn't produce > useful results; > 6) during packaging, properties on filtered resources are not > correctly expanded; > 7) ... > > WDYT? Feedbacks are needed and of course participation is open, > everybody interested is welcome! :) > All the best, have a nice day!!! > Simo > > [1] https://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-cli > > http://people.apache.org/~simonetripodi/ > http://simonetripodi.livejournal.com/ > http://twitter.com/simonetripodi > http://www.99soft.org/ > >