Class: Sidro::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/sidro/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_viewsObject



12
13
14
15
# File 'lib/generators/sidro/install/install_generator.rb', line 12

def copy_views 
  directory "views",    "app/views/inherited_resources"
  copy_file "sidro.rb", "config/initializers/sidro.rb"
end

#modify_layoutObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/sidro/install/install_generator.rb', line 17

def modify_layout
  # Stylesheet
  gsub_file "app/views/layouts/application.html.erb", /<\/head>/ do
    "  <%= stylesheet_link_tag \"formtastic\", \"formtastic_changes\" %>\n</head>"
  end
  # Main menu
  gsub_file "app/views/layouts/application.html.erb", /<ul class="wat-cf"><\/ul>/ do
    '<%= render "main_menu" %>'
  end
  # Sub menu
  gsub_file "app/views/layouts/application.html.erb", /user-navigation">.*<\/ul>\s*<\/div>/m do
    'user-navigation">
      <%= render "user_menu" %>
    </div>'
  end
end