rubygems-update 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- data/ChangeLog +20 -0
- data/Rakefile +4 -3
- data/lib/rubygems/command_manager.rb +1 -0
- data/lib/rubygems/commands/sources_command.rb +26 -5
- data/lib/rubygems/rubygems_version.rb +1 -1
- data/lib/rubygems/source_index.rb +4 -0
- data/lib/rubygems/source_info_cache.rb +31 -10
- data/lib/rubygems/source_info_cache_entry.rb +6 -0
- data/pkgs/sources/sources-0.0.1.gem +0 -0
- data/test/data/a-0.0.1.gem +0 -0
- data/test/data/a-0.0.2.gem +0 -0
- data/test/data/b-0.0.2.gem +0 -0
- data/test/data/c-1.2.gem +0 -0
- data/test/data/gemhome/cache/a-0.0.1.gem +0 -0
- data/test/data/gemhome/cache/a-0.0.2.gem +0 -0
- data/test/data/gemhome/cache/b-0.0.2.gem +0 -0
- data/test/data/gemhome/cache/c-1.2.gem +0 -0
- data/test/data/gemhome/gems/a-0.0.1/lib/code.rb +1 -0
- data/test/data/gemhome/gems/a-0.0.2/lib/code.rb +1 -0
- data/test/data/gemhome/gems/b-0.0.2/lib/code.rb +1 -0
- data/test/data/gemhome/gems/c-1.2/lib/code.rb +1 -0
- data/test/data/gemhome/specifications/a-0.0.1.gemspec +8 -0
- data/test/data/gemhome/specifications/a-0.0.2.gemspec +8 -0
- data/test/data/gemhome/specifications/b-0.0.2.gemspec +8 -0
- data/test/data/gemhome/specifications/c-1.2.gemspec +8 -0
- data/test/data/one/one-0.0.1.gem +0 -0
- data/test/test_gem_source_info_cache.rb +40 -0
- metadata +34 -3
data/ChangeLog
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
2007-05-23 Jim Weirich <jim@weirichhouse.org>
|
2
|
+
|
3
|
+
* lib/rubygems/commands/sources_command.rb
|
4
|
+
(Gem::Commands::SourcesCommand::initialize): Added a --clear-all
|
5
|
+
option to the sources subcommand. Clear-all will remove the cache
|
6
|
+
files.
|
7
|
+
|
8
|
+
* lib/rubygems/source_info_cache.rb (Gem): Moved system_cache_file
|
9
|
+
and user_cache_file to class methods so that we can get the file
|
10
|
+
names without creating a SourceInfoCache instance.
|
11
|
+
|
12
|
+
2007-05-23 Eric Hodel <drbrain@segment7.net>
|
13
|
+
|
14
|
+
* lib/rubygems/source_info_cache.rb: Teach SIC to repair itself
|
15
|
+
when it encounters a bad cache file.
|
16
|
+
|
17
|
+
2007-05-14 Chad Fowler <chad@chadfowler.com>
|
18
|
+
* lib/rubygems/command_manager.rb: Re-added registration for
|
19
|
+
gem cleanup command which I accidentally removed during refactoring.
|
20
|
+
|
1
21
|
2007-05-10 Jim Weirich <jim@weirichhouse.org>
|
2
22
|
|
3
23
|
* lib/rubygems/remote_installer.rb: Uncommented the require
|
data/Rakefile
CHANGED
@@ -182,10 +182,11 @@ task :tag => [:prerelease] do
|
|
182
182
|
reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}"
|
183
183
|
reltag = "REL_#{ENV['REUSE'].gsub(/\./, '_')}" if ENV['REUSE']
|
184
184
|
announce "Tagging SVN with [#{reltag}]"
|
185
|
+
software_dir = File.basename(Dir.pwd)
|
185
186
|
if ENV['RELTEST']
|
186
|
-
announce "Release Task Testing, skipping SVN tagging"
|
187
|
+
announce "Release Task Testing, skipping SVN tagging (in dir #{software_dir})"
|
187
188
|
else
|
188
|
-
sh %{
|
189
|
+
sh %{svn copy svn+ssh://rubyforge.org/var/svn/rubygems/trunk svn+ssh://rubyforge.org/var/svn/rubygems/tags/#{reltag}}
|
189
190
|
end
|
190
191
|
end
|
191
192
|
|
@@ -203,7 +204,7 @@ if HAVE_RCOV
|
|
203
204
|
t.libs << "test"
|
204
205
|
t.rcov_opts = ['-xRakefile', '-xrakefile', '-xpublish.rf', '--text-report']
|
205
206
|
t.test_files = FileList[
|
206
|
-
'test/test*.rb'
|
207
|
+
'test/{functional,test}*.rb'
|
207
208
|
]
|
208
209
|
t.verbose = true
|
209
210
|
end
|
@@ -17,6 +17,10 @@ module Gem
|
|
17
17
|
add_option '-r', '--remove SOURCE_URI', 'Remove source' do |value, options|
|
18
18
|
options[:remove] = value
|
19
19
|
end
|
20
|
+
|
21
|
+
add_option '-c', '--clear-all', 'Remove all sources' do |value, options|
|
22
|
+
options[:clear_all] = value
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
def defaults_str
|
@@ -24,6 +28,13 @@ module Gem
|
|
24
28
|
end
|
25
29
|
|
26
30
|
def execute
|
31
|
+
options[:list] = ! (options[:add] || options[:remove] || options[:clear_all])
|
32
|
+
|
33
|
+
if options[:clear_all] then
|
34
|
+
remove_cache_file("user", Gem::SourceInfoCache.user_cache_file)
|
35
|
+
remove_cache_file("system", Gem::SourceInfoCache.system_cache_file)
|
36
|
+
end
|
37
|
+
|
27
38
|
if options[:add] then
|
28
39
|
source_uri = options[:add]
|
29
40
|
|
@@ -56,7 +67,7 @@ module Gem
|
|
56
67
|
end
|
57
68
|
end
|
58
69
|
|
59
|
-
if options[:list]
|
70
|
+
if options[:list] then
|
60
71
|
say "*** CURRENT SOURCES ***"
|
61
72
|
say
|
62
73
|
|
@@ -66,8 +77,18 @@ module Gem
|
|
66
77
|
end
|
67
78
|
end
|
68
79
|
|
69
|
-
|
80
|
+
def remove_cache_file(desc, fn)
|
81
|
+
FileUtils.rm_rf fn rescue nil
|
82
|
+
if ! File.exist?(fn)
|
83
|
+
say "*** Removed #{desc} source cache ***"
|
84
|
+
elsif ! File.writable?(fn)
|
85
|
+
say "*** Unable to remove #{desc} source cache (write protected) ***"
|
86
|
+
else
|
87
|
+
say "*** Unable to remove #{desc} source cache ***"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
private :remove_cache_file
|
70
91
|
|
71
|
-
|
72
|
-
end
|
73
|
-
end
|
92
|
+
end # class SourcesCommand
|
93
|
+
end # module Commands
|
94
|
+
end # module Gem
|
@@ -32,6 +32,8 @@ class Gem::SourceInfoCache
|
|
32
32
|
include Gem::UserInteraction
|
33
33
|
|
34
34
|
@cache = nil
|
35
|
+
@system_cache_file = nil
|
36
|
+
@user_cache_file = nil
|
35
37
|
|
36
38
|
def self.cache
|
37
39
|
return @cache if @cache
|
@@ -53,9 +55,6 @@ class Gem::SourceInfoCache
|
|
53
55
|
@cache_data = nil
|
54
56
|
@cache_file = nil
|
55
57
|
@dirty = false
|
56
|
-
|
57
|
-
@system_cache_file = nil
|
58
|
-
@user_cache_file = nil
|
59
58
|
end
|
60
59
|
|
61
60
|
# The most recent cache data.
|
@@ -65,10 +64,22 @@ class Gem::SourceInfoCache
|
|
65
64
|
cache_file # HACK writable check
|
66
65
|
# Marshal loads 30-40% faster from a String, and 2MB on 20061116 is small
|
67
66
|
begin
|
68
|
-
data = File.open cache_file, 'rb' do |fp|
|
69
|
-
|
67
|
+
data = File.open cache_file, 'rb' do |fp| fp.read end
|
68
|
+
@cache_data = Marshal.load data
|
69
|
+
@cache_data.each do |url, sice|
|
70
|
+
next unless Hash === sice
|
71
|
+
@dirty = true
|
72
|
+
if sice.key? 'cache' and sice.key? 'size' and
|
73
|
+
Gem::SourceIndex === sice['cache'] and Numeric === sice['size'] then
|
74
|
+
new_sice = Gem::SourceInfoCacheEntry.new sice['cache'], sice['size']
|
75
|
+
@cache_data[url] = new_sice
|
76
|
+
else # irreperable, force refetch.
|
77
|
+
sice = Gem::SourceInfoCacheEntry.new Gem::SourceIndex.new, 0
|
78
|
+
sice.refresh url # HACK may be unnecessary, see ::cache and #refresh
|
79
|
+
@cache_data[url] = sice
|
80
|
+
end
|
70
81
|
end
|
71
|
-
@cache_data
|
82
|
+
@cache_data
|
72
83
|
rescue
|
73
84
|
{}
|
74
85
|
end
|
@@ -110,18 +121,28 @@ class Gem::SourceInfoCache
|
|
110
121
|
end.flatten
|
111
122
|
end
|
112
123
|
|
124
|
+
# Mark the cache as updated (i.e. dirty).
|
125
|
+
def update
|
126
|
+
@dirty = true
|
127
|
+
end
|
128
|
+
|
113
129
|
# The name of the system cache file.
|
114
130
|
def system_cache_file
|
115
|
-
|
131
|
+
self.class.system_cache_file
|
116
132
|
end
|
117
133
|
|
118
|
-
#
|
119
|
-
def
|
120
|
-
@
|
134
|
+
# The name of the system cache file. (class method)
|
135
|
+
def self.system_cache_file
|
136
|
+
@system_cache_file ||= File.join(Gem.dir, "source_cache")
|
121
137
|
end
|
122
138
|
|
123
139
|
# The name of the user cache file.
|
124
140
|
def user_cache_file
|
141
|
+
self.class.user_cache_file
|
142
|
+
end
|
143
|
+
|
144
|
+
# The name of the user cache file. (class method)
|
145
|
+
def self.user_cache_file
|
125
146
|
@user_cache_file ||=
|
126
147
|
ENV['GEMCACHE'] || File.join(Gem.user_home, ".gem", "source_cache")
|
127
148
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/data/c-1.2.gem
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
CODE = 1
|
@@ -0,0 +1 @@
|
|
1
|
+
CODE = 1
|
@@ -0,0 +1 @@
|
|
1
|
+
CODE = 1
|
@@ -0,0 +1 @@
|
|
1
|
+
CODE = 1
|
Binary file
|
@@ -76,6 +76,25 @@ class TestGemSourceInfoCache < RubyGemTestCase
|
|
76
76
|
assert_equal true, @sic.dirty, 'still dirty'
|
77
77
|
end
|
78
78
|
|
79
|
+
def test_cache_data_irreparable
|
80
|
+
@fetcher.data['http://gems.example.com/yaml'] = @source_index.to_yaml
|
81
|
+
|
82
|
+
data = { 'http://gems.example.com' => { 'totally' => 'borked' } }
|
83
|
+
|
84
|
+
[@sic.system_cache_file, @sic.user_cache_file].each do |fn|
|
85
|
+
FileUtils.mkdir_p File.dirname(fn)
|
86
|
+
open(fn, "wb") { |f| f.write Marshal.dump(data) }
|
87
|
+
end
|
88
|
+
|
89
|
+
@sic.instance_eval { @cache_data = nil }
|
90
|
+
|
91
|
+
fetched = use_ui MockGemUi.new do @sic.cache_data end
|
92
|
+
|
93
|
+
fetched_si = fetched['http://gems.example.com'].source_index
|
94
|
+
|
95
|
+
assert_equal @source_index.index_signature, fetched_si.index_signature
|
96
|
+
end
|
97
|
+
|
79
98
|
def test_cache_data_none_readable
|
80
99
|
FileUtils.chmod 0222, @sic.system_cache_file
|
81
100
|
FileUtils.chmod 0222, @sic.user_cache_file
|
@@ -94,6 +113,27 @@ class TestGemSourceInfoCache < RubyGemTestCase
|
|
94
113
|
assert_equal 'unable to locate a writable cache file', e.message
|
95
114
|
end
|
96
115
|
|
116
|
+
def test_cache_data_repair
|
117
|
+
data = {
|
118
|
+
'http://www.example.com' => {
|
119
|
+
'cache' => Gem::SourceIndex.new,
|
120
|
+
'size' => 0,
|
121
|
+
}
|
122
|
+
}
|
123
|
+
[@sic.system_cache_file, @sic.user_cache_file].each do |fn|
|
124
|
+
FileUtils.mkdir_p File.dirname(fn)
|
125
|
+
open(fn, "wb") { |f| f.write Marshal.dump(data) }
|
126
|
+
end
|
127
|
+
|
128
|
+
@sic.instance_eval { @cache_data = nil }
|
129
|
+
|
130
|
+
expected = {
|
131
|
+
'http://www.example.com' =>
|
132
|
+
Gem::SourceInfoCacheEntry.new(Gem::SourceIndex.new, 0)
|
133
|
+
}
|
134
|
+
assert_equal expected, @sic.cache_data
|
135
|
+
end
|
136
|
+
|
97
137
|
def test_cache_data_user_fallback
|
98
138
|
FileUtils.chmod 0444, @sic.system_cache_file
|
99
139
|
assert_equal [['key','usr']], @sic.cache_data.to_a.sort
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: rubygems-update
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.9.
|
7
|
-
date: 2007-05-
|
6
|
+
version: 0.9.4
|
7
|
+
date: 2007-05-23 00:00:00 -04:00
|
8
8
|
summary: RubyGems Update GEM
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- lib/rubygems/digest/sha2.rb
|
130
130
|
- pkgs/sources
|
131
131
|
- pkgs/sources/lib
|
132
|
+
- pkgs/sources/sources-0.0.1.gem
|
132
133
|
- pkgs/sources/sources.gemspec
|
133
134
|
- pkgs/sources/lib/sources.rb
|
134
135
|
- redist/session.gem
|
@@ -189,8 +190,13 @@ files:
|
|
189
190
|
- test/testgem.rc
|
190
191
|
- test/user_capture.rb
|
191
192
|
- test/yaml_data.rb
|
193
|
+
- test/data/a-0.0.1.gem
|
194
|
+
- test/data/a-0.0.2.gem
|
195
|
+
- test/data/b-0.0.2.gem
|
192
196
|
- test/data/broken-1.0.0.gem
|
193
197
|
- test/data/broken_build
|
198
|
+
- test/data/c-1.2.gem
|
199
|
+
- test/data/gemhome
|
194
200
|
- test/data/legacy
|
195
201
|
- test/data/lib
|
196
202
|
- test/data/one
|
@@ -200,10 +206,35 @@ files:
|
|
200
206
|
- test/data/broken_build/ext
|
201
207
|
- test/data/broken_build/ext/extconf.rb
|
202
208
|
- test/data/broken_build/ext/foo.c
|
209
|
+
- test/data/gemhome/cache
|
210
|
+
- test/data/gemhome/doc
|
211
|
+
- test/data/gemhome/gems
|
212
|
+
- test/data/gemhome/specifications
|
213
|
+
- test/data/gemhome/cache/a-0.0.1.gem
|
214
|
+
- test/data/gemhome/cache/a-0.0.2.gem
|
215
|
+
- test/data/gemhome/cache/b-0.0.2.gem
|
216
|
+
- test/data/gemhome/cache/c-1.2.gem
|
217
|
+
- test/data/gemhome/gems/a-0.0.1
|
218
|
+
- test/data/gemhome/gems/a-0.0.2
|
219
|
+
- test/data/gemhome/gems/b-0.0.2
|
220
|
+
- test/data/gemhome/gems/c-1.2
|
221
|
+
- test/data/gemhome/gems/a-0.0.1/lib
|
222
|
+
- test/data/gemhome/gems/a-0.0.1/lib/code.rb
|
223
|
+
- test/data/gemhome/gems/a-0.0.2/lib
|
224
|
+
- test/data/gemhome/gems/a-0.0.2/lib/code.rb
|
225
|
+
- test/data/gemhome/gems/b-0.0.2/lib
|
226
|
+
- test/data/gemhome/gems/b-0.0.2/lib/code.rb
|
227
|
+
- test/data/gemhome/gems/c-1.2/lib
|
228
|
+
- test/data/gemhome/gems/c-1.2/lib/code.rb
|
229
|
+
- test/data/gemhome/specifications/a-0.0.1.gemspec
|
230
|
+
- test/data/gemhome/specifications/a-0.0.2.gemspec
|
231
|
+
- test/data/gemhome/specifications/b-0.0.2.gemspec
|
232
|
+
- test/data/gemhome/specifications/c-1.2.gemspec
|
203
233
|
- test/data/legacy/keyedlist-0.4.0.ruby
|
204
234
|
- test/data/legacy/keyedlist-0.4.0.yaml
|
205
235
|
- test/data/lib/code.rb
|
206
236
|
- test/data/one/lib
|
237
|
+
- test/data/one/one-0.0.1.gem
|
207
238
|
- test/data/one/one.gemspec
|
208
239
|
- test/data/one/one.yaml
|
209
240
|
- test/data/one/README.one
|