Project integration in Grails [closed] - grails

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am doing a few tutorials and done some demo applications in Grails.
Suppose I have more than one project made in Grails and I want to integrate all these projects in to a single application, how do I do it?
For eg: I have made a 'To do list' and 'on-line examination' and now I want to create a new application that would incorporate both these applications.
Thanks

Another way to do this would be by re-packaging one (or both) of your projects as a plugin. That would allow you to keep them in separate code bases if you need to.
A plugin IS a regular Grails application (you can run it with grails run-app), so the switch over shouldn't be difficult.

The BEST way to create reusable modules in Grails is to package them as Grails plugins. As it was mentioned already, a Grails plugin IS a regular Grails web application (with a standard layout) with additional meta data, so it helps the GrailsPluginManager component to incorporate plugins into other applications.
I'd highly recommend the book which covers most of the aspects of the Grails plugin system pretty well. It even shows the example of how to wrap the 'regular' blogging app as a plugin and incorporate into another Grails application.

Copy all the files from one project into the other's directory structure and merge all files that are present in both - shouldn't be too many since "convention over configuration" means you don't have many global configuration files.
A diff/merge tool that handles directory diffs will probably make this much easier.

Related

Are there any RoR projects exploring the use of web components? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
This might not be an acceptable question for Stack Overflow but I didn't know where else to ask the question.
Web Components has been "about to happen" for a very long time. It now appears that most browsers have most of the required pieces natively instead of using polyfills (which always worried me).
I'm wondering if Ruby On Rails is planing on moving to it or if there are any projects creating web components as well as Rails server code to take advantage of them.
I'm wondering if Ruby On Rails is planing on moving to it or if there are any projects creating web components as well as Rails server code to take advantage of them.
The webpacker gem makes it easy to include some of the JS frameworks for non-native web components like Vue or React, but you can also use it with Polymer to support native web components. We do this at my work, and we don't necessarily use webpacker for it right now but I can assure you it's a very good gem.
Here's more info: https://github.com/rails/webpacker
Here's how you'd initiate a new rails project with webpacker set up for VueJS for instance:
rails new myapp --webpack=vue
I'm not sure if rails is going to implement web-components as a built-in feature or not but the motive behind adding webpacker as default in rails 6 is to improve the integration of front-end/javascript libraries. So, you can use vue-js, react-native easily along with your rails app and build components in it.
I'm personally using many vue-js components in rails projects and having no issue with that.
P.S: Same as the question this might not be an acceptable answer :P

Own CRM to get used by other application [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
We built our own CRM for our web application which has several other functions.
Now we got the request from the management that also another web application should use our CRM.
Our current web application is a monolithic one, which means that everything is in one big web application developed with Grails.
The first idea from one DEV was to create a REST API so that they can use our CRM functionality and customers are created in our application/DB and will always get synced back to their application.
I think this is not the best idea and much better would be to screw out our CRM from the monolithic web application and make a stand-alone version of it (microservice). This stand-alone version should then be configurable for things like DB, file storage, entities, workflows, ...
What do you guys think about it and maybe does one has another good idea for this specific use case?
If you can refactor your existing CRM code into Grails plugins then you can use these plugins in your current application and future Grails applications that need CRM functionality. We are using this approach and have 10+ Grails applications in production and almost all of them are using the same set of CRM plugins.
If you like to see how we split up the domains/contexts you can find the plugins here: http://gr8crm.github.io
However we are currently in the process of migrating all CRM plugins to separate microservices (Spring Boot and Micronaut) but it's a huge effort. My advice is to think carefully before you go that route. If you can break out isolated functionality in your current monolith into microservices step by step, then it could be worth trying. But replacing all features in your current CRM with microservices will probably take longer than you expect.

Is it good or bad to use the same package for domain and controller classes? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am new to grails. One thing I have noticed in the codebase of my current project is that the domain classes and the controller classes share the same package. So, you have something like this:
grails-app/controllers/foo/BarController.groovy
grails-app/domain/foo/Bar.groovy
So, is this a common practice? What are pros and cons of this? Thank you very much.
I think it's ok to use the same package for domain objects and controllers.
There is a practice called Package by Feature, which argues that grouping classes by what kind of component they are or what layer they are in is not as effective as grouping things together that contribute toward implementing the same functionality. When I work on projects packaged by layer I do a lot of hunting around going back and forth, grouping by feature would reduce that.
Usually domain objects have very little private about them. Also privacy in Groovy classes is nonexistent anyway.
This is how "convention" works over "configuration" in Grails. This is a common practice. I haven't found a demerit using it this way.
Normally, when you create-domain-class or create-controller even the tests are added in the same package as the domain class/controller respectively.
Best example of convention I can cite is when you use
grails generate-all yourPackage.Domain
Stumbled upon a similar post related to Grails where exactly the package by feature aspect as mentioned by Nathan is explained. Hope that helps.

Documenting in grails [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I want to generate something like http://grails.org/doc/latest/ for my grails project.
I have tried grails doc, but It doesn't organize the project in Taglibs, etc.
I want something to fetch easily the taglib for a given namespace.
Also to see more clearly the global state of documentation of the project.
Do you know if exists a plugin for this or any workaround?
thanks in advance
There's nothing that I know of that automatically generates this. Everything under src/docs/guide is included in the main documentation, and files under src/docs/ref are included in the left frame. Subdirectories under src/docs/ref create subsections.
See the Grails doc source folder structure at http://github.com/grails/grails-doc/tree/master/src/ for how the main docs work, and my plugin doc source at http://github.com/grails-plugins/grails-spring-security-core/tree/master/src/docs/ for a smaller example, which generates http://burtbeckwith.github.com/grails-spring-security-core/docs/manual/
I have recently contributed a plugin "Grails Runtime Docs" ( http://grails.org/plugin/grails-runtime-docs) to grails which is Grails aware. It organizes the grails artifacts and categorize the classes into Controllers, Commands, Domains, Services and Tag Libraries. The plugin generates groovy documentation from runtime so as to include the dynamic methods also, adding "Dynamic Method Summary" & "Dynamic Method Detail" in the generated html docs, that provide their source information.

Is there a lightweight Groovy web framework other than Grails? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Grails is great. Yet, sometimes, we just need a quick, lightweight web framework. Is there such a thing out there?
Ratpack
Ratpack is inspired by the excellent Sinatra framework for Ruby, and aims to make Groovy web development more classy.
If you are utilising the Google App Engine, there is Gaelyk
I haven't used them personally but Gaelyk is built on top of Groovlets I believe: http://groovy.codehaus.org/Groovlets
Portofino is written in Java and Groovy. The basic idea of Portofino is to automatically analyze the structure of an existing database, create a basic application structure, and then customize, handle permissions, etc.
If you have an existing relational database, this is a quick and easy way to bring it on-line with a nice user interface.
How about just using spring boot and write everything in groovy.
You can use the Spring Initializr to generate a brand new project with the required stack baked in
With Grails 3 you can to create an ultralight application with the next command
grails create-app appName --profile=web-micro
Update: With Grails 3.1.0 the option is
grails create-app appName --profile=web-api
The generated application is stripped with only the necessary dependencies to create a restful api.
Caelyf - Lightweight Groovy toolkit for Cloud Foundry. Caelyf
Gretty - Simple groovy++ web framework for both building web servers and clients. Built on top of netty and NIO. groovypp/gretty
Graffiti - lightweight web framework for Groovy inspired by Sinatra
webdevwilson/graffiti

Resources