This project is archived and is in readonly mode.
app_generator should disallow or fix invalid application name
Reported by Trevor Turk | December 9th, 2009 @ 10:06 PM
After following these instructions to generate a Rails 3 application:
http://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html
...I noticed a problem with the AppGenerator. I'm having trouble getting my Rails 3 tests to run, so apologies for not being able to provide a patch or failing test case.
If you run "rails test-project" from the Rails 3 pre gem you'll see that the application name ends up being invalid. This is immediately apparent if you look in config.ru, but the name is used elsewhere as well.
I see that app_generator.rb is calling classify on line 185. I'm taking a wild guess that this may be the area of concern...?
'test-project'.classify => "Test-project"
Perhaps an error could be raised if an invalid application name was provided, or the name could be converted in a more robust way. I'm sure there's a better way to accomplish the latter, but one possible solution might be something like:
'test-project'.gsub(/[^[:alpha:]]/, '_').classify => "TestProject"
...or even...
'test....project'.gsub(/[^[:alpha:]]/, '_').squeeze('_').classify
I think this warrants more discussion, but I wanted to kick things off at least.
Thanks!
Comments and changes to this ticket
-
Trevor Turk December 9th, 2009 @ 10:11 PM
- Title changed from app_generator should disallow or fix invalid app_const to app_generator should disallow or fix invalid application name
-
José Valim January 3rd, 2010 @ 12:30 AM
- Assigned user set to José Valim
-
Repository January 3rd, 2010 @ 04:17 PM
(from [e88ea3255ff90baa28d30908e1fcb5fa7f7133a8]) Assert for valid application names. [#3556 status:resolved] http://github.com/rails/rails/commit/e88ea3255ff90baa28d30908e1fcb5...
-
José Valim January 3rd, 2010 @ 04:18 PM
- State changed from new to resolved
Thanks Trevor, fixed!
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>
People watching this ticket
Referenced by
- 3556 app_generator should disallow or fix invalid application name (from [e88ea3255ff90baa28d30908e1fcb5fa7f7133a8]) Assert ...