stickler 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CONTRIBUTING.md +5 -4
- data/HISTORY.md +16 -9
- data/LICENSE +1 -1
- data/Manifest.txt +34 -20
- data/README.md +128 -0
- data/Rakefile +10 -9
- data/bin/stickler +9 -6
- data/bin/stickler-passenger-config +8 -8
- data/bin/stickler-server +12 -12
- data/examples/as_middleware.ru +14 -0
- data/examples/auth_repo.ru +1 -1
- data/examples/gemcutter_repo.ru +1 -1
- data/examples/local_repo.ru +1 -1
- data/lib/stickler.rb +3 -1
- data/lib/stickler/client.rb +2 -1
- data/lib/stickler/client/delete.rb +1 -1
- data/lib/stickler/client/latest-version.rb +40 -0
- data/lib/stickler/client/mirror.rb +47 -15
- data/lib/stickler/client/push.rb +1 -1
- data/lib/stickler/client/unyank.rb +1 -1
- data/lib/stickler/client/yank.rb +1 -1
- data/lib/stickler/gem_container.rb +40 -0
- data/lib/stickler/gemfile_lock_parser.rb +47 -0
- data/lib/stickler/middleware.rb +1 -0
- data/lib/stickler/middleware/server.rb +37 -0
- data/lib/stickler/repository/api.rb +16 -0
- data/lib/stickler/repository/index.rb +0 -3
- data/lib/stickler/repository/local.rb +6 -8
- data/lib/stickler/repository/remote.rb +29 -7
- data/lib/stickler/server.rb +2 -6
- data/man/stickler-passenger-config.1 +2 -22
- data/man/stickler-server.1 +9 -99
- data/man/stickler.1 +15 -173
- data/man/stickler.1.ronn +6 -0
- data/tasks/default.rake +16 -18
- data/tasks/man.rake +7 -0
- data/tasks/this.rb +5 -5
- data/test/data/Gemfile.lock.example +56 -0
- data/{spec → test}/data/gemcutter/gems/foo-1.0.0.gem +0 -0
- data/{spec → test}/data/gems/bar-1.0.0.gem +0 -0
- data/{spec → test}/data/gems/baz-3.1.4-java.gem +0 -0
- data/{spec → test}/data/gems/baz-3.1.4.gem +0 -0
- data/{spec → test}/data/gems/foo-1.0.0.gem +0 -0
- data/{spec → test}/data/gems/foo-2.0.0a.gem +0 -0
- data/test/data/specifications/bar-1.0.0.gemspec +31 -0
- data/test/data/specifications/baz-3.1.4-java.gemspec +32 -0
- data/test/data/specifications/baz-3.1.4.gemspec +31 -0
- data/test/data/specifications/foo-1.0.0.gemspec +31 -0
- data/test/data/specifications/foo-2.0.0a.gemspec +32 -0
- data/test/index_test_helpers.rb +75 -0
- data/test/middleware/test_local.rb +75 -0
- data/test/middleware/test_not_found.rb +26 -0
- data/test/repository/test_api.rb +49 -0
- data/test/repository/test_api_behavior.rb +208 -0
- data/test/repository/test_index.rb +48 -0
- data/test/repository/test_local.rb +59 -0
- data/test/repository/test_null.rb +15 -0
- data/test/repository/test_remote.rb +26 -0
- data/test/repository/test_remote_authenticated.rb +39 -0
- data/test/stickler_test_server.rb +35 -0
- data/test/test_gemfile_lock_parser.rb +28 -0
- data/test/test_paths.rb +22 -0
- data/test/test_spec_lite.rb +90 -0
- data/test/test_stickler.rb +49 -0
- metadata +58 -85
- data/README.rdoc +0 -156
- data/spec/index_spec_helpers.rb +0 -73
- data/spec/middleware/local_spec.rb +0 -72
- data/spec/middleware/not_found_spec.rb +0 -25
- data/spec/paths_spec.rb +0 -11
- data/spec/repository/api_behavior.rb +0 -192
- data/spec/repository/api_spec.rb +0 -37
- data/spec/repository/index_spec.rb +0 -46
- data/spec/repository/local_spec.rb +0 -49
- data/spec/repository/null_spec.rb +0 -14
- data/spec/repository/remote_spec.rb +0 -86
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -24
- data/spec/spec_lite_spec.rb +0 -96
data/man/stickler.1.ronn
CHANGED
@@ -45,6 +45,12 @@ COMMANDS
|
|
45
45
|
Put a gem that was _yanked_ back into the gemserver index. This reverses a
|
46
46
|
`yank`.
|
47
47
|
|
48
|
+
*latest-version*:
|
49
|
+
Prints the latest version of a gem
|
50
|
+
|
51
|
+
*delete*:
|
52
|
+
Completely remove a gem from the gem server's index.
|
53
|
+
|
48
54
|
OPTIONS
|
49
55
|
-------
|
50
56
|
These are the options for all commands. Not all options apply to all commands.
|
data/tasks/default.rake
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# vim: syntax=ruby
|
2
2
|
require 'rake/clean'
|
3
|
+
require 'digest'
|
3
4
|
#------------------------------------------------------------------------------
|
4
5
|
# If you want to Develop on this project just run 'rake develop' and you'll
|
5
6
|
# have all you need to get going. If you want to use bundler for development,
|
@@ -30,7 +31,7 @@ namespace :develop do
|
|
30
31
|
# Create a Gemfile that just references the gemspec
|
31
32
|
file 'Gemfile' => :gemspec do
|
32
33
|
File.open( "Gemfile", "w+" ) do |f|
|
33
|
-
f.puts 'source
|
34
|
+
f.puts 'source "https://rubygems.org/"'
|
34
35
|
f.puts 'gemspec'
|
35
36
|
end
|
36
37
|
end
|
@@ -50,14 +51,16 @@ task :develop => "develop:default"
|
|
50
51
|
# Minitest - standard TestTask
|
51
52
|
#------------------------------------------------------------------------------
|
52
53
|
begin
|
53
|
-
require '
|
54
|
-
|
55
|
-
t.ruby_opts = %w[ -w ]
|
56
|
-
t.
|
54
|
+
require 'rake/testtask'
|
55
|
+
Rake::TestTask.new( :test ) do |t|
|
56
|
+
t.ruby_opts = %w[ -w -rubygems ]
|
57
|
+
t.libs = %w[ lib spec test ]
|
58
|
+
t.pattern = "{test,spec}/**/{test_*,*_spec}.rb"
|
57
59
|
end
|
58
|
-
|
60
|
+
|
59
61
|
task :test_requirements
|
60
62
|
task :test => :test_requirements
|
63
|
+
task :default => :test
|
61
64
|
rescue LoadError
|
62
65
|
This.task_warning( 'test' )
|
63
66
|
end
|
@@ -72,11 +75,12 @@ begin
|
|
72
75
|
RDoc::Task.new do |t|
|
73
76
|
t.markup = 'tomdoc'
|
74
77
|
t.rdoc_dir = 'doc'
|
75
|
-
t.main = 'README.
|
78
|
+
t.main = 'README.md'
|
76
79
|
t.title = "#{This.name} #{This.version}"
|
77
|
-
t.rdoc_files.include( '*.rdoc', '
|
80
|
+
t.rdoc_files.include( FileList['*.{rdoc,md,txt}'], FileList['ext/**/*.c'],
|
81
|
+
FileList['lib/**/*.rb'] )
|
78
82
|
end
|
79
|
-
rescue LoadError
|
83
|
+
rescue StandardError, LoadError
|
80
84
|
This.task_warning( 'rdoc' )
|
81
85
|
end
|
82
86
|
|
@@ -226,21 +230,15 @@ end
|
|
226
230
|
# the gemspec is also a dev artifact and should not be kept around.
|
227
231
|
CLOBBER << This.gemspec_file.to_s
|
228
232
|
|
233
|
+
# .rbc files from ruby 2.0
|
234
|
+
CLOBBER << FileList["**/*.rbc"]
|
235
|
+
|
229
236
|
# The standard gem packaging task, everyone has it.
|
230
237
|
require 'rubygems/package_task'
|
231
238
|
Gem::PackageTask.new( This.platform_gemspec ) do
|
232
239
|
# nothing
|
233
240
|
end
|
234
241
|
|
235
|
-
|
236
|
-
#------------------------------------------------------------------------------
|
237
|
-
# man pages
|
238
|
-
#------------------------------------------------------------------------------
|
239
|
-
desc "Create the man pages"
|
240
|
-
task :man do
|
241
|
-
sh "ronn --roff #{FileList["man/*.ronn"]}"
|
242
|
-
end
|
243
|
-
|
244
242
|
#------------------------------------------------------------------------------
|
245
243
|
# Release - the steps we go through to do a final release, this is pulled from
|
246
244
|
# a compbination of mojombo's rakegem, hoe and hoe-git
|
data/tasks/man.rake
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#------------------------------------------------------------------------------
|
2
|
+
# man pages
|
3
|
+
#------------------------------------------------------------------------------
|
4
|
+
desc "Create the man pages"
|
5
|
+
task :man do
|
6
|
+
sh "ronn --roff #{FileList["man/*.ronn"]}"
|
7
|
+
end
|
data/tasks/this.rb
CHANGED
@@ -25,7 +25,7 @@ class ThisProject
|
|
25
25
|
#
|
26
26
|
# Yields self
|
27
27
|
def initialize(&block)
|
28
|
-
@exclude_from_manifest = %r/\.(git|DS_Store)|^(doc|coverage|pkg|tmp
|
28
|
+
@exclude_from_manifest = %r/\.(git|DS_Store)|^(doc|coverage|pkg|tmp|Gemfile(\.lock)?)|^[^\/]+\.gemspec|\.(swp|jar|bundle|so|rvmrc)$|~$/
|
29
29
|
@gemspecs = Hash.new
|
30
30
|
yield self if block_given?
|
31
31
|
end
|
@@ -54,7 +54,7 @@ class ThisProject
|
|
54
54
|
#
|
55
55
|
# Retuns the text of the section as an array of paragrphs.
|
56
56
|
def section_of( file, section_name )
|
57
|
-
re =
|
57
|
+
re = /^[=#]+ (.*)$/
|
58
58
|
sectional = project_path( file )
|
59
59
|
parts = sectional.read.split( re )[1..-1]
|
60
60
|
parts.map! { |p| p.strip }
|
@@ -137,8 +137,8 @@ class ThisProject
|
|
137
137
|
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
138
138
|
spec.test_files = spec.files.grep(/^spec/)
|
139
139
|
|
140
|
-
spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc)$/)
|
141
|
-
spec.rdoc_options = [ "--main" , 'README.
|
140
|
+
spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc|md)$/)
|
141
|
+
spec.rdoc_options = [ "--main" , 'README.md',
|
142
142
|
"--markup", "tomdoc" ]
|
143
143
|
end
|
144
144
|
end
|
@@ -187,7 +187,7 @@ class ThisProject
|
|
187
187
|
|
188
188
|
# Internal: Return the DESCRIPTION section of the README.rdoc file
|
189
189
|
def description_section
|
190
|
-
section_of( 'README.
|
190
|
+
section_of( 'README.md', 'DESCRIPTION')
|
191
191
|
end
|
192
192
|
|
193
193
|
# Internal: Return the summary text from the README
|
@@ -0,0 +1,56 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
stickler (2.3.0)
|
5
|
+
addressable (~> 2.3)
|
6
|
+
excon (~> 0.27.3)
|
7
|
+
logging (~> 1.8.1)
|
8
|
+
sinatra (~> 1.4)
|
9
|
+
trollop (~> 2.0)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: http://rubygems.org/
|
13
|
+
specs:
|
14
|
+
addressable (2.3.5)
|
15
|
+
builder (3.2.2)
|
16
|
+
excon (0.27.6)
|
17
|
+
hpricot (0.8.6)
|
18
|
+
json (1.8.0)
|
19
|
+
little-plugger (1.1.3)
|
20
|
+
logging (1.8.1)
|
21
|
+
little-plugger (>= 1.1.3)
|
22
|
+
multi_json (>= 1.3.6)
|
23
|
+
minitest (5.0.8)
|
24
|
+
multi_json (1.8.2)
|
25
|
+
mustache (0.99.4)
|
26
|
+
rack (1.5.2)
|
27
|
+
rack-protection (1.5.0)
|
28
|
+
rack
|
29
|
+
rack-test (0.6.2)
|
30
|
+
rack (>= 1.0)
|
31
|
+
rake (10.1.0)
|
32
|
+
rdiscount (2.1.7)
|
33
|
+
rdoc (4.0.1)
|
34
|
+
json (~> 1.4)
|
35
|
+
ronn (0.7.3)
|
36
|
+
hpricot (>= 0.8.2)
|
37
|
+
mustache (>= 0.7.0)
|
38
|
+
rdiscount (>= 1.5.8)
|
39
|
+
sinatra (1.4.3)
|
40
|
+
rack (~> 1.4)
|
41
|
+
rack-protection (~> 1.4)
|
42
|
+
tilt (~> 1.3, >= 1.3.4)
|
43
|
+
tilt (1.4.1)
|
44
|
+
trollop (2.0)
|
45
|
+
|
46
|
+
PLATFORMS
|
47
|
+
ruby
|
48
|
+
|
49
|
+
DEPENDENCIES
|
50
|
+
builder (~> 3.2)
|
51
|
+
minitest (~> 5.0)
|
52
|
+
rack-test (~> 0.6.2)
|
53
|
+
rake (~> 10.1)
|
54
|
+
rdoc (~> 4.0)
|
55
|
+
ronn (~> 0.7.3)
|
56
|
+
stickler!
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{bar}
|
5
|
+
s.version = "1.0.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jeremy Hinegardner"]
|
9
|
+
s.date = %q{2010-06-23}
|
10
|
+
s.description = %q{bar gem}
|
11
|
+
s.email = %q{jeremy@hinegardner.org}
|
12
|
+
s.files = ["README.rdoc", "lib/bar.rb", "bin/bar", "Rakefile", "bar.gemspec"]
|
13
|
+
s.homepage = %q{http://github.com/copiousfreetime/stickler}
|
14
|
+
s.require_paths = ["lib"]
|
15
|
+
s.rubygems_version = %q{1.3.5}
|
16
|
+
s.summary = %q{bar gem}
|
17
|
+
|
18
|
+
if s.respond_to? :specification_version then
|
19
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
20
|
+
s.specification_version = 3
|
21
|
+
|
22
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
23
|
+
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
24
|
+
else
|
25
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
26
|
+
end
|
27
|
+
else
|
28
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{baz}
|
5
|
+
s.version = "3.1.4"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jeremy Hinegardner"]
|
9
|
+
s.date = %q{2012-12-13}
|
10
|
+
s.description = %q{baz gem}
|
11
|
+
s.email = %q{jeremy@hinegardner.org}
|
12
|
+
s.files = ["README.rdoc", "lib/baz.rb", "bin/baz", "Rakefile", "baz-3.1.4.gemspec"]
|
13
|
+
s.homepage = %q{http://github.com/copiousfreetime/stickler}
|
14
|
+
s.require_paths = ["lib"]
|
15
|
+
s.rubygems_version = %q{1.3.5}
|
16
|
+
s.summary = %q{baz gem}
|
17
|
+
s.platform = 'java'
|
18
|
+
|
19
|
+
if s.respond_to? :specification_version then
|
20
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
21
|
+
s.specification_version = 3
|
22
|
+
|
23
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
24
|
+
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
25
|
+
else
|
26
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
27
|
+
end
|
28
|
+
else
|
29
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{baz}
|
5
|
+
s.version = "3.1.4"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jeremy Hinegardner"]
|
9
|
+
s.date = %q{2012-12-13}
|
10
|
+
s.description = %q{baz gem}
|
11
|
+
s.email = %q{jeremy@hinegardner.org}
|
12
|
+
s.files = ["README.rdoc", "lib/baz.rb", "bin/baz", "Rakefile", "baz-3.1.4.gemspec"]
|
13
|
+
s.homepage = %q{http://github.com/copiousfreetime/stickler}
|
14
|
+
s.require_paths = ["lib"]
|
15
|
+
s.rubygems_version = %q{1.3.5}
|
16
|
+
s.summary = %q{baz gem}
|
17
|
+
|
18
|
+
if s.respond_to? :specification_version then
|
19
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
20
|
+
s.specification_version = 3
|
21
|
+
|
22
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
23
|
+
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
24
|
+
else
|
25
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
26
|
+
end
|
27
|
+
else
|
28
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{foo}
|
5
|
+
s.version = "1.0.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jeremy Hinegardner"]
|
9
|
+
s.date = %q{2010-06-23}
|
10
|
+
s.description = %q{foo gem}
|
11
|
+
s.email = %q{jeremy@hinegardner.org}
|
12
|
+
s.files = ["README.rdoc", "lib/foo.rb", "bin/foo", "Rakefile", "foo.gemspec"]
|
13
|
+
s.homepage = %q{http://github.com/copiousfreetime/stickler}
|
14
|
+
s.require_paths = ["lib"]
|
15
|
+
s.rubygems_version = %q{1.3.5}
|
16
|
+
s.summary = %q{foo gem}
|
17
|
+
|
18
|
+
if s.respond_to? :specification_version then
|
19
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
20
|
+
s.specification_version = 3
|
21
|
+
|
22
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
23
|
+
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
24
|
+
else
|
25
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
26
|
+
end
|
27
|
+
else
|
28
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{foo}
|
5
|
+
s.version = "2.0.0a"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jeremy Hinegardner"]
|
9
|
+
s.date = %q{2010-06-23}
|
10
|
+
s.description = %q{foo gem prerelease}
|
11
|
+
s.email = %q{jeremy@hinegardner.org}
|
12
|
+
s.files = ["README.rdoc", "lib/foo.rb", "bin/foo", "Rakefile", "foo.gemspec"]
|
13
|
+
s.has_rdoc = false
|
14
|
+
s.homepage = %q{http://github.com/copiousfreetime/stickler}
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
s.rubygems_version = %q{1.3.7}
|
17
|
+
s.summary = %q{foo gem prerelease}
|
18
|
+
|
19
|
+
if s.respond_to? :specification_version then
|
20
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
21
|
+
s.specification_version = 3
|
22
|
+
|
23
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
24
|
+
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
25
|
+
else
|
26
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
27
|
+
end
|
28
|
+
else
|
29
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'rack/test'
|
2
|
+
require 'rubygems/user_interaction'
|
3
|
+
require 'rubygems/indexer'
|
4
|
+
|
5
|
+
module Stickler
|
6
|
+
module IndexTestHelpers
|
7
|
+
include Rack::Test::Methods
|
8
|
+
|
9
|
+
def define_directories
|
10
|
+
# pristine spec data location
|
11
|
+
@idx_test_dir = File.expand_path( File.dirname( __FILE__ ) )
|
12
|
+
@idx_test_datadir = File.join( @idx_test_dir, "data" )
|
13
|
+
|
14
|
+
# scratch location
|
15
|
+
@scratch_dir = File.join( @idx_test_dir, "scratch" )
|
16
|
+
@scratch_datadir = File.join( @scratch_dir, 'data' )
|
17
|
+
@scratch_specdir = File.join( @scratch_datadir, "specifications" )
|
18
|
+
@scratch_gemsdir = File.join( @scratch_datadir, "gems" )
|
19
|
+
end
|
20
|
+
|
21
|
+
# put in the before clause for setup
|
22
|
+
def mirror_spec_gemdir
|
23
|
+
define_directories
|
24
|
+
FileUtils.mkdir_p( @scratch_dir )
|
25
|
+
FileUtils.cp_r( @idx_test_datadir, @scratch_dir )
|
26
|
+
end
|
27
|
+
|
28
|
+
# Do a legacy index of the scratch location
|
29
|
+
def make_legacy_index
|
30
|
+
indexer = Gem::Indexer.new( @scratch_datadir, :build_legacy => true, :build_modern => false )
|
31
|
+
quiet_indexing( indexer )
|
32
|
+
end
|
33
|
+
|
34
|
+
# Do a modern index of the scratch location
|
35
|
+
def make_modern_index
|
36
|
+
indexer = Gem::Indexer.new( @scratch_datadir, :build_legacy => false, :build_modern => true )
|
37
|
+
quiet_indexing( indexer )
|
38
|
+
end
|
39
|
+
|
40
|
+
# put in the after clause for cleanup
|
41
|
+
def destroy_scratch_dir
|
42
|
+
FileUtils.rm_rf( @scratch_dir )
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
def quiet_indexing( indexer )
|
47
|
+
indexer.use_ui( Gem::SilentUI.new ) do
|
48
|
+
indexer.generate_index
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def validate_contents( got, expected, content_type)
|
53
|
+
case content_type
|
54
|
+
when 'application/x-gzip'
|
55
|
+
response_un = Gem.gunzip( got )
|
56
|
+
expected_un = Gem.gunzip( expected )
|
57
|
+
when 'application/x-deflate'
|
58
|
+
response_un = Gem.inflate( got )
|
59
|
+
expected_un = Gem.inflate( expected )
|
60
|
+
when 'application/octet-stream'
|
61
|
+
response_un = got
|
62
|
+
expected_un = expected
|
63
|
+
else
|
64
|
+
assert false, "Unkonwn content type #{content_type} with data #{got}"
|
65
|
+
end
|
66
|
+
|
67
|
+
got = Marshal.load( response_un )
|
68
|
+
got.sort! if got.kind_of?( Array )
|
69
|
+
|
70
|
+
need = Marshal.load( expected_un )
|
71
|
+
need.sort! if need.kind_of?( Array )
|
72
|
+
return need, got
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|