DEV: support for settings/locales in plugin generator (#6341)

This commit is contained in:
Joffrey JAFFEUX 2018-08-30 14:12:06 +02:00 committed by GitHub
parent 103509b9dd
commit 90e67b671b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 0 deletions

View File

@ -49,6 +49,15 @@ class PluginGenerator < Rails::Generators::NamedBase
template 'javascript.es6.erb', File.join('plugins', dasherized_name, 'assets/javascripts/initializers', "#{dasherized_name}.es6")
end
def create_settings_file
template 'settings.yml.erb', File.join('plugins', dasherized_name, 'config', 'settings.yml')
end
def create_locales_file
template 'client.en.yml.erb', File.join('plugins', dasherized_name, 'config/locales', 'client.en.yml')
template 'server.en.yml.erb', File.join('plugins', dasherized_name, 'config/locales', 'server.en.yml')
end
def create_gitignore_entry
plugin_entry = "!/plugins/#{dasherized_name}"

View File

@ -0,0 +1,3 @@
en:
js:
<%= underscored_name %>:

View File

@ -0,0 +1,3 @@
en:
site_settings:
<%= underscored_name %>_enabled: "Enable <%= name %> plugin"

View File

@ -0,0 +1,4 @@
plugins:
<%= underscored_name %>_enabled:
default: true
client: true