34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/generators/rodauth/oauth/views_generator.rb', line 34
def create_views
features = options[:all] ? VIEWS.keys : (%i[oauth_authorize] + options[:features]).map(&:to_sym).uniq
views = features.inject([]) do |list, feature|
list |= VIEWS[feature] || []
list |= VIEWS[DEPENDENCIES[feature]] || []
end
directory = options[:directory].underscore
views.each do |view|
copy_file "app/views/rodauth/#{view}.html.erb",
"app/views/#{directory}/#{view}.html.erb" do |content|
content = content.gsub("rodauth/", "#{directory}/")
content
end
end
end
|