Class: SchoolgirlUniform::Generators::InstallGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/schoolgirl_uniform/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_initializer_fileObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/schoolgirl_uniform/install_generator.rb', line 11

def create_initializer_file
  copy_file "wizard.html.erb", "app/views/#{file_name}/_wizard.html.erb"
  copy_file "form_errors.html.erb", "app/views/#{file_name}/_form_errors.html.erb"
  copy_file "show.html.erb", "app/views/#{file_name}/show.html.erb"
  copy_file "finish.html.erb", "app/views/#{file_name}/finish.html.erb"
  copy_file "steps/first.html.erb", "app/views/#{file_name}/steps/_first.html.erb"
  copy_file "steps/second.html.erb", "app/views/#{file_name}/steps/_second.html.erb"
  copy_file "steps/third.html.erb", "app/views/#{file_name}/steps/_third.html.erb"
  template "forms/template_form.rb.erb", "app/forms/#{file_name}_form.rb"
  template "controllers/template_controller.rb.erb", "app/controllers/#{file_name}_controller.rb"
end

#setup_routesObject



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/generators/schoolgirl_uniform/install_generator.rb', line 23

def setup_routes
  route <<-FILE
resource :#{file_name}, controller: '#{file_name}', only: :show do
    collection do
match :current, via: [:get, :post]
get  :previous
get  :finish
    end
end
  FILE
end