ruby-changes:9771
From: nobu <ko1@a...>
Date: Sun, 4 Jan 2009 17:07:41 +0900 (JST)
Subject: [ruby-changes:9771] Ruby:r21312 (trunk): * lib/rubygems.rb (Gem.set_home, Gem.set_paths): should not create
nobu 2009-01-04 17:07:22 +0900 (Sun, 04 Jan 2009) New Revision: 21312 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21312 Log: * lib/rubygems.rb (Gem.set_home, Gem.set_paths): should not create directories stealthily. [ruby-core:20990] * lib/rubygems.rb (Gem.find_home): expand_path deals with platform dependent envirionments. * lib/rdoc/ri/paths.rb (RDoc::HOMEDIR): ditto. * instruby.rb (gem): creates gem directories at installation. Modified files: trunk/ChangeLog trunk/instruby.rb trunk/lib/rdoc/ri/paths.rb trunk/lib/rubygems.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 21311) +++ ChangeLog (revision 21312) @@ -1,3 +1,15 @@ +Sun Jan 4 17:07:45 2009 Nobuyoshi Nakada <nobu@r...> + + * lib/rubygems.rb (Gem.set_home, Gem.set_paths): should not create + directories stealthily. [ruby-core:20990] + + * lib/rubygems.rb (Gem.find_home): expand_path deals with platform + dependent envirionments. + + * lib/rdoc/ri/paths.rb (RDoc::HOMEDIR): ditto. + + * instruby.rb (gem): creates gem directories at installation. + Sun Jan 4 15:41:37 2009 Nobuyoshi Nakada <nobu@r...> * encoding.c (rb_filesystem_encoding, rb_locale_charmap): uses Index: lib/rubygems.rb =================================================================== --- lib/rubygems.rb (revision 21311) +++ lib/rubygems.rb (revision 21312) @@ -373,23 +373,13 @@ # least on Win32). def self.find_home - ['HOME', 'USERPROFILE'].each do |homekey| - return ENV[homekey] if ENV[homekey] + File.expand_path("~") + rescue + if File::ALT_SEPARATOR then + "C:/" + else + "/" end - - if ENV['HOMEDRIVE'] && ENV['HOMEPATH'] then - return "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}" - end - - begin - File.expand_path("~") - rescue - if File::ALT_SEPARATOR then - "C:/" - else - "/" - end - end end private_class_method :find_home @@ -691,7 +681,6 @@ def self.set_home(home) home = home.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR @gem_home = home - ensure_gem_subdirectories(@gem_home) end private_class_method :set_home @@ -716,16 +705,6 @@ end @gem_path.uniq! - @gem_path.each do |path| - if 0 == File.expand_path(path).index(Gem.user_home) - next unless File.directory? Gem.user_home - unless win_platform? then - # only create by matching user - next if Etc.getpwuid.uid != File::Stat.new(Gem.user_home).uid - end - end - ensure_gem_subdirectories path - end end private_class_method :set_paths Index: lib/rdoc/ri/paths.rb =================================================================== --- lib/rdoc/ri/paths.rb (revision 21311) +++ lib/rdoc/ri/paths.rb (revision 21312) @@ -31,14 +31,8 @@ base = File.join(RbConfig::CONFIG['datadir'], "ri", VERSION) SYSDIR = File.join(base, "system") SITEDIR = File.join(base, "site") - homedir = ENV['HOME'] || ENV['USERPROFILE'] || ENV['HOMEPATH'] + HOMEDIR = (File.expand_path("~/.rdoc") rescue nil) - if homedir then - HOMEDIR = File.join(homedir, ".rdoc") - else - HOMEDIR = nil - end - begin require 'rubygems' unless defined?(Gem) and defined?(Gem::Enable) and Gem::Enable Index: instruby.rb =================================================================== --- instruby.rb (revision 21311) +++ instruby.rb (revision 21312) @@ -409,6 +409,13 @@ end end +install?(:local, :comm, :gem) do + puts "creating default gem directories" + + gpath = Gem.default_dir + makedirs Gem::DIRECTORIES.collect {|dir| File.join(gpath, dir)} +end + $install << :local << :ext if $install.empty? $install.each do |inst| if !(procs = $install_procs[inst]) || procs.empty? -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/