Skip to content
Browse files

Rails 3.x compatibility: replaced RAILS_ENV and RAILS_ROOT global var…

…iables with Rails.env and Rails.root for
  • Loading branch information...
1 parent cba6b37 commit cc89d303eb7307df14a9fa5d0fd329c338be0a3c @wleeperogs wleeperogs committed Oct 10, 2011
Showing with 5 additions and 5 deletions.
  1. +1 −1 install.rb
  2. +2 −2 lib/map_layers/view_helpers.rb
  3. +2 −2 tasks/map_layers_tasks.rake
View
2 install.rb
@@ -3,7 +3,7 @@
Dir.chdir(Dir.getwd.sub(/vendor.*/, '')) do
def copy_files(source_path, destination_path, plugin_root)
- source, destination = File.join(File.expand_path(plugin_root), source_path), File.join(RAILS_ROOT, destination_path)
+ source, destination = File.join(File.expand_path(plugin_root), source_path), File.join(Rails.root, destination_path)
FileUtils.mkdir(destination) unless File.exist?(destination)
FileUtils.cp_r(source, destination)
end
View
4 lib/map_layers/view_helpers.rb
@@ -27,7 +27,7 @@ def map_layers_includes(options = {})
if options.has_key?(:img_path)
img_path = options[:img_path]
end
- if RAILS_ENV == "development" && File.exist?(File.join(RAILS_ROOT, 'public/javascripts/lib/OpenLayers.js'))
+ if Rails.env == "development" && File.exist?(File.join(Rails.root, 'public/javascripts/lib/OpenLayers.js'))
html << '<script src="/javascripts/lib/Firebug/firebug.js"></script>'
html << '<script src="/javascripts/lib/OpenLayers.js"></script>'
else
@@ -36,7 +36,7 @@ def map_layers_includes(options = {})
html << stylesheet_link_tag("map")
- img_path=(Pathname(ActionController::Base.relative_url_root||"") +img_path).cleanpath.to_s
+ img_path=(Pathname(ENV['RAILS_RELATIVE_URL_ROOT']||"") +img_path).cleanpath.to_s
html << javascript_tag("OpenLayers.ImgPath='"+ img_path + "/';")
proxy = options.has_key?(:proxy) ? options[:proxy] : controller.controller_name
html << javascript_tag("OpenLayers.ProxyHost='/#{proxy}/proxy?url=';")
View
4 tasks/map_layers_tasks.rake
@@ -7,14 +7,14 @@ namespace :map_layers do
end
def copy_files(source_path, destination_path, plugin_root)
- source, destination = File.join(plugin_root, source_path), File.join(RAILS_ROOT, destination_path)
+ source, destination = File.join(plugin_root, source_path), File.join(Rails.root, destination_path)
FileUtils.mkdir(destination) unless File.exist?(destination)
FileUtils.cp_r(source, destination)
end
desc "Remove development libraries"
task :uninstall_dev_lib do
- FileUtils.rm_r(File.join(RAILS_ROOT, "/public/javascripts/lib"))
+ FileUtils.rm_r(File.join(Rails.root, "/public/javascripts/lib"))
end

0 comments on commit cc89d30

Please sign in to comment.
Something went wrong with that request. Please try again.