Skip to content

Commit

Permalink
For reals, RubyGems 1.1.0.
Browse files Browse the repository at this point in the history
git-svn-id: http://rubygems.rubyforge.org/svn/tags/REL_1_1_0@1678 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information
drbrain committed Mar 29, 2008
2 parents 5a44794 + a5eb203 commit b1311d1
Show file tree
Hide file tree
Showing 239 changed files with 53 additions and 33,597 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Expand Up @@ -4,6 +4,10 @@
* lib/rubygems.rb: Added Gem.ruby_version, Gem.read_binary,
Gem.binary_mode.
* lib/, test/: Read files in binary mode for windows and ruby 1.9.
* lib/rubygems/commands/update_command.rb: Only update once.
* lib/rubygems/commands/sources_command.rb: Ditto.
* lib/rubygems/source_index.rb: Fix #remove_extra, #find_missing so
legacy platform gems don't get updated repeatedly.
* doc/release_notes/rel_1_1_0.rdoc: RubyGems 1.1.0 release notes.
* lib/rubygems/rubygems_version.rb: 1.1.0.

Expand Down
9 changes: 6 additions & 3 deletions doc/release_notes/rel_1_1_0.rdoc
Expand Up @@ -7,7 +7,10 @@ New features:
* RubyGems now uses persistent connections on index updates. Index updates are
much faster now.
* RubyGems only updates from a latest index by default, cutting candidate gems
for updates to roughly 1/4 (at present).
for updates to roughly 1/4 (at present). Index updates are even faster
still.
* `gem list -r` may only show the latest version of a gem, add --all to see
all gems.
* `gem spec` now extracts specifications from .gem files.
* `gem query --installed` to aid automation of checking for gems.

Expand Down Expand Up @@ -40,8 +43,8 @@ For a full list of changes to RubyGems, see the ChangeLog file.

== How can I get RubyGems?

NOTE: If you have installed RubyGems using a package you may want to install a
new RubyGems through the same packaging system.
NOTE: If you have installed RubyGems using a package system you may want to
install a new RubyGems through the same packaging system.

If you have a recent version of RubyGems (0.8.5 or later), then all
you need to do is:
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/commands/query_command.rb
Expand Up @@ -83,7 +83,7 @@ def execute
say

begin
Gem::SourceInfoCache.cache.refresh options[:all]
Gem::SourceInfoCache.cache options[:all]
rescue Gem::RemoteFetcher::FetchError
# no network
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/commands/sources_command.rb
Expand Up @@ -69,7 +69,7 @@ def execute
end

if options[:update] then
Gem::SourceInfoCache.cache.refresh true
Gem::SourceInfoCache.cache true
Gem::SourceInfoCache.cache.flush

say "source cache successfully updated"
Expand Down
11 changes: 9 additions & 2 deletions lib/rubygems/source_index.rb
Expand Up @@ -430,15 +430,22 @@ def fetch_quick_index(source_uri, all)
# Make a list of full names for all the missing gemspecs.

def find_missing(spec_names)
unless defined? @originals then
@originals = {}
each do |full_name, spec|
@originals[spec.original_name] = spec
end
end

spec_names.find_all { |full_name|
specification(full_name).nil?
@originals[full_name].nil?
}
end

def remove_extra(spec_names)
dictionary = spec_names.inject({}) { |h, k| h[k] = true; h }
each do |name, spec|
remove_spec name unless dictionary.include? name
remove_spec name unless dictionary.include? spec.original_name
end
end

Expand Down
35 changes: 23 additions & 12 deletions lib/rubygems/source_info_cache.rb
Expand Up @@ -31,14 +31,14 @@ class Gem::SourceInfoCache

include Gem::UserInteraction

@cache = nil
@system_cache_file = nil
@user_cache_file = nil
##
# The singleton Gem::SourceInfoCache. If +all+ is true, a full refresh will
# be performed if the singleton instance is being initialized.

def self.cache
def self.cache(all = false)
return @cache if @cache
@cache = new
@cache.refresh false if Gem.configuration.update_sources
@cache.refresh all if Gem.configuration.update_sources
@cache
end

Expand All @@ -62,6 +62,15 @@ def self.latest_user_cache_file
"latest_#{File.basename user_cache_file}"
end

##
# Reset all singletons, discarding any changes.

def self.reset
@cache = nil
@system_cache_file = nil
@user_cache_file = nil
end

##
# Search all source indexes. See Gem::SourceInfoCache#search.

Expand Down Expand Up @@ -122,13 +131,6 @@ def cache_file
try_file(user_cache_file) or
raise "unable to locate a writable cache file")
end

##
# Force cache file to be reset, useful for integration testing of rubygems

def reset_cache_file
@cache_file = nil
end

##
# Write the cache to a local file (if it is dirty).
Expand Down Expand Up @@ -245,6 +247,13 @@ def reset_cache_data
@cache_data = nil
end

##
# Force cache file to be reset, useful for integration testing of rubygems

def reset_cache_file
@cache_file = nil
end

##
# Searches all source indexes. See Gem::SourceIndex#search for details on
# +pattern+ and +platform_only+. If +all+ is set to true, the full index
Expand Down Expand Up @@ -350,5 +359,7 @@ def write_cache
end
end

reset

end

3 changes: 3 additions & 0 deletions test/test_gem_commands_query_command.rb
Expand Up @@ -26,6 +26,7 @@ def test_execute
cache.update
cache.write_cache
cache.reset_cache_data
Gem::SourceInfoCache.reset

a2_name = @a2.full_name
@fetcher.data["#{@gem_repo}/quick/latest_index.rz"] = util_zip a2_name
Expand All @@ -44,6 +45,7 @@ def test_execute
*** REMOTE GEMS ***
a (2)
pl (1)
EOF

assert_equal expected, @ui.output
Expand All @@ -55,6 +57,7 @@ def test_execute_all
cache.update
cache.write_cache
cache.reset_cache_data
Gem::SourceInfoCache.reset

a1_name = @a1.full_name
a2_name = @a2.full_name
Expand Down
2 changes: 2 additions & 0 deletions test/test_gem_commands_sources_command.rb
Expand Up @@ -181,6 +181,8 @@ def test_execute_update
@cmd.handle_options %w[--update]

util_setup_source_info_cache
Gem::SourceInfoCache.reset

util_setup_fake_fetcher
si = Gem::SourceIndex.new
si.add_spec @a1
Expand Down
6 changes: 4 additions & 2 deletions test/test_gem_source_index.rb
Expand Up @@ -398,10 +398,12 @@ def test_outdated
def test_remove_extra
@source_index.add_spec @a1
@source_index.add_spec @a2
@source_index.add_spec @pl1

@source_index.remove_extra [@a1.full_name]
@source_index.remove_extra [@a1.full_name, @pl1.full_name]

assert_equal [@a1.full_name], @source_index.gems.map { |n,s| n }
assert_equal [@a1.full_name],
@source_index.gems.map { |n,s| n }.sort
end

def test_remove_extra_no_changes
Expand Down
18 changes: 0 additions & 18 deletions trunk/.autotest

This file was deleted.

4 changes: 0 additions & 4 deletions trunk/.document

This file was deleted.

0 comments on commit b1311d1

Please sign in to comment.