polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Merlin <paulmer...@apache.org>
Subject Re: Yeoman generator
Date Mon, 06 Mar 2017 08:49:28 GMT
Niclas Hedhman a écrit :
> A heads-up;
> I am working on the Yeoman generator to create Polygene projects from
> commandline, and there is some progress that I will commit shortly.

\o/

> One of the new things that I have added is that it is possible to provide a
> "model" in JSON, which either used as defaults for the questions, or one
> can disable the prompts and it will take all the stuff from that model.
>
> It came about because I couldn't figure out how to do "repeat questions" in
> Yeoman, i.e. Add the name of a Module, then add X value types, Y entity
> types..., then back to be able to add another Module and so on. If there is
> someone with Yeoman experience who can fix that, please step forward.
>
> So, I created a small json format (see sample below).
> This in turn means that small "profiles" could be prepared and simply fed
> into Yeoman and out comes a skeletal application, runnable at that point.
>
> If anyone wants to help working on this, here is what you need to do,
>
> install npm and yeoman on your system (http://yeoman.io/learning/)
>
> cd tools/generator-polygene/
> sudo npm link
>
> That will make the "polygene" generator available in yeoman.
>
> I typically do my workflow by first creating my "project directory", say
> "mkdir niclas", then I repeatedly run,
>
>
> rm -rf * && cp ../model.json imported-model.json && yo polygene --import
> --export && ./gradlew clean build assemble
>
> between each change in the source code. Above I have an "model.json"
> containing the "modules" section seen in the "exported" model below. (Later
> the name of import and export files will be added)
>
> One thing that needs to be figured out, is how to make this available in
> the Polygene SDK distribution.

In the yeoman world, generators are published to and fetched from the
npm registry. We should think about doing just that.

About including the generators in the Polygene distribution, if we want
to go down that route we need to come up with some usage scenario first.
We could either bundle everything needed or require extra installation
steps. Niclas, any thoughts?


> Another that Paul has brought up is how to
> test all the permutations so that every combination of entitystore,
> indexing, serialization, caching, rest, jmx, reindexer, migration support,
> metrics and what else could be dreamt up, actually compiles after a
> generation. With the new "--import" this automation should be easier to do,
> although I think Yeoman has support for it too.

The https://github.com/srs/gradle-node-plugin could help integrate the
automation with our build system. It should even be possible to not
require any manual installation. Ideally the generated projects include
some basic tests that we could run as part of the whole SDK test suite.


> Anyway, a good chunk of work is going to be committed a bit later today..
>
> {
>    "modules": {
>        "users": {
>            "cruds": [
>                {
>                    "name": "Users"
>                },
>                {
>                    "name": "Roles"
>                },
>                {
>                    "name": "User"
>                },
>                {
>                    "name": "Role"
>                },
>                {
>                    "name": "Permission"
>                },
>                {
>                    "name": "Group"
>                },
>                {
>                    "name": "Groups"
>                }
>            ],
>            "entities": [],
>            "values": [],
>            "services": [
>                {
>                    "name": "AuthService",
>                    "visibilty": "application"
>                }
>            ],
>            "transients": [],
>            "objects": [],
>            "name": "users",
>            "clazz": {
>                "name": "AuthService",
>                "visibilty": "application"
>            }
>        }
>    },
>    "name": "Niclas",
>    "packageName": "com.acme.niclas",
>    "singletonApp": false,
>    "features": [
>        "rest api"
>    ],
>    "entitystore": "Cassandra",
>    "indexing": "Rdf",
>    "caching": "none",
>    "serialization": "Jackson",
>    "packagename": "com.acme.niclas",
>    "javaPackageDir": "com/acme/niclas"
> }
>

Mime
View raw message