diff --git a/lib/generators/capistrano/maintenance/README.md b/lib/generators/capistrano/maintenance/README.md new file mode 100644 index 0000000..c4cd885 --- /dev/null +++ b/lib/generators/capistrano/maintenance/README.md @@ -0,0 +1,11 @@ +To create a local maintenance.html.erb template in a default path "config/deploy/templates" type this in your shell: + +bundle exec rails generate capistrano:maintenance:template + +To override the default path: + +bundle exec rails generate capistrano:maintenance:template "config/templates" + +Add the template path to deploy.rb: + +set :maintenance_template_path, 'config/deploy/templates/maintenance.html.erb' # or your custom path diff --git a/lib/generators/capistrano/maintenance/template_generator.rb b/lib/generators/capistrano/maintenance/template_generator.rb new file mode 100644 index 0000000..74233da --- /dev/null +++ b/lib/generators/capistrano/maintenance/template_generator.rb @@ -0,0 +1,19 @@ +module Capistrano + module Maintenance + module Generators + class TemplateGenerator < Rails::Generators::Base + + desc "Create a local maintenance.html.erb template file for customization" + source_root File.expand_path('../../../../capistrano/templates', __FILE__) + argument :templates_path, type: :string, + default: "config/deploy/templates", + banner: "path to templates" + + def copy_template + copy_file "maintenance.html.erb", "#{templates_path}/maintenance.html.erb" + end + + end + end + end +end