rubygems-update 0.8.10 → 0.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- data/ChangeLog +66 -0
- data/README +17 -3
- data/Rakefile +29 -11
- data/bin/gem_mirror +67 -0
- data/examples/application/an-app.gemspec +2 -0
- data/lib/rubygems.rb +18 -3
- data/lib/rubygems/builder.rb +14 -1
- data/lib/rubygems/cmd_manager.rb +2 -0
- data/lib/rubygems/command.rb +26 -2
- data/lib/rubygems/custom_require.rb +30 -21
- data/lib/rubygems/format.rb +4 -4
- data/lib/rubygems/gem_commands.rb +161 -9
- data/lib/rubygems/gem_openssl.rb +34 -0
- data/lib/rubygems/gem_runner.rb +5 -1
- data/lib/rubygems/installer.rb +117 -38
- data/lib/rubygems/package.rb +135 -25
- data/lib/rubygems/remote_installer.rb +59 -29
- data/lib/rubygems/rubygems_version.rb +1 -1
- data/lib/rubygems/security.rb +478 -0
- data/lib/rubygems/specification.rb +48 -28
- data/post-install.rb +2 -1
- data/scripts/gemdoc.rb +2 -2
- data/scripts/specdoc.rb +25 -24
- data/scripts/upload_gemdoc.rb +134 -0
- data/setup.rb +1 -1
- 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/specifications/a-0.0.1.gemspec +1 -1
- data/test/data/gemhome/specifications/a-0.0.2.gemspec +1 -1
- data/test/data/gemhome/specifications/b-0.0.2.gemspec +1 -1
- data/test/data/gemhome/specifications/c-1.2.gemspec +1 -1
- data/test/data/one/one-0.0.1.gem +0 -0
- data/test/fake_certlib/openssl.rb +1 -0
- data/test/functional.rb +49 -14
- data/test/gemutilities.rb +69 -5
- data/test/test_cached_fetcher.rb +5 -7
- data/test/test_file_list.rb +96 -0
- data/test/test_gempaths.rb +36 -34
- data/test/test_installer.rb +214 -0
- data/test/test_local_cache.rb +45 -102
- data/test/test_parse_commands.rb +3 -1
- data/test/test_remote_installer.rb +24 -5
- data/test/test_specific_extras.rb +40 -0
- data/test/test_specification.rb +106 -16
- metadata +14 -3
data/test/data/c-1.2.gem
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/data/one/one-0.0.1.gem
CHANGED
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
fail LoadError, "no such file to load -- openssl"
|
data/test/functional.rb
CHANGED
@@ -13,28 +13,29 @@ class FunctionalTest < Test::Unit::TestCase
|
|
13
13
|
@gem_path = File.expand_path("bin/gem")
|
14
14
|
lib_path = File.expand_path("lib")
|
15
15
|
@ruby_options = "-I#{lib_path} -I."
|
16
|
+
@verbose = false
|
16
17
|
end
|
17
18
|
|
18
19
|
def test_gem_help_options
|
19
|
-
|
20
|
+
gem_nossl 'help options'
|
20
21
|
assert_match(/Usage:/, @out)
|
21
22
|
assert_status
|
22
23
|
end
|
23
24
|
|
24
25
|
def test_gem_help_commands
|
25
|
-
|
26
|
+
gem_nossl 'help commands'
|
26
27
|
assert_match(/gem install/, @out)
|
27
28
|
assert_status
|
28
29
|
end
|
29
30
|
|
30
31
|
def test_gem_no_args_shows_help
|
31
|
-
|
32
|
+
gem_nossl
|
32
33
|
assert_match(/Usage:/, @out)
|
33
34
|
assert_status 1
|
34
35
|
end
|
35
36
|
|
36
37
|
def test_environment
|
37
|
-
|
38
|
+
gem_nossl 'environment'
|
38
39
|
|
39
40
|
assert_match /VERSION:\s+(\d+\.)*\d+/, @out
|
40
41
|
assert_match /INSTALLATION DIRECTORY:/, @out
|
@@ -44,22 +45,22 @@ class FunctionalTest < Test::Unit::TestCase
|
|
44
45
|
end
|
45
46
|
|
46
47
|
def test_env_version
|
47
|
-
|
48
|
+
gem_nossl 'environment version'
|
48
49
|
assert_match /\d+\.\d+$/, @out
|
49
50
|
end
|
50
51
|
|
51
52
|
def test_env_gemdir
|
52
|
-
|
53
|
+
gem_nossl 'environment gemdir'
|
53
54
|
assert_equal Gem.dir, @out.chomp
|
54
55
|
end
|
55
56
|
|
56
57
|
def test_env_gempath
|
57
|
-
|
58
|
+
gem_nossl 'environment gempath'
|
58
59
|
assert_equal Gem.path, @out.chomp.split("\n")
|
59
60
|
end
|
60
61
|
|
61
62
|
def test_env_remotesources
|
62
|
-
|
63
|
+
gem_nossl 'environment remotesources'
|
63
64
|
assert_equal Gem::RemoteInstaller.new.sources, @out.chomp.split("\n")
|
64
65
|
end
|
65
66
|
|
@@ -89,7 +90,7 @@ class FunctionalTest < Test::Unit::TestCase
|
|
89
90
|
|
90
91
|
def test_bogus_source_hoses_up_remote_install_but_gem_command_gives_decent_error_message
|
91
92
|
@ruby_options << " -rtest/bogussources"
|
92
|
-
|
93
|
+
gem_nossl "install asdf --remote"
|
93
94
|
assert_match(/error/im, @err)
|
94
95
|
assert_status 1
|
95
96
|
end
|
@@ -97,32 +98,66 @@ class FunctionalTest < Test::Unit::TestCase
|
|
97
98
|
def test_all_command_helps
|
98
99
|
mgr = Gem::CommandManager.new
|
99
100
|
mgr.command_names.each do |cmdname|
|
100
|
-
|
101
|
+
gem_nossl "help #{cmdname}"
|
101
102
|
assert_match /Usage: gem #{cmdname}/, @out, "should see help for #{cmdname}"
|
102
103
|
end
|
103
104
|
end
|
104
105
|
|
105
106
|
def test_gemrc_paths
|
106
|
-
|
107
|
+
gem_nossl "env --config-file test/testgem.rc"
|
107
108
|
assert_match %{/usr/local/rubygems}, @out
|
108
109
|
assert_match %{/another/spot/for/rubygems}, @out
|
109
110
|
assert_match %{test/data/gemhome}, @out
|
110
111
|
end
|
111
112
|
|
112
113
|
def test_gemrc_args
|
113
|
-
|
114
|
+
gem_nossl "help --config-file test/testgem.rc"
|
114
115
|
assert_match %{gem build}, @out
|
115
116
|
assert_match %{gem install}, @out
|
116
117
|
end
|
117
118
|
|
119
|
+
SIGN_FILES = %w(gem-private_key.pem gem-public_cert.pem)
|
120
|
+
|
121
|
+
def test_cert_build
|
122
|
+
SIGN_FILES.each do |fn| FileUtils.rm_f fn end
|
123
|
+
gem_withssl "cert --build x@y.z"
|
124
|
+
SIGN_FILES.each do |fn|
|
125
|
+
assert File.exist?(fn),
|
126
|
+
"Signing key/cert file '#{fn}' should exist"
|
127
|
+
end
|
128
|
+
ensure
|
129
|
+
SIGN_FILES.each do |fn| FileUtils.rm_f fn end
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_nossl_cert
|
133
|
+
gem_nossl "cert --build x@y.z"
|
134
|
+
assert @status != 0
|
135
|
+
assert_match /not installed/, @err,
|
136
|
+
"Should have a not installed error for openssl"
|
137
|
+
end
|
138
|
+
|
118
139
|
# :section: Help Methods
|
119
140
|
|
141
|
+
# Run a gem command without the SSL library.
|
142
|
+
def gem_nossl(options="")
|
143
|
+
old_options = @ruby_options
|
144
|
+
@ruby_options << " -Itest/fake_certlib"
|
145
|
+
gem(options)
|
146
|
+
ensure
|
147
|
+
@ruby_options = old_options
|
148
|
+
end
|
149
|
+
|
150
|
+
# Run a gem command with the SSL library.
|
151
|
+
def gem_withssl(options="")
|
152
|
+
gem(options)
|
153
|
+
end
|
154
|
+
|
120
155
|
# Run a gem command for the functional test.
|
121
156
|
def gem(options="")
|
122
157
|
shell = Session::Shell.new
|
123
158
|
options = options + " --config-file missing_file" if options !~ /--config-file/
|
124
|
-
command = "ruby #{@ruby_options} #{@gem_path} #{options}"
|
125
|
-
puts "
|
159
|
+
command = "#{Gem.ruby} #{@ruby_options} #{@gem_path} #{options}"
|
160
|
+
puts "\n\nCOMMAND: [#{command}]" if @verbose
|
126
161
|
@out, @err = shell.execute command
|
127
162
|
@status = shell.exit_status
|
128
163
|
puts "STATUS: [#{@status}]" if @verbose
|
data/test/gemutilities.rb
CHANGED
@@ -1,18 +1,82 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'fileutils'
|
4
|
+
require 'test/unit/testcase'
|
5
|
+
require 'tmpdir'
|
4
6
|
require 'test/yaml_data'
|
5
7
|
|
6
8
|
module Utilities
|
7
|
-
def make_gemhome(path)
|
8
|
-
FileUtils.mkdir_p path
|
9
|
-
end
|
10
|
-
|
11
9
|
def make_cache_area(path, *uris)
|
12
|
-
make_gemhome(path)
|
13
10
|
fn = File.join(path, 'source_cache')
|
14
11
|
open(fn, 'w') do |f| f.write Marshal.dump(cache_hash(*uris)) end
|
15
12
|
end
|
16
13
|
|
17
14
|
extend self
|
18
15
|
end
|
16
|
+
|
17
|
+
class RubyGemTestCase < Test::Unit::TestCase
|
18
|
+
def setup
|
19
|
+
@tempdir = File.join Dir.tmpdir, "test_rubygems_#{$$}"
|
20
|
+
@gemhome = File.join @tempdir, "gemhome"
|
21
|
+
@gemcache = File.join(@gemhome, "source_cache")
|
22
|
+
@usrcache = File.join(@gemhome, ".gem", "user_cache")
|
23
|
+
|
24
|
+
FileUtils.mkdir_p @gemhome
|
25
|
+
|
26
|
+
ENV['GEMCACHE'] = @usrcache
|
27
|
+
Gem.use_paths(@gemhome)
|
28
|
+
end
|
29
|
+
|
30
|
+
def teardown
|
31
|
+
FileUtils.rm_r @tempdir
|
32
|
+
ENV['GEMCACHE'] = nil
|
33
|
+
Gem.clear_paths
|
34
|
+
end
|
35
|
+
|
36
|
+
def prep_cache_files(lc)
|
37
|
+
[ [lc.system_cache_file, 'sys'],
|
38
|
+
[lc.user_cache_file, 'usr'],
|
39
|
+
].each do |fn, data|
|
40
|
+
FileUtils.mkdir_p File.dirname(fn)
|
41
|
+
open(fn, "w") { |f| f.puts(Marshal.dump({'key' => data})) }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def read_cache(fn)
|
46
|
+
open(fn) { |f| Marshal.load(f) }
|
47
|
+
end
|
48
|
+
|
49
|
+
def write_file(path)
|
50
|
+
path = File.join(@gemhome, path)
|
51
|
+
dir = File.dirname path
|
52
|
+
FileUtils.mkdir_p dir
|
53
|
+
File.open(path, "w") { |io|
|
54
|
+
yield(io)
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def quick_gem(gemname, version='0.0.2')
|
59
|
+
spec = Gem::Specification.new do |s|
|
60
|
+
s.platform = Gem::Platform::RUBY
|
61
|
+
s.name = gemname
|
62
|
+
s.version = version
|
63
|
+
s.author = 'A User'
|
64
|
+
s.email = 'example@example.com'
|
65
|
+
s.homepage = 'http://example.com'
|
66
|
+
s.has_rdoc = true
|
67
|
+
s.summary = "this is a summary"
|
68
|
+
s.description = "This is a test description"
|
69
|
+
yield(s) if block_given?
|
70
|
+
end
|
71
|
+
|
72
|
+
write_file(File.join("specifications", spec.full_name + ".gemspec")) do |io|
|
73
|
+
io.write(spec.to_ruby)
|
74
|
+
end
|
75
|
+
|
76
|
+
return spec
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_stupid
|
80
|
+
# shuts up test/unit
|
81
|
+
end
|
82
|
+
end
|
data/test/test_cached_fetcher.rb
CHANGED
@@ -7,9 +7,7 @@ require 'rubygems/remote_installer'
|
|
7
7
|
require 'test/yaml_data'
|
8
8
|
require 'test/gemutilities'
|
9
9
|
|
10
|
-
class TestCachedFetcher <
|
11
|
-
SOURCE_URI = "http://localhost:12344"
|
12
|
-
GEMHOME = "test/temp/writable_cache"
|
10
|
+
class TestCachedFetcher < RubyGemTestCase
|
13
11
|
|
14
12
|
class MockFetcher
|
15
13
|
attr_reader :count
|
@@ -29,10 +27,10 @@ class TestCachedFetcher < Test::Unit::TestCase
|
|
29
27
|
end
|
30
28
|
|
31
29
|
def setup
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
@cf = Gem::CachedFetcher.new(
|
30
|
+
super
|
31
|
+
@source_uri = "http://localhost:12344"
|
32
|
+
make_cache_area(@gemhome, @source_uri)
|
33
|
+
@cf = Gem::CachedFetcher.new(@source_uri, nil)
|
36
34
|
@mf = MockFetcher.new
|
37
35
|
@cf.instance_variable_set("@fetcher", @mf)
|
38
36
|
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'tmpdir'
|
3
|
+
require 'test/unit'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'test/gemutilities'
|
6
|
+
Gem::manage_gems
|
7
|
+
|
8
|
+
class TestFileList < RubyGemTestCase
|
9
|
+
|
10
|
+
def import_spec(name)
|
11
|
+
file = File.join(@gem_install_path, "specifications", name)
|
12
|
+
eval File.read(file)
|
13
|
+
end
|
14
|
+
|
15
|
+
def setup
|
16
|
+
@spec = Gem::Specification.new do |s|
|
17
|
+
s.files = ['lib/code.rb','lib/apple.rb','lib/brown.rb']
|
18
|
+
s.name = "a"
|
19
|
+
s.version = "0.0.1"
|
20
|
+
s.summary = "summary"
|
21
|
+
s.description = "desc"
|
22
|
+
s.require_path = 'lib'
|
23
|
+
end
|
24
|
+
|
25
|
+
@cm = Gem::CommandManager.new
|
26
|
+
@contents = @cm['contents']
|
27
|
+
|
28
|
+
current_path = Dir.getwd
|
29
|
+
@gem_install_path = File.join(current_path, "test/mock/gems/")
|
30
|
+
@gem_root_dir = File.join(@gem_install_path, "gems", @spec.name + "-" + @spec.version.to_s)
|
31
|
+
|
32
|
+
@gemspec_filename = @spec.name + '-' + @spec.version.to_s + '.gemspec'
|
33
|
+
@spec_destination_path = File.join(@gem_install_path, "specifications", @gemspec_filename)
|
34
|
+
|
35
|
+
begin
|
36
|
+
File.open(@spec_destination_path, 'w') do |fp|
|
37
|
+
fp.write @spec.to_ruby
|
38
|
+
end
|
39
|
+
rescue Exception => e
|
40
|
+
# ignore errors in setup
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
def teardown
|
46
|
+
FileUtils.rm_rf @spec_destination_path unless $DEBUG
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_inspect_list
|
50
|
+
args = ["-s", @gem_install_path, "a"]
|
51
|
+
Gem::Command.instance_eval "public :handle_options"
|
52
|
+
@contents.handle_options(args)
|
53
|
+
sio = StringIO.new
|
54
|
+
@contents.execute(sio)
|
55
|
+
files = sio.string.split("\n")
|
56
|
+
code = File.join(@gem_root_dir,"lib/code.rb")
|
57
|
+
assert_match(code, files[0])
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_inspect_list_unknown
|
61
|
+
args = ["-s", @gem_install_path, "not_there"]
|
62
|
+
Gem::Command.instance_eval "public :handle_options"
|
63
|
+
@contents.handle_options(args)
|
64
|
+
sio = StringIO.new
|
65
|
+
@contents.execute(sio)
|
66
|
+
assert_match(/Unable to find/, sio.string)
|
67
|
+
end
|
68
|
+
|
69
|
+
def disable_test_specification
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
puts " dest path: " + @spec_destination_path
|
74
|
+
assert(FileTest.exists?(@spec_destination_path))
|
75
|
+
assert(FileTest.size(@spec_destination_path)>0)
|
76
|
+
spec = import_spec(@gemspec_filename)
|
77
|
+
|
78
|
+
p spec.require_paths
|
79
|
+
p spec.full_gem_path
|
80
|
+
|
81
|
+
files = spec.files.map do |f|
|
82
|
+
end
|
83
|
+
|
84
|
+
root = @gem_install_path + "a-0.0.1";
|
85
|
+
|
86
|
+
puts " files[0] is: " + files[0]
|
87
|
+
|
88
|
+
check1 = root + "/lib/code.rb"
|
89
|
+
puts " check1 is " + check1
|
90
|
+
assert(files[0] == check1)
|
91
|
+
assert(files[1] == root + "/lib/apple.rb");
|
92
|
+
assert(files[2] == root + "/lib/brown.rb");
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
data/test/test_gempaths.rb
CHANGED
@@ -3,20 +3,24 @@
|
|
3
3
|
require 'test/unit'
|
4
4
|
require 'fileutils'
|
5
5
|
require 'rubygems'
|
6
|
+
require 'test/gemutilities'
|
6
7
|
|
7
|
-
class TestGemPaths <
|
8
|
+
class TestGemPaths < RubyGemTestCase
|
8
9
|
def setup
|
10
|
+
super
|
9
11
|
Gem.clear_paths
|
10
12
|
ENV['GEM_HOME'] = nil
|
11
13
|
ENV['GEM_PATH'] = nil
|
14
|
+
@additional = ['a', 'b'].map { |f| File.join(@tempdir, f) }
|
12
15
|
end
|
13
16
|
|
14
17
|
def teardown
|
15
|
-
|
18
|
+
super
|
19
|
+
ENV['GEM_HOME'] = nil
|
20
|
+
ENV['GEM_PATH'] = nil
|
16
21
|
end
|
17
22
|
|
18
23
|
DEFAULT_DIR_RE = %r{/ruby/gems/[0-9.]+}
|
19
|
-
TEST_GEMDIR = 'test/temp/gemdir'
|
20
24
|
|
21
25
|
def test_default_dir
|
22
26
|
assert_match DEFAULT_DIR_RE, Gem.dir
|
@@ -29,14 +33,14 @@ class TestGemPaths < Test::Unit::TestCase
|
|
29
33
|
end
|
30
34
|
|
31
35
|
def test_gem_home
|
32
|
-
ENV['GEM_HOME'] =
|
33
|
-
assert_equal
|
36
|
+
ENV['GEM_HOME'] = @gemhome
|
37
|
+
assert_equal @gemhome, Gem.dir
|
34
38
|
end
|
35
39
|
|
36
40
|
def test_gem_home_subdirectories
|
37
|
-
ENV['GEM_HOME'] =
|
41
|
+
ENV['GEM_HOME'] = @gemhome
|
38
42
|
['cache', 'doc', 'gems', 'specifications'].each do |filename|
|
39
|
-
assert File.exists?(File.join(
|
43
|
+
assert File.exists?(File.join(@gemhome, filename)), "expected #{filename} to exist"
|
40
44
|
end
|
41
45
|
end
|
42
46
|
|
@@ -44,45 +48,43 @@ class TestGemPaths < Test::Unit::TestCase
|
|
44
48
|
assert_equal [Gem.dir], Gem.path
|
45
49
|
end
|
46
50
|
|
47
|
-
ADDITIONAL = ['test/temp/a', 'test/temp/b']
|
48
|
-
|
49
51
|
def test_additional_paths
|
50
52
|
create_additional_gem_dirs
|
51
|
-
ENV['GEM_PATH'] =
|
52
|
-
assert_equal
|
53
|
+
ENV['GEM_PATH'] = @additional.join(File::PATH_SEPARATOR)
|
54
|
+
assert_equal @additional, Gem.path[0,2]
|
53
55
|
assert_equal 3, Gem.path.size
|
54
56
|
assert_match DEFAULT_DIR_RE, Gem.path.last
|
55
57
|
end
|
56
58
|
|
57
59
|
def test_dir_path_overlap
|
58
60
|
create_additional_gem_dirs
|
59
|
-
ENV['GEM_HOME'] =
|
60
|
-
ENV['GEM_PATH'] =
|
61
|
-
assert_equal
|
62
|
-
assert_equal
|
61
|
+
ENV['GEM_HOME'] = @gemhome
|
62
|
+
ENV['GEM_PATH'] = @additional.join(File::PATH_SEPARATOR)
|
63
|
+
assert_equal @gemhome, Gem.dir
|
64
|
+
assert_equal @additional + [Gem.dir], Gem.path
|
63
65
|
end
|
64
66
|
|
65
67
|
def test_dir_path_overlaping_duplicates_removed
|
66
68
|
create_additional_gem_dirs
|
67
|
-
dirs = [
|
68
|
-
ENV['GEM_HOME'] =
|
69
|
+
dirs = [@gemhome] + @additional + [File.join(@tempdir, 'a')]
|
70
|
+
ENV['GEM_HOME'] = @gemhome
|
69
71
|
ENV['GEM_PATH'] = dirs.join(File::PATH_SEPARATOR)
|
70
|
-
assert_equal
|
71
|
-
assert_equal [Gem.dir] +
|
72
|
+
assert_equal @gemhome, Gem.dir
|
73
|
+
assert_equal [Gem.dir] + @additional, Gem.path
|
72
74
|
end
|
73
75
|
|
74
76
|
def test_path_use_home
|
75
77
|
create_additional_gem_dirs
|
76
|
-
Gem.use_paths(
|
77
|
-
assert_equal
|
78
|
+
Gem.use_paths(@gemhome)
|
79
|
+
assert_equal @gemhome, Gem.dir
|
78
80
|
assert_equal [Gem.dir], Gem.path
|
79
81
|
end
|
80
82
|
|
81
83
|
def test_path_use_home_and_dirs
|
82
84
|
create_additional_gem_dirs
|
83
|
-
Gem.use_paths(
|
84
|
-
assert_equal
|
85
|
-
assert_equal
|
85
|
+
Gem.use_paths(@gemhome, @additional)
|
86
|
+
assert_equal @gemhome, Gem.dir
|
87
|
+
assert_equal @additional+[Gem.dir], Gem.path
|
86
88
|
end
|
87
89
|
|
88
90
|
def test_user_home
|
@@ -92,22 +94,22 @@ class TestGemPaths < Test::Unit::TestCase
|
|
92
94
|
end
|
93
95
|
|
94
96
|
def test_ensure_gem_directories_new
|
95
|
-
FileUtils.rm_r(
|
96
|
-
Gem.use_paths(
|
97
|
-
Gem.send(:ensure_gem_subdirectories,
|
98
|
-
assert File.exist?("
|
97
|
+
FileUtils.rm_r(@gemhome)
|
98
|
+
Gem.use_paths(@gemhome)
|
99
|
+
Gem.send(:ensure_gem_subdirectories, @gemhome)
|
100
|
+
assert File.exist?(File.join(@gemhome, "cache"))
|
99
101
|
end
|
100
102
|
|
101
103
|
def test_ensure_gem_directories_missing_parents
|
102
|
-
gemdir = "
|
103
|
-
FileUtils.rm_r("
|
104
|
+
gemdir = File.join(@tempdir, "a/b/c/gemdir")
|
105
|
+
FileUtils.rm_r(File.join(@tempdir, "a")) rescue nil
|
104
106
|
Gem.use_paths(gemdir)
|
105
107
|
Gem.send(:ensure_gem_subdirectories, gemdir)
|
106
108
|
assert File.exist?("#{gemdir}/cache")
|
107
109
|
end
|
108
110
|
|
109
111
|
def test_ensure_gem_directories_write_protected
|
110
|
-
gemdir = "
|
112
|
+
gemdir = File.join(@tempdir, "egd")
|
111
113
|
FileUtils.rm_r gemdir rescue nil
|
112
114
|
FileUtils.mkdir_p gemdir
|
113
115
|
FileUtils.chmod 0400, gemdir
|
@@ -120,7 +122,7 @@ class TestGemPaths < Test::Unit::TestCase
|
|
120
122
|
end
|
121
123
|
|
122
124
|
def test_ensure_gem_directories_with_parents_write_protected
|
123
|
-
parent = "
|
125
|
+
parent = File.join(@tempdir, "egd")
|
124
126
|
gemdir = "#{parent}/a/b/c"
|
125
127
|
|
126
128
|
FileUtils.rm_r parent rescue nil
|
@@ -137,8 +139,8 @@ class TestGemPaths < Test::Unit::TestCase
|
|
137
139
|
private
|
138
140
|
|
139
141
|
def create_additional_gem_dirs
|
140
|
-
create_gem_dir(
|
141
|
-
|
142
|
+
create_gem_dir(@gemhome)
|
143
|
+
@additional.each do |dir| create_gem_dir(dir) end
|
142
144
|
end
|
143
145
|
|
144
146
|
def create_gem_dir(fn)
|