Hi John, 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 > variable? generator_base_extension.rb gets HOME environment as follows(radiant 0.6.0 / rails 1.2.3): (lib/plugins/extension_patches/lib/generator_base_extension.rb) require 'rails_generator' (rails/railties/lib/rails_generator.rb) require 'rails_generator/lookup' Rails::Generator::Base.send(:include, Rails::Generator::Lookup) (rails/railties/lib/rails_generator/lookup.rb:51) Rails::Generator::Lookup.included (rails/railties/lib/rails_generator/lookup.rb:98) Rails::Generator::Lookup::ClassMethods.use_component_sources! (rails/railties/lib/rails_generator/lookup.rb:25) Dir.user_home 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: unset HOME 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 code. 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 it requires lib/plugins/extension_patches/lib/generator_base_extension.rb. I think this is the root cause of the problem. Please try to reproduce the problem by unsetting HOME and exec the following code: require "pp" begin require 'config/environment.rb' rescue Exception pp $@ end Summary of my opinion: 1. 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. 2. rails/railties/lib/rails_generator.rb need to know HOME. 3. 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. 4. I believe dispatchers don't need to generate any code and must not. 5. 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 with rails. ---- Keita Yamaguchi _______________________________________________ Radiant mailing list Post: [email protected] Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
