diff --git a/generate.rb b/generate.rb index f99f2c6..15725de 100644 --- a/generate.rb +++ b/generate.rb @@ -37,6 +37,11 @@ def slug desc 'The name of the plugin' end + option :no_setup do + long '--no-setup' + desc 'Disable creation and registration of setup hooks' + end + end name = Choice.choices.name @@ -64,10 +69,12 @@ def slug main.close # render setup template -template = ERB.new File.read(BASEDIR + '/templates/setup.php') -main = File.new("setup.php", "w") -main.write(template.result) -main.close +unless Choice.choices.no_setup + template = ERB.new File.read(BASEDIR + '/templates/setup.php') + main = File.new("setup.php", "w") + main.write(template.result) + main.close +end # copy application controller FileUtils.copy BASEDIR + '/templates/ApplicationController.php', 'app/controllers/' \ No newline at end of file diff --git a/templates/plugin_name.php b/templates/plugin_name.php index 90f46d6..b9faf08 100644 --- a/templates/plugin_name.php +++ b/templates/plugin_name.php @@ -55,4 +55,10 @@ function <%= name.slug %>_add_default_view_directory($directories) return $directories; } } -add_filter('app-view-directories', '<%= name.slug %>_add_default_view_directory'); \ No newline at end of file +add_filter('app-view-directories', '<%= name.slug %>_add_default_view_directory'); + +<% unless Choice.choices.no_setup %> +register_activation_hook(__FILE__, '<%= name.slug %>_activate'); +register_deactivation_hook(__FILE__, '<%= name.slug %>_deactivate'); +register_uninstall_hook(__FILE__, '<%= name.slug %>_uninstall'); +<% end %> \ No newline at end of file