Thank you for reading my mail. but I can’t agree server configuration
causes this problem. I explain more details.
First, CGI and Apache/fast-cgi doesn’t set HOME variable if you don’t
set SetENV. So dispatchers in these doesn’t know HOME in most cases.
Webrick or Mongrel users are O.K. because know HOME in most cases. I
agree that this is a server specific and configuration issue. Radiant
doesn’t need to care it.
How does generator_base_extension.rb affect the HOME environment
generator_base_extension.rb gets HOME environment as follows(radiant
0.6.0 / rails 1.2.3):
If ENV[‘HOME’] is nil (this is the case of CGI and Apache/fast-cgi),
it calls File.expand_path ‘~’. But File.expand_path needs to know
HOME, check it by the following commands:
ruby -e ‘File.expand_path “~”’
This is the reason of the error message (but this isn’t the root cause
of the problem, I think). so, if rails dispatchers(CGI,
Apache/fast-cgi) load rails/railties/lib/rails_generator.rb, then
happen the error.
Does the default Rails generator set the HOME environment
variable in environment.rb?
No. Rails generator(like script/generate) doesn’t read
config/environment.rb but config/boot.rb. This problem is about
dispatchers(.fcgi, .cgi, .rb), not generator.
I believe normally rails applications don’t need to set HOME in
environment.rb. I checked Mephisto, Typo and Beast. Such rails
applications don’t need to set HOME in CGI and Apache/fast-cgi because
these dispatchers don’t require rails/railties/lib/rails_generator.rb.
I think rails generators are for spitting out Ruby code. Why do
radiant’s dispatchers need to generate new code? I can’t understand
the advantage and I believe dispatchers don’t need to generate any
If it is right, this is the waste misloading problem of
Radinat::Initializer. Radinat::Initializer.run(:process, &config) in
config/environment.rb loads lib/plugins/extension_patches/init.rb and
I think this is the root cause of the problem. Please try to reproduce
the problem by unsetting HOME and exec the following code:
pp [email protected]
Summary of my opinion:
I agree that ENV[‘HOME’] == nil is server specific(CGI,
Apache/fast-cgi) and hosting configuration issue. So radiant doesn’t
need to care it.
rails/railties/lib/rails_generator.rb need to know HOME.
It is radiant issue that Radiant’s dispatcher loads
rails/railties/lib/rails_generator.rb, and other rails applications’
dispatchers don’t load rails_generator.rb.
I believe dispatchers don’t need to generate any code and must not.
If 4 is true, the cause of this problem is waste loading of
generator_base_extension.rb and rails/railties/lib/rails_generator.rb
for dispatchers. Generators like script/generate need to requires
rails_generator.rb and dispatchers don’t.
For above reasons, I conclude this is a problem of radiant. Is it
right? My arguments is based on the assumption of 4, so I am sorry for
wasting your time if this assumption is wrong. I don’t think of the
advantage that dispatchers act as generator because I am not familiar