New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple plugin_dirs and plugin_config_dirs #267

Closed
kaero opened this Issue Aug 8, 2014 · 5 comments

Comments

Projects
None yet
2 participants
@kaero

kaero commented Aug 8, 2014

Now it's only possible to set only one plugins directory, but i want to have multiple "levels" of plugins directories:

  • system: /usr/share/<app_label>/plugins
  • user: ~/.<app_label>/plugins
  • project: <determined_project_dir>/.<app_label>/plugins

And multiple configurations:

  • system: /etc/<app_label>/plugins.d/*.conf
  • user: ~/.<app_label>/plugins.d/*.conf
  • project: <determined_project_dir>/.<app_label>/plugins.d/*.conf
@derks

This comment has been minimized.

Show comment
Hide comment
@derks

derks Aug 8, 2014

Member

Totally doable. Plugin configurations should support multiple paths (same as application config_files meta) however this gets a little more complex in that config_files under CementApp.Meta is an developer setting, where plugin_config_dir is an application configuration (modifiable by the end-user in the config file).

What would you think if plugin_config_dirs under CementApp.Meta defined a list of plugin configuration directories (similar to what config_files defines for app configs)... and plugin_dirs defined a list of plugin directories. At that point then, plugin_config_dir and plugin_dir would simply append to those lists, rather than just hard setting the singular path?

I think that would be a good solution, as it would maintain backward compatibility but give you the control to define common load paths in the app (while still allowing the end-user to define their own singular path if they like).

?

Member

derks commented Aug 8, 2014

Totally doable. Plugin configurations should support multiple paths (same as application config_files meta) however this gets a little more complex in that config_files under CementApp.Meta is an developer setting, where plugin_config_dir is an application configuration (modifiable by the end-user in the config file).

What would you think if plugin_config_dirs under CementApp.Meta defined a list of plugin configuration directories (similar to what config_files defines for app configs)... and plugin_dirs defined a list of plugin directories. At that point then, plugin_config_dir and plugin_dir would simply append to those lists, rather than just hard setting the singular path?

I think that would be a good solution, as it would maintain backward compatibility but give you the control to define common load paths in the app (while still allowing the end-user to define their own singular path if they like).

?

@derks derks added dev/2.3.x labels Aug 8, 2014

@derks derks added this to the 2.3.2 Development milestone Aug 8, 2014

@derks derks self-assigned this Aug 8, 2014

@kaero

This comment has been minimized.

Show comment
Hide comment
@kaero

kaero Aug 8, 2014

Sounds fine, described solution is perfectly fits into my needs. Thanks a lot!

kaero commented Aug 8, 2014

Sounds fine, described solution is perfectly fits into my needs. Thanks a lot!

@derks

This comment has been minimized.

Show comment
Hide comment
@derks

derks Aug 20, 2014

Member

This should also apply to CementApp.Meta.template_dir.

Member

derks commented Aug 20, 2014

This should also apply to CementApp.Meta.template_dir.

@derks derks changed the title from Add support for multiple paths of plugins directories and configurations to Add support for multiple plugin_dirs and plugin_config_dirs Aug 20, 2014

@derks

This comment has been minimized.

Show comment
Hide comment
@derks

derks Aug 21, 2014

Member

@kaero Can you pull the issue267 branch and test it out to ensure it meets your needs? I have not modified the documentation yet, however it is pretty straight forward:

class MyApp(CementApp):
    class Meta:
        plugin_config_dirs = [
            '/etc/myapp/plugins.d',
            '~/.myapp/plugins.d',
            ]

        plugin_dirs = [
            '/usr/lib/myapp/plugins',
            '~/.myapp/plugins',
            ]

Additionally, the plugin_dir and plugin_config_dir settings within an application configuration file will continue to work, and will simply be added to the above lists (if the list doesn't already have the path).

Let me know and I'll complete the documentation adjustments and get this into master/2.4.x.

Member

derks commented Aug 21, 2014

@kaero Can you pull the issue267 branch and test it out to ensure it meets your needs? I have not modified the documentation yet, however it is pretty straight forward:

class MyApp(CementApp):
    class Meta:
        plugin_config_dirs = [
            '/etc/myapp/plugins.d',
            '~/.myapp/plugins.d',
            ]

        plugin_dirs = [
            '/usr/lib/myapp/plugins',
            '~/.myapp/plugins',
            ]

Additionally, the plugin_dir and plugin_config_dir settings within an application configuration file will continue to work, and will simply be added to the above lists (if the list doesn't already have the path).

Let me know and I'll complete the documentation adjustments and get this into master/2.4.x.

derks added a commit that referenced this issue Aug 21, 2014

@derks derks closed this Aug 21, 2014

@kaero

This comment has been minimized.

Show comment
Hide comment
@kaero

kaero Aug 21, 2014

@derks Implementation looks fine and fits for my needs. Thanks a lot for amazingly fast response and for spent time for implementation!

kaero commented Aug 21, 2014

@derks Implementation looks fine and fits for my needs. Thanks a lot for amazingly fast response and for spent time for implementation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment