Skip to content

Commit

Permalink
Updated remote fetcher to use Gem.user_dir
Browse files Browse the repository at this point in the history
git-svn-id: http://rubygems.rubyforge.org/svn/trunk@1838 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information
technomancy committed Jul 2, 2008
1 parent 947f070 commit b730cdf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/rubygems/commands/help_command.rb
Expand Up @@ -20,9 +20,9 @@ class Gem::Commands::HelpCommand < Gem::Command
gem install --remote rake --test --rdoc --ri gem install --remote rake --test --rdoc --ri
* Install 'rake', but only version 0.3.1, even if dependencies * Install 'rake', but only version 0.3.1, even if dependencies
are not met, and into a specific directory: are not met, and into a user-specific directory:
gem install rake --version 0.3.1 --force --install-dir $HOME/.gems gem install rake --version 0.3.1 --force --user-install
* List local gems whose name begins with 'D': * List local gems whose name begins with 'D':
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/remote_fetcher.rb
Expand Up @@ -78,7 +78,7 @@ def download(spec, source_uri, install_dir = Gem.dir)
if File.writable?(install_dir) if File.writable?(install_dir)
cache_dir = File.join install_dir, 'cache' cache_dir = File.join install_dir, 'cache'
else else
cache_dir = File.join(ENV['HOME'], '.gem', 'cache') cache_dir = File.join(Gem.user_dir, 'cache')
end end


gem_file_name = "#{spec.full_name}.gem" gem_file_name = "#{spec.full_name}.gem"
Expand Down
5 changes: 3 additions & 2 deletions test/test_gem_remote_fetcher.rb
Expand Up @@ -275,8 +275,9 @@ def test_download_read_only


fetcher = util_fuck_with_fetcher File.read(@a1_gem) fetcher = util_fuck_with_fetcher File.read(@a1_gem)
fetcher.download(@a1, 'http://gems.example.com') fetcher.download(@a1, 'http://gems.example.com')
assert File.exist?(File.join(@userhome, '.gem', assert File.exist?(File.join(@userhome, '.gem', Gem.ruby_engine,
'cache', "#{@a1.full_name}.gem")) Gem::ConfigMap[:ruby_version], 'cache',
"#{@a1.full_name}.gem"))
ensure ensure
File.chmod 0755, File.join(@gemhome) File.chmod 0755, File.join(@gemhome)
File.chmod 0755, File.join(@gemhome, 'cache') File.chmod 0755, File.join(@gemhome, 'cache')
Expand Down

0 comments on commit b730cdf

Please sign in to comment.