21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/generators/ultra_light_wizard/wizard_generator.rb', line 21
def copy_config
template "app/controllers/wizard_steps_controller.rb.erb", "app/controllers/#{file_path}_#{step_alias.pluralize}_controller.rb"
template "app/helpers/wizard_steps_helper.rb.erb", "app/helpers/#{file_path}_#{step_alias.pluralize}_helper.rb"
template "app/views/wizard_step_navigation_view.html.erb", "app/views/#{file_path}_#{step_alias.pluralize}/_#{step_alias}_navigation.html.erb"
steps.each do |step|
@wizard_step = step
template "app/models/wizard_step_model.rb.erb", "app/models/#{file_path}/#{step}.rb"
template "app/views/wizard_step_view.html.erb", "app/views/#{file_path}_#{step_alias.pluralize}/#{step}.html.erb"
end
wizard_route_content = <<-CONTENT
resources :#{plural_file_name}, only: [:create, :show] do
resources :#{file_path}_#{step_alias.pluralize}, only: [:edit, :update]
end
CONTENT
routes_content = File.new(Rails.root.join('config', 'routes.rb')).read
route wizard_route_content unless routes_content.include?(wizard_route_content)
end
|