how to get Grails Plugin to include empty directories

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how to get Grails Plugin to include empty directories

clr meno
I have created a plugin to hold the conf directories since the same configurations apply to multiple applications. The issue is that when I include the plugin in the host application the empty folders under these configuration directories are not included.
For Example, if I have a folder ABC under grails-app/conf and this folder ABC has ABC1.properties and an empty folder ABC2, then the installed plugin only has ABC1.properties under ABC. 
I need the empty folder included as well. 
The host code has logic to create files in this empty folder which is currently failing as the folder doesn't exist. Any advise is much appreciated.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/4b98a09c-f04d-4698-ba1d-297ef58a559e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to get Grails Plugin to include empty directories

sergiomichels
I'm not sure if I understood what you're trying to do with the configuration folder. 

By "host code" you mean your application code? When exactly you create files in the "ABC2" folder (by script, in runtime...)?

If your applications are aware that files should be created in that folder, why they can't create the folder if it not exists?

--
Sérgio Michels

On Mon, Apr 17, 2017 at 12:31 PM, clr meno <[hidden email]> wrote:
I have created a plugin to hold the conf directories since the same configurations apply to multiple applications. The issue is that when I include the plugin in the host application the empty folders under these configuration directories are not included.
For Example, if I have a folder ABC under grails-app/conf and this folder ABC has ABC1.properties and an empty folder ABC2, then the installed plugin only has ABC1.properties under ABC. 
I need the empty folder included as well. 
The host code has logic to create files in this empty folder which is currently failing as the folder doesn't exist. Any advise is much appreciated.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/4b98a09c-f04d-4698-ba1d-297ef58a559e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAHTf1NX3zwr61GbUNQVu9QPp9C%2BjwtNsXNj-Vb9dtT9isa%3DyJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to get Grails Plugin to include empty directories

clr meno
In reply to this post by clr meno
Sorry for the delay in responding.
We have application specific config in separate directories and these directories are under grails-app/conf.
For example:
grails-app
             -conf
                    - bookData
                          - bookFolder
                          - bookConf.groovy



On Wednesday, April 19, 2017 at 9:46:12 PM UTC-4, Phill Nacelli wrote:
This is a shot in the dark, but are you using GIT for your source version control? If so, is that what you mean as "the empty folders under these configuration directories are not included"?

On Monday, April 17, 2017 at 11:31:34 AM UTC-4, clr meno wrote:
I have created a plugin to hold the conf directories since the same configurations apply to multiple applications. The issue is that when I include the plugin in the host application the empty folders under these configuration directories are not included.
For Example, if I have a folder ABC under grails-app/conf and this folder ABC has ABC1.properties and an empty folder ABC2, then the installed plugin only has ABC1.properties under ABC. 
I need the empty folder included as well. 
The host code has logic to create files in this empty folder which is currently failing as the folder doesn't exist. Any advise is much appreciated.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/2ef17cab-4ef6-4319-a10f-de82db9b275b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to get Grails Plugin to include empty directories

clr meno
In reply to this post by clr meno
Sorry for the delay in responding.

We have application specific config in separate directories and these directories are added under grails-app/conf.
For example:
grails-app
             -conf
                    - bookData
                          - bookFolder (this is an empty folder)
                          - bookConf.groovy

                    - encryptionData
                          - encrFolder (this is an empty folder)
                          - encrConf.groovy

These conf folders are in a plugin and the plugin is included in the main application through BuildConfig.groovy under
plugins{
      compile ':myPlugin'
}


But when the compilation of the main application completes, the plugin that gets added contains the following:

grails-app
             -conf
                    - bookData
                          - bookConf.groovy

                    - encryptionData
                          - encrConf.groovy

But I need it to include even the empty folders like given below:

grails-app
             -conf
                    - bookData
                          - bookFolder (this is an empty folder)
                          - bookConf.groovy

                    - encryptionData
                          - encrFolder (this is an empty folder)
                          - encrConf.groovy


Any advise is much appreciated


On Wednesday, April 19, 2017 at 9:46:12 PM UTC-4, Phill Nacelli wrote:
This is a shot in the dark, but are you using GIT for your source version control? If so, is that what you mean as "the empty folders under these configuration directories are not included"?

On Monday, April 17, 2017 at 11:31:34 AM UTC-4, clr meno wrote:
I have created a plugin to hold the conf directories since the same configurations apply to multiple applications. The issue is that when I include the plugin in the host application the empty folders under these configuration directories are not included.
For Example, if I have a folder ABC under grails-app/conf and this folder ABC has ABC1.properties and an empty folder ABC2, then the installed plugin only has ABC1.properties under ABC. 
I need the empty folder included as well. 
The host code has logic to create files in this empty folder which is currently failing as the folder doesn't exist. Any advise is much appreciated.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/5b2900d1-3e07-4632-8d01-eb1081b09c82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to get Grails Plugin to include empty directories

Jeff Scott Brown-4
On 26 Apr 2017, at 17:00, clr meno wrote:

> Sorry for the delay in responding.
>
> We have application specific config in separate directories and these
> directories are added under grails-app/conf.
> For example:
> grails-app
>              -conf
>                     - bookData
>                           - bookFolder (this is an empty folder)
>                           - bookConf.groovy
>
>                     - encryptionData
>                           - encrFolder (this is an empty folder)
>                           - encrConf.groovy
>
> These conf folders are in a plugin and the plugin is included in the
> main
> application through BuildConfig.groovy under
> plugins{
>       compile ':myPlugin'
> }
>
>
> But when the compilation of the main application completes, the plugin
> that
> gets added contains the following:
>
> grails-app
>              -conf
>                     - bookData
>                           - bookConf.groovy
>
>                     - encryptionData
>                           - encrConf.groovy
>
> But I need it to include even the empty folders like given below:
>
> grails-app
>              -conf
>                     - bookData
>                           - bookFolder (this is an empty folder)
>                           - bookConf.groovy
>
>                     - encryptionData
>                           - encrFolder (this is an empty folder)
>                           - encrConf.groovy
>
>
> Any advise is much appreciated
>

Because you mentioned BuildConfig.groovy, I assume you are using Grails
1 or 2.  If that is the case, you could create the empty directory from
the plugin’s _Install.groovy script.  The example at
http://docs.grails.org/2.5.6/guide/plugins.html#hookingIntoBuildEvents 
does exactly that.



JSB
--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/84E6DA68-192C-4C55-A226-20765688DDC1%40objectcomputing.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to get Grails Plugin to include empty directories

clr meno
Yes I am using Grails 2.4.4. 
Is there a way to specify includeEmptyDirs= true while the plugin is included in BuildConfig.groovy so that the empty directories also get included and not omitted. 


On Thursday, April 27, 2017 at 9:45:08 AM UTC-4, Jeff Scott Brown wrote:
On 26 Apr 2017, at 17:00, clr meno wrote:

> Sorry for the delay in responding.
>
> We have application specific config in separate directories and these
> directories are added under grails-app/conf.
> For example:
> grails-app
>              -conf
>                     - bookData
>                           - bookFolder (this is an empty folder)
>                           - bookConf.groovy
>
>                     - encryptionData
>                           - encrFolder (this is an empty folder)
>                           - encrConf.groovy
>
> These conf folders are in a plugin and the plugin is included in the
> main
> application through BuildConfig.groovy under
> plugins{
>       compile ':myPlugin'
> }
>
>
> But when the compilation of the main application completes, the plugin
> that
> gets added contains the following:
>
> grails-app
>              -conf
>                     - bookData
>                           - bookConf.groovy
>
>                     - encryptionData
>                           - encrConf.groovy
>
> But I need it to include even the empty folders like given below:
>
> grails-app
>              -conf
>                     - bookData
>                           - bookFolder (this is an empty folder)
>                           - bookConf.groovy
>
>                     - encryptionData
>                           - encrFolder (this is an empty folder)
>                           - encrConf.groovy
>
>
> Any advise is much appreciated
>

Because you mentioned BuildConfig.groovy, I assume you are using Grails
1 or 2.  If that is the case, you could create the empty directory from
the plugin’s _Install.groovy script.  The example at
<a href="http://docs.grails.org/2.5.6/guide/plugins.html#hookingIntoBuildEvents" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdocs.grails.org%2F2.5.6%2Fguide%2Fplugins.html%23hookingIntoBuildEvents\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHNxsXV4uw8UPaGVmd1q4HkTlMvDg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdocs.grails.org%2F2.5.6%2Fguide%2Fplugins.html%23hookingIntoBuildEvents\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHNxsXV4uw8UPaGVmd1q4HkTlMvDg&#39;;return true;">http://docs.grails.org/2.5.6/guide/plugins.html#hookingIntoBuildEvents
does exactly that.



JSB
--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
<a href="http://www.autismspeaks.org/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.autismspeaks.org%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHLOilSQBYB1lzLN6Ms6K6DtQY5DQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.autismspeaks.org%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHLOilSQBYB1lzLN6Ms6K6DtQY5DQ&#39;;return true;">http://www.autismspeaks.org/

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/2b96a223-212b-4fab-9cbf-4216ce4545a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to get Grails Plugin to include empty directories

Jeff Scott Brown-4
On 28 Apr 2017, at 11:25, clr meno wrote:

> Yes I am using Grails 2.4.4.
> Is there a way to specify includeEmptyDirs= true while the plugin is
> included in BuildConfig.groovy so that the empty directories also get
> included and not omitted.
>

I don’t know what you mean by included.  A plugin doesn’t generally
contain content that automatically gets contributed to the project
source code tree when a plugin is installed.  If you want a certain
directory to exist in the application that is using the plugin, you
should either make that a documentation issue, or do something like use
the _Install.groovy script that I mentioned earlier.




JSB

--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/FA75A634-F277-4A31-8CD4-253CD3D8D45B%40objectcomputing.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to get Grails Plugin to include empty directories

clr meno
Thanks a lot for your response Jeff.
My understanding of plugin is that it is similar to a jar file in java applications. Hence, I created a custom plugin and moved all the common configuration related files/folders to that plugin. So that every application that uses those configurations can just add the plugin. One of the conf folders has an empty directory so wanted to know if there is any option to include the exact folder structure including this empty directory. 

I will definitely try using _Install.groovy script but wanted to know if there was an alternative way to specify this while I added it in BuildConfig.groovy

On Friday, April 28, 2017 at 12:35:07 PM UTC-4, Jeff Scott Brown wrote:
On 28 Apr 2017, at 11:25, clr meno wrote:

> Yes I am using Grails 2.4.4.
> Is there a way to specify includeEmptyDirs= true while the plugin is
> included in BuildConfig.groovy so that the empty directories also get
> included and not omitted.
>

I don’t know what you mean by included.  A plugin doesn’t generally
contain content that automatically gets contributed to the project
source code tree when a plugin is installed.  If you want a certain
directory to exist in the application that is using the plugin, you
should either make that a documentation issue, or do something like use
the _Install.groovy script that I mentioned earlier.




JSB

--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
<a href="http://www.autismspeaks.org/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.autismspeaks.org%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHLOilSQBYB1lzLN6Ms6K6DtQY5DQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.autismspeaks.org%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHLOilSQBYB1lzLN6Ms6K6DtQY5DQ&#39;;return true;">http://www.autismspeaks.org/

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/18671de1-4307-43f1-b3a4-cd3ec98a2a94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to get Grails Plugin to include empty directories

clr meno
Thanks a lot for all your responses.

I finally took the approach of checking the existence of the folder and creating a folder if it didn't exist. I made this change in the main application that included this plugin.



On Monday, May 1, 2017 at 7:24:00 AM UTC-4, clr meno wrote:
Thanks a lot for your response Jeff.
My understanding of plugin is that it is similar to a jar file in java applications. Hence, I created a custom plugin and moved all the common configuration related files/folders to that plugin. So that every application that uses those configurations can just add the plugin. One of the conf folders has an empty directory so wanted to know if there is any option to include the exact folder structure including this empty directory. 

I will definitely try using _Install.groovy script but wanted to know if there was an alternative way to specify this while I added it in BuildConfig.groovy

On Friday, April 28, 2017 at 12:35:07 PM UTC-4, Jeff Scott Brown wrote:
On 28 Apr 2017, at 11:25, clr meno wrote:

> Yes I am using Grails 2.4.4.
> Is there a way to specify includeEmptyDirs= true while the plugin is
> included in BuildConfig.groovy so that the empty directories also get
> included and not omitted.
>

I don’t know what you mean by included.  A plugin doesn’t generally
contain content that automatically gets contributed to the project
source code tree when a plugin is installed.  If you want a certain
directory to exist in the application that is using the plugin, you
should either make that a documentation issue, or do something like use
the _Install.groovy script that I mentioned earlier.




JSB

--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
<a href="http://www.autismspeaks.org/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.autismspeaks.org%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHLOilSQBYB1lzLN6Ms6K6DtQY5DQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.autismspeaks.org%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHLOilSQBYB1lzLN6Ms6K6DtQY5DQ&#39;;return true;">http://www.autismspeaks.org/

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/01ed736d-e7f2-42cc-a074-d44a1db08981%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...