0
-require File.dirname(__FILE__) + '/../../../config/environment'
0
puts IO.read(File.join(File.dirname(__FILE__), 'README'))
0
-puts "\n\nAltering ApplicationController, this can be undone by editing that file..."
0
-#install alter the app controller
0
-app_controller = File.readlines(RAILS_ROOT + '/app/controllers/application.rb')
0
-new_app_controller = ''
0
-app_controller.each do |line|
0
- if line.include? 'class ApplicationController' then
0
- app_controller[i] = "\s\sinclude ExceptionLoggable #Automatically Added by install script\n" + app_controller[i]
0
- new_app_controller << line
0
-app_controller_target = File.open(RAILS_ROOT + '/app/controllers/application.rb','w')
0
-app_controller_target.write(new_app_controller)
0
-app_controller_target.close
0
-#app controller alter done
0
-puts ".....Completed.\n"
0
-puts "Altering routes.rb, this can be undone by editing that file..."
0
-routes = File.readlines(RAILS_ROOT + '/config/routes.rb')
0
- if line.include? 'ActionController::Routing::Routes.draw' then
0
- routes[i] = "map.connect \"logged_exceptions/:action/:id\", :controller => \"logged_exceptions\" #Automatically Added by install script\n" + routes[i]
0
-routes_target = File.open(RAILS_ROOT + '/config/routes.rb','w')
0
-routes_target.write(new_routes)
0
-puts ".....Completed.\n"
0
-puts "Attempting to determine your pagination plugin..."
0
-Dir.foreach(RAILS_ROOT + '/vendor/plugins') do |file|
0
- if file.strip == 'will_paginate' then
0
- @pagination = 'will_paginate'
0
- elsif file.strip == 'paginating_find' then
0
- @pagination = 'paginating_find'
0
-if @pagination == 'will_paginate' then
0
- puts "You are using will_paginate, editing init.rb to reflect that..."
0
- #set it to will_paginate
0
- init_rb = File.readlines(File.join(File.dirname(__FILE__), 'init.rb'))
0
- init_rb.each do |line|
0
- if line.include? "$PAGINATION_TYPE = 'none'"
0
- init_rb[j] = init_rb[j].gsub('#','')
0
- init_rb[j] = init_rb[j].gsub('#','')
0
- init_rb[j] = init_rb[j].gsub('#','')
0
- target = File.open(File.join(File.dirname(__FILE__), 'init.rb'),'w')
0
- target.write(new_init)
0
-elsif @pagination == 'paginating_find' then
0
- puts "You are using paginating_find, editing init.rb to reflect that..."
0
- #set it to paginating_find
0
- init_rb = File.readlines(File.join(File.dirname(__FILE__), 'init.rb'))
0
- init_rb.each do |line|
0
- if line.include? "$PAGINATION_TYPE = 'none'"
0
- init_rb[j] = init_rb[j].gsub('#','')
0
- init_rb[j] = init_rb[j].gsub('#','')
0
- target = File.open(File.join(File.dirname(__FILE__), 'init.rb'),'w')
0
- target.write(new_init)
0
- puts "Could not detect a pagination plugin, using home brewed pagination instead..."
0
-puts "Now use script/generate exception_migration\n Then run rake db:migrate\n\n"
Comments
No one has commented yet.