Changeset 8160
- Timestamp:
- 11/17/07 01:39:19 (11 months ago)
- Files:
-
- trunk/railties/CHANGELOG (modified) (1 diff)
- trunk/railties/environments/boot.rb (modified) (2 diffs)
- trunk/railties/test/boot_test.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/railties/CHANGELOG
r8159 r8160 1 1 *SVN* 2 3 * RAILS_GEM_VERSION may be set to any valid gem version specifier. #10057 [Chad Woolley, Chu Yeow] 2 4 3 5 * Load config/preinitializer.rb, if present, before loading the environment. #9943 [Chad Woolley] trunk/railties/environments/boot.rb
r8159 r8160 56 56 def load_rails_gem 57 57 if version = self.class.gem_version 58 gem 'rails', "=#{version}"58 gem 'rails', version 59 59 else 60 60 gem 'rails' … … 94 94 95 95 def parse_gem_version(text) 96 $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*'([ \d.]+)'/96 $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*'([!~<>=]*\s*[\d.]+)'/ 97 97 end 98 98 trunk/railties/test/boot_test.rb
r8159 r8160 97 97 98 98 boot = GemBoot.new 99 boot.expects(:gem).with('rails', ' =0.0.1')99 boot.expects(:gem).with('rails', '0.0.1') 100 100 boot.load_rails_gem 101 101 end … … 113 113 114 114 boot = GemBoot.new 115 boot.expects(:gem).with('rails', ' =0.0.1').raises(Gem::LoadError, 'missing rails 0.0.1 gem')115 boot.expects(:gem).with('rails', '0.0.1').raises(Gem::LoadError, 'missing rails 0.0.1 gem') 116 116 STDERR.expects(:puts) 117 117 boot.expects(:exit).with(1) … … 156 156 end 157 157 158 def test_should_allow_advanced_rubygems_version_specifications 159 # See http://rubygems.org/read/chapter/16 160 assert_equal "=1.2.3", parse("RAILS_GEM_VERSION = '=1.2.3'") # equal sign 161 assert_equal "= 1.2.3", parse("RAILS_GEM_VERSION = '= 1.2.3'") # with space 162 assert_equal "!=1.2.3", parse("RAILS_GEM_VERSION = '!=1.2.3'") # not equal 163 assert_equal ">1.2.3", parse("RAILS_GEM_VERSION = '>1.2.3'") # greater than 164 assert_equal "<1.2.3", parse("RAILS_GEM_VERSION = '<1.2.3'") # less than 165 assert_equal ">=1.2.3", parse("RAILS_GEM_VERSION = '>=1.2.3'") # greater than or equal 166 assert_equal "<=1.2.3", parse("RAILS_GEM_VERSION = '<=1.2.3'") # less than or equal 167 assert_equal "~>1.2.3.0", parse("RAILS_GEM_VERSION = '~>1.2.3.0'") # approximately greater than 168 end 169 158 170 private 159 171 def parse(text)