This project is archived and is in readonly mode.

#2861 ✓hold
CS Merritt (csmosx)

TemplateRunner adds gems to environment file in reverse of written order

Reported by CS Merritt (csmosx) | June 30th, 2009 @ 09:52 PM | in 2.x

Each successive gem command in an app template places the corresponding config.gem line above the previous one.

This makes the environment file's config.gem lines the reverse order of the app templates gem commands, potentially causing requirement failures.

Example app template gem commands:

gem 'authlogic'
gem 'authlogic-oid', :lib => "authlogic_openid"
gem 'somegem'

Creates these environment.rb lines:

config.gem 'somegem'
config.gem 'authlogic-oid', :lib => 'authlogic_openid'
config.gem 'authlogic'

Running the rake gems task then would abort at that authlogic-oid line with:

rake aborted!
undefined method add_acts_as_authentic_module' for ActiveRecord::Base:Class</code>
</pre>


I can't think of an easy fix other than some sort of counter to keep track of how many lines have been added after the sentinel.
For now I'll just have to construct my templates in reverse order as needed.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages