Skip to content
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

Template generator #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/generators/capistrano/maintenance/README.md
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions lib/generators/capistrano/maintenance/template_generator.rb
Original file line number Diff line number Diff line change
@@ -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