Grails fixture plugin how to load fixtures from an inline plugin? - grails

we have an application that uses a centralized domain using an inline plugin. We where using bootstrap data so all of our applications that use the domain could use the bootstrap. Now when using the Fixture plugin we run into the problem that it wants to read the fixture files from a location inside application instead of the shared inline plugin. All .load() methods look for a fixture file inside the application.
Is there a way of loading the fixture files from a central place instead of the fixture directory inside the application?

Currently this is not possible.
See Grails Jira issues:
http://jira.grails.org/browse/GPFIXTURES-16

I had the same problem so I created a config value that allows you to set a config value.
This commit should do the trick, but it's not merged into the plugin (yet):
https://github.com/nwittstruck/grails-fixtures/commit/1cea0da7bf32303885cc536fe89bb9be483375bc

Related

Replace the default templates that Grails generates

So, i am getting started with Grails and i just started using install-templates! And it is a pretty cool stuff.
I learned that i should modify the installed templates before using generate-all, generate-views or generate-controllers.
But what i couldn't figure out (and also i couldn't find in google) is how to make the changes i have made to the template permanent. A want to make the changes i have made to be used for all the projects i create from now on.
In a nutshell, How can i change the default templates Grails generates?
You have to modify the scaffolding-X.X.X.zip at grails-X-X-X\plugins (the place you installed it) so the generate goes for all the projects.
Go to src/templates/scaffolding and edit the files.

Include assets in engine from main application

I have created an admin interface as a Rails engine. In the project I work in at the moment I need to add some custom javascript. I want to keep this in my main app and not add it in my engine.
Perhaps register some javascript or stylesheet files in a config file and let the engine include them.
Any ideas on how I can achieve this?
you are asking about ideas, so here is one: just use a convention!
it's common to do this in rails, so why not just do it for your engine. just document how to name the files and what to configure for that (assets need to be configured differently when they should not be included in application.js/css). the admin interface typus does the same thing: http://docs.typuscmf.com/customization/custom_css_and_js.html
in your engine, you can just check if that file is present in the mounting app and include it in that case.
should be pretty straight forward.

unnecessary files in grails templates

I created some templates for the auto-generation code by grails install-templates, but some unnecessary files like form.gsp are still created. How can I remove them? I cannot find a config file to modify and create only my templates. Can anyone help me?
grails install-templates installs a copy of the Grails templates to src/templates for you to modify. If you don't care about form.gsp, then just ignore it. The templates aren't packaged into your WAR, they are simply used by the Grails generate-* commands. If you feel it's necessary to remove it, just don't run grails install-templates again. The command only needs to be done once.
Grails builds up the list of templates that it needs to generate from by combining the default set of templates in GRAILS_HOME with the ones installed in your app, with the one in your app taking precedence in the case of a name clash. So if you delete a template from your app's src/templates then Grails will simply use the built-in version of that template instead. I presume this is deliberate don't-repeat-yourself behaviour, to allow you to selectively override some of the templates but stick with the defaults for others without having to have a duplicate copy of the ones you haven't modified.
So I don't think you can prevent the form.gsp from being created when you generate-views, but if your modified scaffolding templates don't reference it then it does no harm being there and you can just ignore it. You could create an empty version in your src/templates
<%-- This file intentionally left blank --%>
When you execute the command "grails install-templates" it generates a folder src/templates/scaffolding. Inside this folder are the files that will be generated automatically when you execute o comando generete-all/view/controller.

Customize Grails generated views

Is it possible to customize code generated from grails create view command? for example can I use YUI or JQuery UI library for view code generation? Is there any sample for that?
Thanks,
Running the Grails command grails install-templates will copy into src/templates the template files used by all of the other Grails commands to generate files. You can then modify them however you wish.
Also, you may wish to look at some of the scaffolding plugins, such as Grails Twitter Bootstrap Scaffolding or Enhanced Scaffolding.

Rails plugin, possible customize styelsheet?

could I have a stylesheets directory in Rails' plugin directory?
I am trying to write plugin for a existing Rails webApp, but still not sure how to customize
the default CSS for my plugin?
I have a example for this .
Please Reffer in rails ck editor.
IN rails-ck-editor they will give the css and javascripts in plugin itslef .
By running task we ca get the css files.
Please find the task file in the following path (vendor/plugins/rails-ckeditor/tasks/ckeditor_tasks.rake)
You can use this task according to you.
the rails-ck-editor link is
http://github.com/standout/rails-ckeditor
I suggest this only for your reference.
Thanks & Regards,
Ramanaa Selvaa
The typical way is to write a generator in your plugin that copies your custom stylesheet into a special public/stylesheets/you directory in the main app. Then the generator prints out instructions to include the plugin stylesheet in the layouts.

Resources