2010-12-25 05:07:52 -05:00
|
|
|
require 'tmpdir'
|
|
|
|
|
2010-06-13 07:04:24 -04:00
|
|
|
module Devise
|
|
|
|
module Generators
|
|
|
|
class ViewsGenerator < Rails::Generators::Base
|
2010-07-04 11:08:00 -04:00
|
|
|
source_root File.expand_path("../../../../app/views", __FILE__)
|
2010-06-13 07:04:24 -04:00
|
|
|
desc "Copies all Devise views to your application."
|
|
|
|
|
|
|
|
argument :scope, :required => false, :default => nil,
|
|
|
|
:desc => "The scope to copy views to"
|
|
|
|
|
2010-08-05 21:13:26 -04:00
|
|
|
class_option :template_engine, :type => :string, :aliases => "-t",
|
2011-04-04 05:48:41 -04:00
|
|
|
:desc => "Template engine for the views. Available option is only 'erb'."
|
2010-06-13 07:04:24 -04:00
|
|
|
|
|
|
|
def copy_views
|
2011-02-15 03:49:11 -05:00
|
|
|
template = options[:template_engine].to_s
|
|
|
|
case template
|
|
|
|
when "haml", "slim"
|
|
|
|
warn "#{template} templates have been removed from Devise gem"
|
2010-06-13 07:04:24 -04:00
|
|
|
else
|
|
|
|
directory "devise", "app/views/#{scope || :devise}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2011-01-11 05:56:43 -05:00
|
|
|
end
|