Guest User

Untitled

a guest
Apr 25th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. # Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
  2.  
  3. unless defined?(RAILS_ROOT)
  4. root_path = File.join(File.dirname(__FILE__), '..')
  5.  
  6. unless RUBY_PLATFORM =~ /(:?mswin|mingw)/
  7. require 'pathname'
  8. root_path = Pathname.new(root_path).cleanpath(true).to_s
  9. end
  10.  
  11. RAILS_ROOT = root_path
  12. end
  13.  
  14. unless defined?(Rails::Initializer)
  15. if File.directory?("#{RAILS_ROOT}/vendor/rails")
  16. require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
  17. else
  18. require 'rubygems'
  19. gem 'soap4r'
  20.  
  21. environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
  22. environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
  23. rails_gem_version = $1
  24.  
  25. if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
  26. # Asking for 1.1.6 will give you 1.1.6.5206, if available -- makes it easier to use beta gems
  27. rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last
  28.  
  29. if rails_gem
  30. gem "rails", "=#{rails_gem.version.version}"
  31. require rails_gem.full_gem_path + '/lib/initializer'
  32. else
  33. STDERR.puts %(Cannot find gem for Rails ~>#{version}.0:
  34. Install the missing gem with 'gem install -v=#{version} rails', or
  35. change environment.rb to define RAILS_GEM_VERSION with your desired version.
  36. )
  37. exit 1
  38. end
  39. else
  40. gem "rails"
  41. require 'initializer'
  42. end
  43. end
  44.  
  45. Rails::Initializer.run(:set_load_path)
  46. end
Add Comment
Please, Sign In to add comment