This project is archived and is in readonly mode.
Add magic encoding comment to generated files
-
Michael Koziarski
Thanks for that, out of interest, what happens if you remove the unless defined? condition?
-
Jan De Poorter
Rails ignores the RAILS_GEM_VERSION because of a bad regular expression. It is the first line of your code, and rails requires a character to exist before RAILS_GEM_VERSION.
It has to do with these lines in config/boot.rb:
@@
environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
@@
It works if you change the regex to
@@
/[^#]?RAILS_GEM_VERSION = '([\d.]+)'/
@@
This is fixed with the 2.1 config file where the regexp is:
@@
/^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
@@
I suggest backporting this to 2.0.3, as a workaround you can just add a blank line (no comment!) before the RAILS_GEM_VERSION
-
Mauro Cicio
Fixed!
Michael,
Removing the "unless defined?" doesn't change anything.
Jan,
My config/environment.rb now starts with the following 3 lines:
# The next line must be blank! Necessary to avoid issues with 2.1.0. RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSIONand now the RAILS_GEM_VERSION is picked up as you expected.
The case of people having the RAILS_GEM_VERSION is not that common I guess: thanks a lot for spending time on this dusty corner :-)
-
Mauro Cicio
- Title changed from RAILS_GEM_VERSION ignored to Errata Corrige
Of course I meant to say:
"The case of people having the RAILS_GEM_VERSION in the first line is not that common I guess: thanks a lot for spending time on this dusty corner :-)"
-
Jan De Poorter
- Title changed from Errata Corrige to RAILS_GEM_VERSION ignored
Don't change the ticket name ;-)
-
Michael Koziarski
It should be possible to change that regular expression to avoid this problem entirely. Care to take a crack at it?
-
Jan De Poorter
It's already fixed in 2-0-stable: http://github.com/rails/rails/tr...
-
Jan De Poorter
Ok, after looking into this a bit more, 2-0-stable and 2.0.2 already fixed this bug.
All you have to do is update your config file so it respects your RAILS_GEM_VERSION and then run rake rails:update. This will update your boot.rb file to the 2.0.2 one, which is the good one.
-
Michael Koziarski
- State changed from new to duplicate
Resolving as a duplicate because it's been fixed already.
-
Aditya Sanghi
Automatic cleanup of spam.
-
Ryan Bigg
Automatic cleanup of spam.
-
Jeff Kreeftmeijer
Automatic cleanup of spam.