Giter Site home page Giter Site logo

play-scalagen's Introduction

Scala code generators for the Play! framework
--------------------------------------------------------------------------

This module can be used to generate Scala code. It can generate JPA based models, CRUD and associated test cases.

--------------------------------------------------------------------------
Options:
--------------------------------------------------------------------------

--scaffold-jpa [entity name] [attribute1:type1]*     Generates the JPA based model and associated CRUD code.
--model-jpa [entity name] [attribute1:type1]*         Generates the JPA based model.
--scaffold-siena [entity name] [attribute1:type1]*     Generates the Siena based model and associated CRUD code.

Note: --scaffold and --model are shortcuts to generate JPA

These generators can only be used from inside a Scala Play! project. To create a new project, use the following commands:
play new myproject --with scala
cd myproject
play scalagen:generate --scaffold <provide details of the scaffold you need to create>

==========================================================================================================
Installation:
==========================================================================================================
1. Extract the contents of /dist/scalagen-0.1.zip into a local directory on the server.
2. Add the following to dependencies.yml
    - customModules -> scalagen

repositories:
    - playCustomModules:
        type: local
        artifact: "/full/path/to/scalagen/directory"
        contains:
            - customModules -> *
3. Run "play deps" on the project

That's it!

--------------------------------------------------------------------------
Usage Examples: 
--------------------------------------------------------------------------

*Note*: As a prerequisite, you must install the jquery grid files before a generated scaffold can be used. It is a one time activity per project. Please run the following for the same:

play scalagen:jquery


1. Generating a CRUD scaffold:
--------------------------------------------------------------------------

play scalagen:generate --scaffold User name:String login:String role:Role

For the lazy, the following does the same: play scalagen:g --s User name:String login:String role:Role

The Siena equivalent is :
play scalagen:g --ss User name:String login:String role:Role

This will create a controller, view files for CRUD, model, unit tests for the model and selenium tests for CRUD operations.

*Note*: The generated controllers use JQGrid for the index/ listing page and provide pagination, search and sorting of data. If you would rather use a plain HTML show all view, please pass flatHTML=true in the URL parameters.

2. Generating a JPA model:
--------------------------------------------------------------------------

play scalagen:generate --model User name:String login:String role:Role

For the lazy, the following does the same: play scalagen:g --m User name:String login:String role:Role

This will create a JPA model and associated unit tests.

--------------------------------------------------------------------------
Known Limitations: 
--------------------------------------------------------------------------
1. This module can only create models for basic data types. All other data types are assumed to be many-to-one relationships.
2. The parameters passed on command line can not have space between attribute name and type.
3. The module only supports JPA via Hibernate at the moment.

play-scalagen's People

Contributors

asinghal avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.