Class: MultiRails::Config
- Inherits:
-
Object
- Object
- MultiRails::Config
- Defined in:
- lib/multi_rails/config.rb
Overview
Simple config object
Class Attribute Summary collapse
-
.rails_requires ⇒ Object
Returns the value of attribute rails_requires.
-
.weird_versions ⇒ Object
Returns the value of attribute weird_versions.
Class Method Summary collapse
- .load_path ⇒ Object
- .named_version_lookup(version) ⇒ Object
-
.rails_load_path ⇒ Object
Output rails from the load path as a sanity check, to make sure we are really using the version of Rails we think we are.
- .version_lookup(version = nil) ⇒ Object
Class Attribute Details
.rails_requires ⇒ Object
Returns the value of attribute rails_requires.
12 13 14 |
# File 'lib/multi_rails/config.rb', line 12 def rails_requires @rails_requires end |
.weird_versions ⇒ Object
Returns the value of attribute weird_versions.
12 13 14 |
# File 'lib/multi_rails/config.rb', line 12 def weird_versions @weird_versions end |
Class Method Details
.load_path ⇒ Object
31 32 33 |
# File 'lib/multi_rails/config.rb', line 31 def load_path $LOAD_PATH end |
.named_version_lookup(version) ⇒ Object
19 20 21 22 23 |
# File 'lib/multi_rails/config.rb', line 19 def named_version_lookup(version) version = @weird_versions[version] || version raise MultiRailsError, "Can't find Rails gem version #{version} - available versions are: #{Loader.all_rails_versions.to_sentence})." if !Loader.all_rails_versions.include? version version end |
.rails_load_path ⇒ Object
Output rails from the load path as a sanity check, to make sure we are really using the version of Rails we think we are
26 27 28 29 |
# File 'lib/multi_rails/config.rb', line 26 def rails_load_path gem_rails_regex = %r[gems/(rails-[\d\.]+)/] load_path.grep(gem_rails_regex).first.match(gem_rails_regex)[1] rescue nil end |
.version_lookup(version = nil) ⇒ Object
13 14 15 16 17 |
# File 'lib/multi_rails/config.rb', line 13 def version_lookup(version = nil) return named_version_lookup(version) if version return named_version_lookup(ENV["MULTIRAILS_RAILS_VERSION"]) if ENV['MULTIRAILS_RAILS_VERSION'] Loader.latest_stable_version end |