Class: Emenu::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_routeObject



32
33
34
# File 'lib/generators/emenu/install_generator.rb', line 32

def add_route
  route "match 'emenu_state' => 'application#emenu_state'\n"
end

#copy_default_menuObject



22
23
24
# File 'lib/generators/emenu/install_generator.rb', line 22

def copy_default_menu
  copy_file 'default_menu/navigation.rb', 'app/navigation/navigation.rb'
end

#copy_imagesObject



8
9
10
# File 'lib/generators/emenu/install_generator.rb', line 8

def copy_images
  directory 'images', 'public/images/emenu'
end

#copy_javscriptObject



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

def copy_javscript
  copy_file 'javascripts/jquery-1.4.2.min.js', 'public/javascripts/jquery-1.4.2.min.js'
  copy_file 'javascripts/emenu.js', 'public/javascripts/emenu.js'
end

#copy_stylesheetsObject



17
18
19
20
# File 'lib/generators/emenu/install_generator.rb', line 17

def copy_stylesheets
  copy_file 'stylesheets/emenu.css', 'public/stylesheets/emenu.css'
  copy_file 'stylesheets/reset.css', 'public/stylesheets/reset.css'
end

#explainObject



36
37
38
39
40
# File 'lib/generators/emenu/install_generator.rb', line 36

def explain
  puts ""
  puts "  You need to link 'reset.css' and 'emenu.css' from layout file"
  puts "  You need to link 'jquery-1.4.2.min.js' and 'emenu.js' from layot file"
end

#include_emenu_into_application_controllerObject



26
27
28
29
30
# File 'lib/generators/emenu/install_generator.rb', line 26

def include_emenu_into_application_controller
  $install = true
  inject_into_class "app/controllers/application_controller.rb", ApplicationController,  "  include Emenu\n"
  $install = false
end