Migrating Grails 2.X to 3.X - What are Profiles? - grails

I am a rather novice programmer and I have been learning Grails 2 and 3. For my work, I have been assigned to migrate Grails 2 applications to Grails 3. I do not want to just simply follow a copy-paste tutorial and not develop any depth of knowledge as a result.
Currently, I have been running alongst these links that detail the migration process:
https://docs.grails.org/3.0.x/guide/upgrading.html
https://opensource.com/article/18/5/upgrading-grails-applications
The above link from opensource points to https://docs.grails.org/latest/guide/profiles.html for further detailing on profiles. However, I do earnestly do not understand a majority of its intricacies.
The second link that elaborates more on the original Grails migration documentation elaborates more on the topic of profiles but I feel as though I'm not acquiring the big picture element here. Are profiles essentially different templates to utilize for YAML files? For instance, currently my applications utilize a web profile as "application.yml."

Are profiles essentially different templates to utilize for YAML
files?
No.
A profile represents a type of application. For example, we have a web profile for traditional web applications which do server side HTML generation, we have a react profile that contains a rest backend and a React based SPA front end, we have a rest-api profile which is populated with sensible defaults and dependencies for publishing REST apis, etc.
It is not the case that profiles are essentially different templates to utilize for YAML files. YAML files are 1 tiny piece of profiles.

Related

How can I easily customize the templates used for generation of Controller in Grails rest-api profile

I have a rest-api app I am working on. I run generate-controller on my domain, and a controller is generated, but in other profiles I have been able to "install" the templates that were used and customize them. This profile has no install templates command.
All attempts at doing this with the rest-api profile have been unsuccessful. I exported the templates that are used from the plugin jar and placed them in the file system, in a place grails could find them, but they are not used.
Should it be possible with this profile to customize the templates used for code generation - controller,service, view GSON? If so what does that project setup look like? I am working with a vanilla 4.0.0 rest-api profile project.
Section 10.5.3 in the documentation glosses over this, and contains a dead link to the scaffolding plugin, so it is of no help.
I tried to add the scaffolding plugin to my project build.gradle.
compile "org.grails.plugins:scaffolding"
but then the project won't even run.
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'abstractViewResolver' available
It seems like it ought to be possible to customize the code generation templates in the rest-api profile, but I can't find a working configuration/setup to do it. Any pointers would be greatly appreciated.
When I generate the scaffolding after adding the scaffolding plugin, and run install-templates, it installs the templates for a web profile, rather than rest-api, so they are of little use. And even after doing so, they are not used in generation.
Should it be possible with this profile to customize the templates
used for code generation - controller,service, view gsps?
It probably should be but I don't think the templates are currently supported in the rest-api profile. I don't think install-templates even exists in that profile by default. You mention GSPs but I would not anticipate that install-templates would generate GSP templates in a rest-api app because by default, there is no GSP support in the rest-api profile.
If so what does that project setup look like?
If support is added for this I would expect the project setup to looks just like a typical rest-api app plus the templates installed below the src folder.
Feel free to submit feature requests at https://github.com/grails-profiles/rest-api/issues and/or pull requests at https://github.com/grails-profiles/rest-api/pulls.

Aspnetzero - Publishing .NET Core 2.0 version question

I just published my Aspnetzero solution to my hosting provider site.
I have multiple apps setup on my website. They are located in the example.com/apps/app1 folder structure.
So my aspnetzero site is on example.com/apps/aspnetzeroapp folder.
As I expected, this is breaking all of the URL references (Images, nav menu links etc.) on my published app.
I have updated the appsettings.json files with the URLs as shown below.
"App": {
"WebSiteRootAddress": "https://example.com/apps/aspnetzeroapp/",
"RedirectAllowedExternalWebSites":"https://example.com/apps/aspnetzeroapp/"},
Question: Can someone tell me all the changes, within the aspnetzero template code, that I need to make in order for my app to work given the above folder structure?
Update: I found this thread on the ABP support forum. I am having all the same issues with images and API endpoints. In that thread there is a link to a GIT code repo for a fix that was implemented by the ABP team. I cannot see it as I don't have an active license. Could that solution apply to my issue?
I decided on the easier option. I setup a new domain and deployed my app at root of the new domain. Its all working fine now!

Setting up a CMS for a Phonegap / Cordova iphone app

When making a iphone app with Phonegap / Cordova is it possible to attach a web based CMS to it, to pull the data down from, so that a non technical user could update the app ?
Usualy you'd just build them using html, css, jquery/js but i wandered if there was an easier way to update them ?
Rather than a CMS, you should look into static site generators. I use Jekyll for all my PhoneGap apps, including one that has a non-technical user updating the content.
Content pages are set up as markdown files with a yaml header - not quite as user friendly as a full CMS, but still pretty easy to edit.
I have jekyll set up as a build step, so all the generated html files get packaged and deployed to the device as part of a single click build process.
You could export static html from a web based CMS, but that will likely be more trouble than it is worth by the time you debug all the bits that were designed to work online only.
Loading the pages directly from the web will work just fine technically, but runs into several of the app store rules - no significant added functionality, no offline access and possibly downloading executable code.
You could use a normal cms on a server like a webpage so normal joomla wordpress etc.
Then you add the url to the phonegap whitelist and load it like the normal phonegap html url.
With DrupalGap, it is possible to create iOS (and Android, etc) mobile applications using PhoneGap and a Drupal powered website.
What is Drupal?
Drupal is an open source content management platform powering millions
of websites and applications. It’s built, used, and supported by an
active and diverse community of people around the world.
Why Drupal?
Use Drupal to build everything from personal blogs to enterprise
applications. Thousands of add-on modules and designs let you build
any site you can imagine.
What is DrupalGap?
DrupalGap is an open source mobile application development kit for
Drupal websites. It uses Drupal, PhoneGap, jQuery Mobile and jDrupal.
With the DrupalGap Mobile Application Development Kit and API,
developers can create custom multi-platform mobile applications that
communicate with their Drupal websites.
Helpful Links
DrupalGap Getting Started Guide
DrupalGap SDK on GitHub

Using Phonegap as a native container for a Rails 3 App

I'm looking into using PhoneGap for an iOS app so that I can utilize the camera API. The plan is to use Rails to manage the entire experience. At this point, I'm not particularly concerned about performance. If it wasn't for the need for the camera, I would simply design it as a true web app.
Most of the answers and tutorials I have found suggest using ajax to the backend server to render the frontend. At this point in the app development, I'm not sure I want to build so much of the view in JS and would prefer to use Rails to render the views. I have seen a few very brief references to use PhoneGap as a container to literally render the Rails app. Performance aside, is this possible and how would I set up the core html file in PhoneGap to let the mobile app run normally?
I do not believe such a container exists to run on the client side but it is possible to dynamically serve a PhoneGap app (i.e. the app acts as a web browser with native functionality available via javascript commands).
Here is code which demonstrate exactly what you are describing.
Here is a screen cast I did associated with demo.
NOTE: The demo is using an out 3.2.1, and is broken as of the latest version Xcode and/or PhoneGap but it is possible, and apps of this nature are valid in the the various app stores, (Linkedin alongwith many others are already doing it.) The logic is there I just haven't had the time to fix the bug with the new version of Xcode, or update the PhoneGap code (doing the update may actually fix the bug in one quick work session).
Maybe you can also check my example app that is exported to Phoengap. It doesn't use camera but it is possible to combine native parts with Phonegap.
https://github.com/joscas/base_app/tree/devel (currently in the devel branch for the exportable version)
Life deploy: https://starter-app-staging.herokuapp.com (the desktop version)
It is based on rails / ember.js plus with token authentication (ember-auth) + OAuth (Google, LinkedIn,..) and Devise.
It uses the (phonegap-rails) gem I've created to export assets, fix paths etc.

Open Discussion - Symfony - what do you do to start your projects quicker?

When you start a new project (whether it's personal or professional) what do you have at hand to quickly start developing the project?
For example, when I start a new project at work, I have the following already setup from a custom sandbox:
Two different authentication classes, LDAP and CAS which I can change via app.yml
Custom form widgets which I use across most applications
Capistrano deployment script for deploying the project to staging or production servers.
A mail template class which uses an XML file for the templates to send emails
Mail server, ldap etc. settings all configured.
Bunch of icons and the same CSS (which with some exceptions is always the same for each project)
custom error pages, layouts, login layout etc.
static pages such as about, contact us etc.
Useful plugins such as sfFormExtraPlugin, twig etc.
jquery and jQuery UI libraries
Basic local ACL and translation model classes and some other default models.
Tasks - send email task and build translations.
custom tools class for doing some custom stuff
custom factories and some default routes
helpers which I will most probably use are enabled by default (i18n, partial etc.)
And some other things :-)
I'm just wondering what you do to make your development quicker and more efficient when starting a new project. Hopefully I'll learn some new things from what you do.
Thanks folks!
Great question and great list. Here's some more:
As a general practice, whenever we develop a feature that could be used across projects, we develop it as a plugin so it can be easily dropped into other projects.
Custom form formatter that uses our own widget/validators in place of the default Symfony ones.
Custom mailer with support for sending processing templates as emails and better HTML email support.
Plugin for minimizing/combining CSS and JS assets.
Symlink from web/sf to lib/vendor/symfony/data/web. Better than an alias in apache.
Custom admin generator templates.
Quick setup script that takes commandline options or read a config file to create full local dev env (init the project, setup a vhost, modify etc/hosts, import to svn, create svn externals for Symfony and key plugins like sfDoctrineGuard)
Custom Project skeleton
Custom Javascript helper based on Apostrophes new a_js_*() helper functions

Resources