rubygems-update 1.7.2 → 1.8.0

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.

Files changed (104) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +5 -1
  3. data/History.txt +101 -4
  4. data/LICENSE.txt +42 -37
  5. data/MIT.txt +20 -0
  6. data/Manifest.txt +5 -4
  7. data/Rakefile +6 -7
  8. data/lib/rubygems.rb +175 -278
  9. data/lib/rubygems/builder.rb +7 -6
  10. data/lib/rubygems/command_manager.rb +16 -2
  11. data/lib/rubygems/commands/build_command.rb +13 -11
  12. data/lib/rubygems/commands/cert_command.rb +1 -1
  13. data/lib/rubygems/commands/cleanup_command.rb +10 -19
  14. data/lib/rubygems/commands/contents_command.rb +5 -5
  15. data/lib/rubygems/commands/dependency_command.rb +17 -40
  16. data/lib/rubygems/commands/fetch_command.rb +1 -1
  17. data/lib/rubygems/commands/install_command.rb +2 -1
  18. data/lib/rubygems/commands/lock_command.rb +4 -4
  19. data/lib/rubygems/commands/outdated_command.rb +18 -6
  20. data/lib/rubygems/commands/pristine_command.rb +25 -15
  21. data/lib/rubygems/commands/query_command.rb +9 -6
  22. data/lib/rubygems/commands/setup_command.rb +1 -1
  23. data/lib/rubygems/commands/specification_command.rb +8 -23
  24. data/lib/rubygems/commands/stale_command.rb +2 -1
  25. data/lib/rubygems/commands/unpack_command.rb +7 -5
  26. data/lib/rubygems/commands/update_command.rb +2 -4
  27. data/lib/rubygems/commands/which_command.rb +5 -9
  28. data/lib/rubygems/config_file.rb +9 -7
  29. data/lib/rubygems/custom_require.rb +6 -4
  30. data/lib/rubygems/defaults.rb +30 -14
  31. data/lib/rubygems/dependency.rb +44 -1
  32. data/lib/rubygems/dependency_installer.rb +37 -41
  33. data/lib/rubygems/dependency_list.rb +20 -9
  34. data/lib/rubygems/deprecate.rb +3 -3
  35. data/lib/rubygems/doc_manager.rb +10 -11
  36. data/lib/rubygems/ext/rake_builder.rb +1 -1
  37. data/lib/rubygems/gem_path_searcher.rb +19 -4
  38. data/lib/rubygems/gem_runner.rb +1 -1
  39. data/lib/rubygems/indexer.rb +117 -123
  40. data/lib/rubygems/installer.rb +101 -94
  41. data/lib/rubygems/installer_test_case.rb +28 -30
  42. data/lib/rubygems/local_remote_options.rb +1 -1
  43. data/lib/rubygems/mock_gem_ui.rb +10 -3
  44. data/lib/rubygems/package.rb +0 -26
  45. data/lib/rubygems/package/tar_input.rb +5 -6
  46. data/lib/rubygems/package_task.rb +1 -1
  47. data/lib/rubygems/path_support.rb +72 -0
  48. data/lib/rubygems/platform.rb +12 -2
  49. data/lib/rubygems/remote_fetcher.rb +7 -6
  50. data/lib/rubygems/requirement.rb +3 -0
  51. data/lib/rubygems/security.rb +1 -1
  52. data/lib/rubygems/server.rb +67 -67
  53. data/lib/rubygems/source_index.rb +58 -29
  54. data/lib/rubygems/spec_fetcher.rb +5 -1
  55. data/lib/rubygems/specification.rb +1422 -877
  56. data/lib/rubygems/test_case.rb +114 -64
  57. data/lib/rubygems/test_utilities.rb +4 -3
  58. data/lib/rubygems/text.rb +1 -1
  59. data/lib/rubygems/uninstaller.rb +37 -44
  60. data/test/rubygems/test_gem.rb +131 -102
  61. data/test/rubygems/test_gem_builder.rb +18 -1
  62. data/test/rubygems/test_gem_command_manager.rb +2 -0
  63. data/test/rubygems/test_gem_commands_build_command.rb +31 -3
  64. data/test/rubygems/test_gem_commands_cleanup_command.rb +51 -0
  65. data/test/rubygems/test_gem_commands_dependency_command.rb +1 -10
  66. data/test/rubygems/test_gem_commands_fetch_command.rb +5 -4
  67. data/test/rubygems/test_gem_commands_help_command.rb +58 -0
  68. data/test/rubygems/test_gem_commands_install_command.rb +25 -24
  69. data/test/rubygems/test_gem_commands_list_command.rb +1 -4
  70. data/test/rubygems/test_gem_commands_outdated_command.rb +10 -9
  71. data/test/rubygems/test_gem_commands_pristine_command.rb +63 -22
  72. data/test/rubygems/test_gem_commands_push_command.rb +1 -1
  73. data/test/rubygems/test_gem_commands_query_command.rb +15 -82
  74. data/test/rubygems/test_gem_commands_sources_command.rb +8 -9
  75. data/test/rubygems/test_gem_commands_specification_command.rb +10 -6
  76. data/test/rubygems/test_gem_commands_stale_command.rb +4 -4
  77. data/test/rubygems/test_gem_commands_unpack_command.rb +20 -21
  78. data/test/rubygems/test_gem_commands_update_command.rb +19 -23
  79. data/test/rubygems/test_gem_commands_which_command.rb +7 -4
  80. data/test/rubygems/test_gem_dependency.rb +14 -8
  81. data/test/rubygems/test_gem_dependency_installer.rb +87 -33
  82. data/test/rubygems/test_gem_dependency_list.rb +7 -3
  83. data/test/rubygems/test_gem_doc_manager.rb +3 -3
  84. data/test/rubygems/test_gem_format.rb +1 -1
  85. data/test/rubygems/test_gem_gem_path_searcher.rb +45 -29
  86. data/test/rubygems/test_gem_indexer.rb +48 -47
  87. data/test/rubygems/test_gem_install_update_options.rb +6 -5
  88. data/test/rubygems/test_gem_installer.rb +61 -37
  89. data/test/rubygems/test_gem_path_support.rb +58 -0
  90. data/test/rubygems/test_gem_platform.rb +5 -5
  91. data/test/rubygems/test_gem_remote_fetcher.rb +18 -21
  92. data/test/rubygems/test_gem_server.rb +23 -15
  93. data/test/rubygems/test_gem_source_index.rb +165 -127
  94. data/test/rubygems/test_gem_spec_fetcher.rb +42 -49
  95. data/test/rubygems/test_gem_specification.rb +104 -74
  96. data/test/rubygems/test_gem_text.rb +15 -0
  97. data/test/rubygems/test_gem_uninstaller.rb +15 -26
  98. data/test/rubygems/test_kernel.rb +1 -2
  99. metadata +64 -14
  100. metadata.gz.sig +0 -0
  101. data/GPL.txt +0 -340
  102. data/pkgs/sources/lib/sources.rb +0 -3
  103. data/pkgs/sources/sources.gemspec +0 -14
  104. data/test/rubygems/functional.rb +0 -92
data.tar.gz.sig CHANGED
Binary file
data/.autotest CHANGED
@@ -1,5 +1,8 @@
1
1
  # -*- ruby -*-
2
2
 
3
+ ENV['GEM_HOME'] = "tmp/isolate/ruby-1.8"
4
+ Gem.refresh
5
+
3
6
  require 'autotest/restart'
4
7
 
5
8
  Autotest.add_hook :initialize do |at|
@@ -25,7 +28,8 @@ Autotest.add_hook :initialize do |at|
25
28
  at.files_matching %r%^test/rubygems/test_(.*)\.rb$%
26
29
  end
27
30
 
28
- at.find_directories = ARGV unless ARGV.empty?
31
+ args = ARGV.reject { |a| a =~ /^-/ }
32
+ at.find_directories = args unless args.empty?
29
33
  end
30
34
 
31
35
  class Autotest
@@ -1,12 +1,109 @@
1
- === 1.7.2 / 2011-04-05
2
-
3
- * 1 Bug Fix:
1
+ === 1.8.0 / 2011-04-34
2
+
3
+ This release focused on properly encapsulating functionality. Most of this
4
+ work focused on moving functionality out of Gem::SourceIndex and
5
+ Gem::GemPathSearcher into Gem::Specification where it belongs.
6
+
7
+ After installing RubyGems 1.8.0 you will see deprecations when loading your
8
+ exsting gems. Run `gem pristine --all --no-extensions` to regenerate your
9
+ gem specifications safely.
10
+
11
+ Currently RubyGems does not save the build arguments used to build gems with
12
+ extensions. You will need to run `gem pristine gem_with_extension --
13
+ --build-arg` to regenerate a gem with an extension where it requires special
14
+ build arguments.
15
+
16
+ * 24(+) Deprecations (WOOT!):
17
+
18
+ * DependencyList.from_source_index deprecated the source_index argument.
19
+ * Deprecated Dependency.new(/regex/).
20
+ * Deprecated Gem.searcher.
21
+ * Deprecated Gem.source_index and Gem.available?
22
+ * Deprecated Gem: activate_dep, activate_spec, activate,
23
+ report_activate_error, and required_location.
24
+ * Deprecated Gem::all_partials
25
+ * Deprecated Gem::cache_dir
26
+ * Deprecated Gem::cache_gem
27
+ * Deprecated Gem::default_system_source_cache_dir
28
+ * Deprecated Gem::default_user_source_cache_dir
29
+ * Deprecated Platform#empty?
30
+ * Deprecated Specification.cache_gem
31
+ * Deprecated Specification.installation_path
32
+ * Deprecated Specification.loaded, loaded?, and loaded=
33
+ * Deprecated all of Gem::SourceIndex.
34
+ * Deprecated all of Gem::GemPathSearcher.
35
+ * Deprecated Gem::Specification#default_executable.
36
+
37
+ * 2 major enhancements:
38
+
39
+ * Gem::SourceIndex functionality has been moved to Gem::Specification.
40
+ Gem::SourceIndex is completely disconnected from Gem::Specification
41
+ * Refactored GemPathSearcher entirely out. RIPMF
42
+
43
+ * 41 minor enhancements:
44
+
45
+ * Added CommandManager#unregister_command
46
+ * Added Dependency#matching_specs + to_specs.
47
+ * Added Dependency#to_spec
48
+ * Added Gem.pre_reset_hook/s and post_reset_hook/s.
49
+ * Added GemCommand.reset to reinitialize the singleton
50
+ * Added Specification#activate.
51
+ * Added Specification#activated, activated=, and activated?
52
+ * Added Specification#base_dir.
53
+ * Added Specification#bin_dir and bin_file.
54
+ * Added Specification#cache_dir and cache_file. Aliased cache_gem.
55
+ * Added Specification#doc_dir and ri_dir.
56
+ * Added Specification#find(name_or_dep, *requirements).
57
+ * Added Specification#gem_dir and gems_dir.
58
+ * Added Specification#spec_dir and spec_file.
59
+ * Added Specification.add_spec, add_specs, and remove_spec.
60
+ * Added Specification.all=. If you use this, we will light you on fire.
61
+ * Added Specification.all_names.
62
+ * Added Specification.dirs and dirs=. dirs= resets.
63
+ * Added Specification.find_all_by_name(name, *reqs)
64
+ * Added Specification.latest_specs. SO TINY!
65
+ * Added TestCase#all_spec_names to help clean up tests
66
+ * Added TestCase#assert_path_exists and refute_path_exists. Will move to
67
+ minitest.
68
+ * Gem.sources no longer tries to load sources gem. Only uses default_sources.
69
+ * Installer no longer accepts a source_index option.
70
+ * More low-level integration.
71
+ * Removed Gem::FileOperations since it is a dummy class
72
+ * Removed a comment because I am dumb
73
+ * Removed pkgs/sources/lib/sources.rb
74
+ * Revamped indexer to mostly not use SourceIndex (legacy index requires it).
75
+ * Rewrote our last functional test suite to be happy and fast
76
+ * RubyGems is now under the Ruby License or the MIT license
77
+ * Specification#== now only checks name, version, and platform.
78
+ * Specification#authors= now forcefully flattens contents (bad rspec! no
79
+ cookie!)
80
+ * Specification#eql? checks all fields.
81
+ * Specification#installation_path no longer raises if it hasn't been
82
+ activated.
83
+ * Specification#validate now ensures that authors is not empty.
84
+ * TestCase.util_setup_spec_fetcher no longer returns a SourceIndex.
85
+ * Uninstaller no longer passes around SourceIndex instances
4
86
  * Warn on loading bad spec array values (ntlm-http gem has nil in its cert
5
87
  chain)
88
+ * `gem pristine` now accepts --no-executables to skip restoring gems with
89
+ extensions.
90
+ * `gem pristine` can now restore multiple gems.
91
+
92
+ * 6 bug fixes:
93
+
94
+ * DependencyInstaller passed around a source_index instance but used
95
+ Gem.source_index.
96
+ * Fixed Platform#== and #hash so instances may be used as hash keys.
97
+ * Fixed broken Specification#original_platform. It should never be nil.
98
+ * Gem::Text#format_text now strips trailing whitespace
99
+ * Normalize LOAD_PATH with File.expand_path
100
+ * `gem build` errors should exit 1.
101
+ * `gem pristine` can now restore non-latest gems where the cached gem was
102
+ removed.
6
103
 
7
104
  === 1.7.1 / 2011-03-32
8
105
 
9
- * 1 Bug Fix:
106
+ * 1 bug fix:
10
107
  * Fixed missing file in Manifest.txt. (Also a bug in hoe was fixed where
11
108
  `rake check_manifest` showing a diff would not exit with an error.)
12
109
 
@@ -1,53 +1,58 @@
1
1
  RubyGems is copyrighted free software by Chad Fowler, Rich Kilmer, Jim
2
2
  Weirich and others. You can redistribute it and/or modify it under
3
- either the terms of the GPL (see the GPL.txt file), or the conditions
4
- below:
3
+ either the terms of the MIT license (see the file MIT.txt), or the
4
+ conditions below:
5
5
 
6
- 1. You may make and give away verbatim copies of the source form of the
7
- software without restriction, provided that you duplicate all of the
8
- original copyright notices and associated disclaimers.
6
+ 1. You may make and give away verbatim copies of the source form of the
7
+ software without restriction, provided that you duplicate all of the
8
+ original copyright notices and associated disclaimers.
9
9
 
10
- 2. You may modify your copy of the software in any way, provided that
11
- you do at least ONE of the following:
10
+ 2. You may modify your copy of the software in any way, provided that
11
+ you do at least ONE of the following:
12
12
 
13
- a) place your modifications in the Public Domain or otherwise
14
- make them Freely Available, such as by posting said
15
- modifications to Usenet or an equivalent medium, or by allowing
16
- the author to include your modifications in the software.
13
+ a. place your modifications in the Public Domain or otherwise
14
+ make them Freely Available, such as by posting said
15
+ modifications to Usenet or an equivalent medium, or by allowing
16
+ the author to include your modifications in the software.
17
17
 
18
- b) use the modified software only within your corporation or
19
- organization.
18
+ b. use the modified software only within your corporation or
19
+ organization.
20
20
 
21
- c) rename any non-standard executables so the names do not conflict
22
- with standard executables, which must also be provided.
21
+ c. give non-standard executables non-standard names, with
22
+ instructions on where to get the original software distribution.
23
23
 
24
- d) make other distribution arrangements with the author.
24
+ d. make other distribution arrangements with the author.
25
25
 
26
- 3. You may distribute the software in object code or executable
27
- form, provided that you do at least ONE of the following:
26
+ 3. You may distribute the software in object code or executable
27
+ form, provided that you do at least ONE of the following:
28
28
 
29
- a) distribute the executables and library files of the software,
30
- together with instructions (in the manual page or equivalent)
31
- on where to get the original distribution.
29
+ a. distribute the executables and library files of the software,
30
+ together with instructions (in the manual page or equivalent)
31
+ on where to get the original distribution.
32
32
 
33
- b) accompany the distribution with the machine-readable source of
34
- the software.
33
+ b. accompany the distribution with the machine-readable source of
34
+ the software.
35
35
 
36
- c) give non-standard executables non-standard names, with
37
- instructions on where to get the original software distribution.
36
+ c. give non-standard executables non-standard names, with
37
+ instructions on where to get the original software distribution.
38
38
 
39
- d) make other distribution arrangements with the author.
39
+ d. make other distribution arrangements with the author.
40
40
 
41
- 4. You may modify and include the part of the software into any other
42
- software (possibly commercial).
41
+ 4. You may modify and include the part of the software into any other
42
+ software (possibly commercial). But some files in the distribution
43
+ are not written by the author, so that they are not under these terms.
43
44
 
44
- 5. The scripts and library files supplied as input to or produced as
45
- output from the software do not automatically fall under the
46
- copyright of the software, but belong to whomever generated them,
47
- and may be sold commercially, and may be aggregated with this
48
- software.
45
+ For the list of those files and their copying conditions, see the
46
+ file LEGAL.
47
+
48
+ 5. The scripts and library files supplied as input to or produced as
49
+ output from the software do not automatically fall under the
50
+ copyright of the software, but belong to whomever generated them,
51
+ and may be sold commercially, and may be aggregated with this
52
+ software.
53
+
54
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
55
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
56
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
57
+ PURPOSE.
49
58
 
50
- 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
51
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
52
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
53
- PURPOSE.
data/MIT.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) Chad Fowler, Rich Kilmer, Jim Weirich and others.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ 'Software'), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,8 +1,8 @@
1
1
  .autotest
2
2
  .document
3
- GPL.txt
4
3
  History.txt
5
4
  LICENSE.txt
5
+ MIT.txt
6
6
  Manifest.txt
7
7
  README.rdoc
8
8
  Rakefile
@@ -84,6 +84,7 @@ lib/rubygems/package/tar_reader/entry.rb
84
84
  lib/rubygems/package/tar_test_case.rb
85
85
  lib/rubygems/package/tar_writer.rb
86
86
  lib/rubygems/package_task.rb
87
+ lib/rubygems/path_support.rb
87
88
  lib/rubygems/platform.rb
88
89
  lib/rubygems/remote_fetcher.rb
89
90
  lib/rubygems/require_paths_builder.rb
@@ -102,8 +103,6 @@ lib/rubygems/validator.rb
102
103
  lib/rubygems/version.rb
103
104
  lib/rubygems/version_option.rb
104
105
  lib/ubygems.rb
105
- pkgs/sources/lib/sources.rb
106
- pkgs/sources/sources.gemspec
107
106
  setup.rb
108
107
  test/rubygems/bogussources.rb
109
108
  test/rubygems/data/gem-private_key.pem
@@ -111,7 +110,6 @@ test/rubygems/data/gem-public_cert.pem
111
110
  test/rubygems/fake_certlib/openssl.rb
112
111
  test/rubygems/fix_openssl_warnings.rb
113
112
  test/rubygems/foo/discover.rb
114
- test/rubygems/functional.rb
115
113
  test/rubygems/insure_session.rb
116
114
  test/rubygems/plugin/exception/rubygems_plugin.rb
117
115
  test/rubygems/plugin/load/rubygems_plugin.rb
@@ -130,11 +128,13 @@ test/rubygems/test_gem_command_manager.rb
130
128
  test/rubygems/test_gem_commands_build_command.rb
131
129
  test/rubygems/test_gem_commands_cert_command.rb
132
130
  test/rubygems/test_gem_commands_check_command.rb
131
+ test/rubygems/test_gem_commands_cleanup_command.rb
133
132
  test/rubygems/test_gem_commands_contents_command.rb
134
133
  test/rubygems/test_gem_commands_dependency_command.rb
135
134
  test/rubygems/test_gem_commands_environment_command.rb
136
135
  test/rubygems/test_gem_commands_fetch_command.rb
137
136
  test/rubygems/test_gem_commands_generate_index_command.rb
137
+ test/rubygems/test_gem_commands_help_command.rb
138
138
  test/rubygems/test_gem_commands_install_command.rb
139
139
  test/rubygems/test_gem_commands_list_command.rb
140
140
  test/rubygems/test_gem_commands_lock_command.rb
@@ -174,6 +174,7 @@ test/rubygems/test_gem_package_tar_reader.rb
174
174
  test/rubygems/test_gem_package_tar_reader_entry.rb
175
175
  test/rubygems/test_gem_package_tar_writer.rb
176
176
  test/rubygems/test_gem_package_task.rb
177
+ test/rubygems/test_gem_path_support.rb
177
178
  test/rubygems/test_gem_platform.rb
178
179
  test/rubygems/test_gem_remote_fetcher.rb
179
180
  test/rubygems/test_gem_requirement.rb
data/Rakefile CHANGED
@@ -18,6 +18,7 @@ Hoe::RUBY_FLAGS << " --disable-gems" if RUBY_VERSION > "1.9"
18
18
 
19
19
  Hoe.plugin :minitest
20
20
  Hoe.plugin :git
21
+ Hoe.plugin :isolate
21
22
 
22
23
  hoe = Hoe.spec 'rubygems-update' do
23
24
  self.rubyforge_name = 'rubygems'
@@ -45,6 +46,9 @@ hoe = Hoe.spec 'rubygems-update' do
45
46
  extra_dev_deps << ['builder', '~> 2.1']
46
47
  extra_dev_deps << ['hoe-seattlerb', '~> 1.2']
47
48
  extra_dev_deps << ['session', '~> 2.4']
49
+ extra_dev_deps << ['rdoc', '~> 3.0']
50
+ extra_dev_deps << ['rcov', '~> 0.9.0']
51
+ extra_dev_deps << ['ZenTest', '~> 4.5']
48
52
 
49
53
  self.extra_rdoc_files = Dir["*.rdoc"]
50
54
 
@@ -73,16 +77,10 @@ task :rake_sucks do
73
77
  end
74
78
  end
75
79
 
76
- desc "Run just the functional tests"
77
- Rake::TestTask.new(:test_functional) do |t|
78
- t.test_files = FileList['test/functional*.rb']
79
- t.warning = true
80
- end
81
-
82
80
  # --------------------------------------------------------------------
83
81
  # Creating a release
84
82
 
85
- task :prerelease => [:clobber, :check_manifest, :test, :test_functional]
83
+ task :prerelease => [:clobber, :check_manifest, :test]
86
84
 
87
85
  task :postrelease => :publish_docs
88
86
 
@@ -167,6 +165,7 @@ task "rcov:for", [:test] do |task, args|
167
165
 
168
166
  rflags = []
169
167
  rflags << "-i" << "lib/rubygems"
168
+ rflags << "--no-color" << "--save coverage.info" << "-T" << "--no-html"
170
169
 
171
170
  ruby "#{flags.join ' '} #{rcov} #{rflags.join ' '} #{args[:test]}"
172
171
  end
@@ -27,6 +27,7 @@ end
27
27
 
28
28
  require 'rubygems/defaults'
29
29
  require "rubygems/dependency_list"
30
+ require 'rubygems/path_support'
30
31
  require 'rbconfig'
31
32
  require "rubygems/deprecate"
32
33
 
@@ -119,8 +120,7 @@ require "rubygems/deprecate"
119
120
  # -The RubyGems Team
120
121
 
121
122
  module Gem
122
-
123
- VERSION = '1.7.2'
123
+ VERSION = '1.8.0'
124
124
 
125
125
  ##
126
126
  # Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -156,11 +156,6 @@ module Gem
156
156
  end
157
157
  end
158
158
 
159
- ##
160
- # Default directories in a gem repository
161
-
162
- DIRECTORIES = %w[cache doc gems specifications] unless defined?(DIRECTORIES)
163
-
164
159
  RubyGemsPackageVersion = VERSION
165
160
 
166
161
  RUBYGEMS_DIR = File.dirname File.expand_path(__FILE__)
@@ -186,13 +181,15 @@ module Gem
186
181
  @loaded_specs = {}
187
182
  @platforms = []
188
183
  @ruby = nil
189
- @sources = []
184
+ @sources = nil
190
185
 
191
186
  @post_build_hooks ||= []
192
187
  @post_install_hooks ||= []
193
188
  @post_uninstall_hooks ||= []
194
189
  @pre_uninstall_hooks ||= []
195
190
  @pre_install_hooks ||= []
191
+ @pre_reset_hooks ||= []
192
+ @post_reset_hooks ||= []
196
193
 
197
194
  ##
198
195
  # Try to activate a gem containing +path+. Returns true if
@@ -200,17 +197,18 @@ module Gem
200
197
  # activated. Returns false if it can't find the path in a gem.
201
198
 
202
199
  def self.try_activate path
200
+ # TODO: deprecate when 1.9.3 comes out.
203
201
  # finds the _latest_ version... regardless of loaded specs and their deps
204
202
 
205
203
  # TODO: use find_all and bork if ambiguous
206
204
 
207
- spec = Gem.searcher.find path
205
+ spec = Gem::Specification.find_by_path path
208
206
  return false unless spec
209
207
 
210
208
  begin
211
- Gem.activate spec.name, "= #{spec.version}"
209
+ spec.activate
212
210
  rescue Gem::LoadError # this could fail due to gem dep collisions, go lax
213
- Gem.activate spec.name
211
+ Gem::Specification.find_by_name(spec.name).activate
214
212
  end
215
213
 
216
214
  return true
@@ -233,111 +231,18 @@ module Gem
233
231
  # Gem::Requirement and Gem::Version documentation.
234
232
 
235
233
  def self.activate(dep, *requirements)
236
- activate_dep dep, *requirements
237
- end
238
-
239
- def self.activate_dep dep, *requirements
240
- requirements = Gem::Requirement.default if requirements.empty?
241
- dep = Gem::Dependency.new(dep, requirements) unless Gem::Dependency === dep
242
-
243
- matches = Gem.source_index.search dep, true
244
- report_activate_error(dep) if matches.empty?
245
-
246
- existing_spec = @loaded_specs[dep.name]
234
+ raise ArgumentError, "Deprecated use of Gem.activate(dep)" if
235
+ Gem::Dependency === dep
247
236
 
248
- # TODO: move this to Dependency
249
- if existing_spec then
250
- # This gem is already loaded. If the currently loaded gem is not in the
251
- # list of candidate gems, then we have a version conflict.
252
-
253
- # TODO: unless dep.matches_spec? existing_spec then
254
- unless matches.any? { |spec| spec.version == existing_spec.version } then
255
- msg = "can't activate #{dep}, "
256
- msg << "already activated #{existing_spec.full_name}"
257
-
258
- e = Gem::LoadError.new msg
259
- e.name = dep.name
260
- e.requirement = dep.requirement
261
-
262
- raise e
263
- end
264
-
265
- return false
266
- end
267
-
268
- # TODO: this + spec.conflicts hint that activation is still dumb
269
- spec = matches.last
270
-
271
- activate_spec spec
237
+ Gem::Specification.find_by_name(dep, *requirements).activate
272
238
  end
273
239
 
274
- def self.activate_spec spec
275
- existing_spec = @loaded_specs[spec.name]
276
-
277
- # TODO: move this to Specification
278
- if existing_spec then
279
- if spec.version != existing_spec.version then
280
- # This gem is already loaded. If the currently loaded gem is not in the
281
- # list of candidate gems, then we have a version conflict.
282
-
283
- msg = "can't activate #{dep}, "
284
- msg << "already activated #{existing_spec.full_name}"
285
-
286
- e = Gem::LoadError.new msg
287
- e.name = dep.name
288
- e.requirement = dep.requirement
289
-
290
- raise e
291
- end
292
-
293
- return false
294
- end
295
-
296
- conf = spec.conflicts
297
-
298
- unless conf.empty? then
299
- why = conf.map { |act,con|
300
- "#{act.full_name} conflicts with #{con.join(", ")}"
301
- }.join ", "
302
-
303
- # TODO: improve message by saying who activated `con`
304
-
305
- raise LoadError, "Unable to activate #{spec.full_name}, because #{why}"
306
- end
307
-
308
- spec.loaded = true
309
- @loaded_specs[spec.name] = spec
310
-
311
- spec.runtime_dependencies.each do |spec_dep|
312
- next if Gem.loaded_specs.include? spec_dep.name
313
- specs = Gem.source_index.search spec_dep, true
314
-
315
- if specs.size == 1 then
316
- self.activate spec_dep
317
- else
318
- name = spec_dep.name
319
- unresolved_deps[name] = unresolved_deps[name].merge spec_dep
320
- end
321
- end
322
-
323
- unresolved_deps.delete spec.name
324
-
325
- require_paths = spec.require_paths.map do |path|
326
- File.join spec.full_gem_path, path
327
- end
328
-
329
- # gem directories must come after -I and ENV['RUBYLIB']
330
- insert_index = load_path_insert_index
331
-
332
- if insert_index then
333
- # gem directories must come after -I and ENV['RUBYLIB']
334
- $LOAD_PATH.insert(insert_index, *require_paths)
335
- else
336
- # we are probably testing in core, -I and RUBYLIB don't apply
337
- $LOAD_PATH.unshift(*require_paths)
338
- end
240
+ def self.activate_dep dep, *requirements # :nodoc:
241
+ dep.to_spec.activate
242
+ end
339
243
 
340
- return true
244
+ def self.activate_spec spec # :nodoc:
245
+ spec.activate
341
246
  end
342
247
 
343
248
  def self.unresolved_deps
@@ -353,7 +258,7 @@ module Gem
353
258
 
354
259
  Gem.path.each do |gemdir|
355
260
  each_load_path all_partials(gemdir) do |load_path|
356
- result << load_path
261
+ result << gemdir.add(load_path).expand_path
357
262
  end
358
263
  end
359
264
 
@@ -364,7 +269,7 @@ module Gem
364
269
  # Return all the partial paths in +gemdir+.
365
270
 
366
271
  def self.all_partials(gemdir)
367
- Dir[File.join(gemdir, 'gems/*')]
272
+ Dir[File.join(gemdir, "gems/*")]
368
273
  end
369
274
 
370
275
  private_class_method :all_partials
@@ -372,15 +277,14 @@ module Gem
372
277
  ##
373
278
  # See if a given gem is available.
374
279
 
375
- def self.available?(gem, *requirements)
280
+ def self.available?(dep, *requirements)
376
281
  requirements = Gem::Requirement.default if requirements.empty?
377
282
 
378
- unless gem.respond_to?(:name) and
379
- gem.respond_to?(:requirement) then
380
- gem = Gem::Dependency.new gem, requirements
283
+ unless dep.respond_to?(:name) and dep.respond_to?(:requirement) then
284
+ dep = Gem::Dependency.new dep, requirements
381
285
  end
382
286
 
383
- !Gem.source_index.search(gem).empty?
287
+ not dep.matching_specs(true).empty?
384
288
  end
385
289
 
386
290
  ##
@@ -390,32 +294,29 @@ module Gem
390
294
  # you to specify specific gem versions.
391
295
 
392
296
  def self.bin_path(name, exec_name = nil, *requirements)
297
+ # TODO: fails test_self_bin_path_bin_file_gone_in_latest
298
+ # Gem::Specification.find_by_name(name, *requirements).bin_file exec_name
299
+
393
300
  raise ArgumentError, "you must supply exec_name" unless exec_name
394
301
 
395
302
  requirements = Gem::Requirement.default if
396
303
  requirements.empty?
397
- specs = Gem.source_index.find_name(name, requirements)
304
+
305
+ specs = Gem::Dependency.new(name, requirements).matching_specs(true)
398
306
 
399
307
  raise Gem::GemNotFoundException,
400
308
  "can't find gem #{name} (#{requirements})" if specs.empty?
401
309
 
402
- specs = specs.find_all do |spec|
403
- spec.executables.include?(exec_name)
404
- end if exec_name
310
+ specs = specs.find_all { |spec|
311
+ spec.executables.include? exec_name
312
+ } if exec_name
405
313
 
406
314
  unless spec = specs.last
407
315
  msg = "can't find gem #{name} (#{requirements}) with executable #{exec_name}"
408
316
  raise Gem::GemNotFoundException, msg
409
317
  end
410
318
 
411
- exec_name ||= spec.default_executable
412
-
413
- unless exec_name
414
- msg = "no default executable for #{spec.full_name} and none given"
415
- raise Gem::Exception, msg
416
- end
417
-
418
- File.join(spec.full_gem_path, spec.bindir, exec_name)
319
+ spec.bin_file exec_name
419
320
  end
420
321
 
421
322
  ##
@@ -429,8 +330,9 @@ module Gem
429
330
  # The path where gem executables are to be installed.
430
331
 
431
332
  def self.bindir(install_dir=Gem.dir)
432
- return File.join(install_dir, 'bin') unless
433
- install_dir.to_s == Gem.default_dir
333
+ # TODO: move to Gem::Dirs
334
+ return File.join install_dir, 'bin' unless
335
+ install_dir.to_s == Gem.default_dir.to_s
434
336
  Gem.default_bindir
435
337
  end
436
338
 
@@ -440,20 +342,18 @@ module Gem
440
342
  # mainly used by the unit tests to provide test isolation.
441
343
 
442
344
  def self.clear_paths
443
- @gem_home = nil
444
- @gem_path = nil
445
- @user_home = nil
446
-
447
345
  @@source_index = nil
448
-
449
- @searcher = nil
346
+ @paths = nil
347
+ @user_home = nil
348
+ @searcher = nil
349
+ Gem::Specification.reset
450
350
  end
451
351
 
452
352
  ##
453
353
  # The path to standard location of the user's .gemrc file.
454
354
 
455
355
  def self.config_file
456
- File.join Gem.user_home, '.gemrc'
356
+ @config_file ||= File.join Gem.user_home, '.gemrc'
457
357
  end
458
358
 
459
359
  ##
@@ -476,9 +376,10 @@ module Gem
476
376
  # package is not available as a gem, return nil.
477
377
 
478
378
  def self.datadir(gem_name)
379
+ # TODO: deprecate
479
380
  spec = @loaded_specs[gem_name]
480
381
  return nil if spec.nil?
481
- File.join(spec.full_gem_path, 'data', gem_name)
382
+ File.join spec.full_gem_path, "data", gem_name
482
383
  end
483
384
 
484
385
  ##
@@ -489,13 +390,29 @@ module Gem
489
390
  Zlib::Deflate.deflate data
490
391
  end
491
392
 
393
+ def self.paths
394
+ @paths ||= Gem::PathSupport.new
395
+ end
396
+
397
+ def self.paths=(env)
398
+ clear_paths
399
+ @paths = Gem::PathSupport.new env
400
+ Gem::Specification.dirs = @paths.path # FIX: home is at end
401
+ end
402
+
492
403
  ##
493
404
  # The path where gems are to be installed.
405
+ #--
406
+ # FIXME deprecate these once everything else has been done -ebh
494
407
 
495
408
  def self.dir
496
- @gem_home ||= nil
497
- set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
498
- @gem_home
409
+ # TODO: raise "no"
410
+ paths.home
411
+ end
412
+
413
+ def self.path
414
+ # TODO: raise "no"
415
+ paths.path
499
416
  end
500
417
 
501
418
  ##
@@ -504,33 +421,35 @@ module Gem
504
421
 
505
422
  def self.each_load_path(partials)
506
423
  partials.each do |gp|
507
- base = File.basename(gp)
508
- specfn = File.join(dir, "specifications", base + ".gemspec")
509
- if File.exist?(specfn)
510
- spec = eval(File.read(specfn))
424
+ base = gp.basename
425
+ specfn = dir.specifications.add(base + ".gemspec")
426
+ if specfn.exist?
427
+ spec = eval(specfn.read)
511
428
  spec.require_paths.each do |rp|
512
- yield(File.join(gp, rp))
429
+ yield(gp.add(rp))
513
430
  end
514
431
  else
515
- filename = File.join(gp, 'lib')
516
- yield(filename) if File.exist?(filename)
432
+ filename = dir.add(gp, 'lib')
433
+ yield(filename) if filename.exist?
517
434
  end
518
435
  end
519
436
  end
520
437
 
521
438
  private_class_method :each_load_path
522
439
 
440
+
523
441
  ##
524
442
  # Quietly ensure the named Gem directory contains all the proper
525
443
  # subdirectories. If we can't create a directory due to a permission
526
444
  # problem, then we will silently continue.
527
445
 
528
- def self.ensure_gem_subdirectories(gemdir)
446
+ def self.ensure_gem_subdirectories dir = Gem.dir
529
447
  require 'fileutils'
530
448
 
531
- Gem::DIRECTORIES.each do |filename|
532
- fn = File.join gemdir, filename
533
- FileUtils.mkdir_p fn rescue nil unless File.exist? fn
449
+ %w[cache doc gems specifications].each do |name|
450
+ subdir = File.join dir, name
451
+ next if File.exist? subdir
452
+ FileUtils.mkdir_p subdir rescue nil # in case of perms issues -- lame
534
453
  end
535
454
  end
536
455
 
@@ -555,11 +474,9 @@ module Gem
555
474
  }.flatten.select { |file| File.file? file.untaint }
556
475
  end
557
476
 
558
- specs = searcher.find_all glob
559
-
560
- specs.each do |spec|
561
- files.concat searcher.matching_files(spec, glob)
562
- end
477
+ files.concat Gem::Specification.map { |spec|
478
+ spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
479
+ }.flatten
563
480
 
564
481
  # $LOAD_PATH might contain duplicate entries or reference
565
482
  # the spec dirs directly, so we prune.
@@ -579,25 +496,30 @@ module Gem
579
496
  # it should fallback to USERPROFILE and HOMEDRIVE + HOMEPATH (at
580
497
  # least on Win32).
581
498
  #++
499
+ #--
500
+ #
501
+ # FIXME move to pathsupport
502
+ #
503
+ #++
582
504
 
583
505
  def self.find_home
584
- unless RUBY_VERSION > '1.9' then
585
- ['HOME', 'USERPROFILE'].each do |homekey|
586
- return File.expand_path(ENV[homekey]) if ENV[homekey]
506
+ windows = File::ALT_SEPARATOR
507
+ if not windows or RUBY_VERSION >= '1.9' then
508
+ File.expand_path "~"
509
+ else
510
+ ['HOME', 'USERPROFILE'].each do |key|
511
+ return File.expand_path ENV[key] if ENV[key]
587
512
  end
588
513
 
589
514
  if ENV['HOMEDRIVE'] && ENV['HOMEPATH'] then
590
- return File.expand_path("#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}")
515
+ File.expand_path "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}"
591
516
  end
592
517
  end
593
-
594
- File.expand_path "~"
595
518
  rescue
596
- if File::ALT_SEPARATOR then
597
- drive = ENV['HOMEDRIVE'] || ENV['SystemDrive']
598
- File.join(drive.to_s, '/')
519
+ if windows then
520
+ File.expand_path File.join(ENV['HOMEDRIVE'] || ENV['SystemDrive'], '/')
599
521
  else
600
- "/"
522
+ File.expand_path "/"
601
523
  end
602
524
  end
603
525
 
@@ -663,7 +585,7 @@ module Gem
663
585
 
664
586
  Gem.path.each do |gemdir|
665
587
  each_load_path(latest_partials(gemdir)) do |load_path|
666
- result << load_path
588
+ result << gemdir.add(load_path).expand_path
667
589
  end
668
590
  end
669
591
 
@@ -676,8 +598,9 @@ module Gem
676
598
  def self.latest_partials(gemdir)
677
599
  latest = {}
678
600
  all_partials(gemdir).each do |gp|
679
- base = File.basename(gp)
680
- if base =~ /(.*)-((\d+\.)*\d+)/ then
601
+ base = gp.basename
602
+
603
+ if base.to_s =~ /(.*)-((\d+\.)*\d+)/ then
681
604
  name, version = $1, $2
682
605
  ver = Gem::Version.new(version)
683
606
  if latest[name].nil? || ver > latest[name][0]
@@ -742,25 +665,6 @@ module Gem
742
665
  "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}"
743
666
  end
744
667
 
745
- ##
746
- # Array of paths to search for Gems.
747
-
748
- def self.path
749
- @gem_path ||= nil
750
-
751
- unless @gem_path then
752
- paths = [ENV['GEM_PATH'] || default_path]
753
-
754
- if defined?(APPLE_GEM_HOME) and not ENV['GEM_PATH'] then
755
- paths << APPLE_GEM_HOME
756
- end
757
-
758
- set_paths paths.compact.join(File::PATH_SEPARATOR)
759
- end
760
-
761
- @gem_path
762
- end
763
-
764
668
  ##
765
669
  # Get the appropriate cache path.
766
670
  #
@@ -769,7 +673,7 @@ module Gem
769
673
  #
770
674
 
771
675
  def self.cache_dir(custom_dir=false)
772
- File.join(custom_dir ? custom_dir : Gem.dir, 'cache')
676
+ File.join(custom_dir || Gem.dir, "cache")
773
677
  end
774
678
 
775
679
  ##
@@ -779,7 +683,7 @@ module Gem
779
683
  # nil/false (default) for Gem.dir.
780
684
 
781
685
  def self.cache_gem(filename, user_dir=false)
782
- File.join(cache_dir(user_dir), filename)
686
+ cache_dir(user_dir).add(filename)
783
687
  end
784
688
 
785
689
  ##
@@ -819,6 +723,14 @@ module Gem
819
723
  @post_install_hooks << hook
820
724
  end
821
725
 
726
+ ##
727
+ # Adds a hook that will get run after Gem::Specification.reset is
728
+ # run.
729
+
730
+ def self.post_reset(&hook)
731
+ @post_reset_hooks << hook
732
+ end
733
+
822
734
  ##
823
735
  # Adds a post-uninstall hook that will be passed a Gem::Uninstaller instance
824
736
  # and the spec that was uninstalled when Gem::Uninstaller#uninstall is
@@ -837,6 +749,14 @@ module Gem
837
749
  @pre_install_hooks << hook
838
750
  end
839
751
 
752
+ ##
753
+ # Adds a hook that will get run before Gem::Specification.reset is
754
+ # run.
755
+
756
+ def self.pre_reset(&hook)
757
+ @pre_reset_hooks << hook
758
+ end
759
+
840
760
  ##
841
761
  # Adds a pre-uninstall hook that will be passed an Gem::Uninstaller instance
842
762
  # and the spec that will be uninstalled when Gem::Uninstaller#uninstall is
@@ -873,10 +793,10 @@ module Gem
873
793
  raise ArgumentError, "gem #{gem_name} is not activated" if gem.nil?
874
794
  raise ArgumentError, "gem #{over_name} is not activated" if over.nil?
875
795
 
876
- last_gem_path = File.join gem.full_gem_path, gem.require_paths.last
796
+ last_gem_path = Gem::Path.path(gem.full_gem_path).add(gem.require_paths.last)
877
797
 
878
798
  over_paths = over.require_paths.map do |path|
879
- File.join over.full_gem_path, path
799
+ Gem::Path.path(over.full_gem_path).add(path).to_s
880
800
  end
881
801
 
882
802
  over_paths.each do |path|
@@ -892,8 +812,8 @@ module Gem
892
812
  # Refresh source_index from disk and clear searcher.
893
813
 
894
814
  def self.refresh
895
- source_index.refresh!
896
-
815
+ Gem::Specification.reset
816
+ @source_index = nil
897
817
  @searcher = nil
898
818
  end
899
819
 
@@ -910,7 +830,7 @@ module Gem
910
830
  # any version by the requested name.
911
831
 
912
832
  def self.report_activate_error(gem)
913
- matches = Gem.source_index.find_name(gem.name)
833
+ matches = Gem::Specification.find_by_name(gem.name)
914
834
 
915
835
  if matches.empty? then
916
836
  error = Gem::LoadError.new(
@@ -941,8 +861,8 @@ module Gem
941
861
 
942
862
  spec = matches.last
943
863
  spec.require_paths.each do |path|
944
- result = File.join spec.full_gem_path, path, libfile
945
- return result if File.exist? result
864
+ result = Gem::Path.path(spec.full_gem_path).add(path, libfile)
865
+ return result if result.exist?
946
866
  end
947
867
 
948
868
  nil
@@ -954,11 +874,9 @@ module Gem
954
874
  def self.ruby
955
875
  if @ruby.nil? then
956
876
  @ruby = File.join(ConfigMap[:bindir],
957
- ConfigMap[:ruby_install_name])
958
- @ruby << ConfigMap[:EXEEXT]
877
+ "#{ConfigMap[:ruby_install_name]}#{ConfigMap[:EXEEXT]}")
959
878
 
960
- # escape string in case path to ruby executable contain spaces.
961
- @ruby.sub!(/.*\s.*/m, '"\&"')
879
+ @ruby = "\"#{@ruby}\"" if @ruby =~ /\s/
962
880
  end
963
881
 
964
882
  @ruby
@@ -1010,45 +928,13 @@ module Gem
1010
928
  @searcher ||= Gem::GemPathSearcher.new
1011
929
  end
1012
930
 
1013
- ##
1014
- # Set the Gem home directory (as reported by Gem.dir).
1015
-
1016
- def self.set_home(home)
1017
- home = home.gsub File::ALT_SEPARATOR, File::SEPARATOR if File::ALT_SEPARATOR
1018
- @gem_home = home
1019
- end
1020
-
1021
- private_class_method :set_home
1022
-
1023
- ##
1024
- # Set the Gem search path (as reported by Gem.path).
1025
-
1026
- def self.set_paths(gpaths)
1027
- if gpaths
1028
- @gem_path = gpaths.split(File::PATH_SEPARATOR)
1029
-
1030
- if File::ALT_SEPARATOR then
1031
- @gem_path.map! do |path|
1032
- path.gsub File::ALT_SEPARATOR, File::SEPARATOR
1033
- end
1034
- end
1035
-
1036
- @gem_path << Gem.dir
1037
- else
1038
- # TODO: should this be Gem.default_path instead?
1039
- @gem_path = [Gem.dir]
1040
- end
1041
-
1042
- @gem_path.uniq!
1043
- end
1044
-
1045
- private_class_method :set_paths
1046
-
1047
931
  ##
1048
932
  # Returns the Gem::SourceIndex of specifications that are in the Gem.path
1049
933
 
1050
934
  def self.source_index
1051
- @@source_index ||= SourceIndex.new Gem::SourceIndex.installed_spec_directories
935
+ @@source_index ||= Deprecate.skip_during do
936
+ SourceIndex.new Gem::Specification.dirs
937
+ end
1052
938
  end
1053
939
 
1054
940
  ##
@@ -1057,23 +943,14 @@ module Gem
1057
943
  # default_sources if it is not installed.
1058
944
 
1059
945
  def self.sources
1060
- if @sources.empty? then
1061
- begin
1062
- gem 'sources', '> 0.0.1'
1063
- require 'sources'
1064
- rescue LoadError
1065
- @sources = default_sources
1066
- end
1067
- end
1068
-
1069
- @sources
946
+ @sources ||= default_sources
1070
947
  end
1071
948
 
1072
949
  ##
1073
950
  # Need to be able to set the sources without calling
1074
951
  # Gem.sources.replace since that would cause an infinite loop.
1075
952
 
1076
- def self.sources=(new_sources)
953
+ def self.sources= new_sources
1077
954
  @sources = new_sources
1078
955
  end
1079
956
 
@@ -1135,9 +1012,8 @@ module Gem
1135
1012
  # by the unit tests to provide environment isolation.
1136
1013
 
1137
1014
  def self.use_paths(home, paths=[])
1138
- clear_paths
1139
- set_home(home) if home
1140
- set_paths(paths.join(File::PATH_SEPARATOR)) if paths
1015
+ self.paths = { "GEM_HOME" => home, "GEM_PATH" => paths }
1016
+ # TODO: self.paths = home, paths
1141
1017
  end
1142
1018
 
1143
1019
  ##
@@ -1221,6 +1097,11 @@ module Gem
1221
1097
 
1222
1098
  attr_reader :post_install_hooks
1223
1099
 
1100
+ ##
1101
+ # The list of hooks to be run after Gem::Specification.reset is run.
1102
+
1103
+ attr_reader :post_reset_hooks
1104
+
1224
1105
  ##
1225
1106
  # The list of hooks to be run before Gem::Uninstall#uninstall does any
1226
1107
  # work
@@ -1232,11 +1113,15 @@ module Gem
1232
1113
 
1233
1114
  attr_reader :pre_install_hooks
1234
1115
 
1116
+ ##
1117
+ # The list of hooks to be run before Gem::Specification.reset is run.
1118
+
1119
+ attr_reader :pre_reset_hooks
1120
+
1235
1121
  ##
1236
1122
  # The list of hooks to be run after Gem::Uninstall#uninstall is finished
1237
1123
 
1238
1124
  attr_reader :pre_uninstall_hooks
1239
-
1240
1125
  end
1241
1126
 
1242
1127
  def self.cache # :nodoc:
@@ -1248,27 +1133,17 @@ module Gem
1248
1133
 
1249
1134
  MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/"
1250
1135
 
1251
- autoload :Version, 'rubygems/version'
1252
- autoload :Requirement, 'rubygems/requirement'
1253
- autoload :Dependency, 'rubygems/dependency'
1136
+ autoload :Version, 'rubygems/version'
1137
+ autoload :Requirement, 'rubygems/requirement'
1138
+ autoload :Dependency, 'rubygems/dependency'
1254
1139
  autoload :GemPathSearcher, 'rubygems/gem_path_searcher'
1255
- autoload :SpecFetcher, 'rubygems/spec_fetcher'
1256
- autoload :Specification, 'rubygems/specification'
1257
- autoload :Cache, 'rubygems/source_index'
1258
- autoload :SourceIndex, 'rubygems/source_index'
1259
- autoload :Platform, 'rubygems/platform'
1260
- autoload :Builder, 'rubygems/builder'
1261
- autoload :ConfigFile, 'rubygems/config_file'
1262
-
1263
- class << self
1264
- extend Deprecate
1265
- # Can't do this one until I add Specification#activate
1266
- # deprecate :activate, "Specification#activate", 2011, 10
1267
- deprecate :all_load_paths, :none, 2011, 10
1268
- deprecate :latest_load_paths, :none, 2011, 10
1269
- deprecate :promote_load_path, :none, 2011, 10
1270
- deprecate :cache, "Gem::source_index", 2011, 8
1271
- end
1140
+ autoload :SpecFetcher, 'rubygems/spec_fetcher'
1141
+ autoload :Specification, 'rubygems/specification'
1142
+ autoload :Cache, 'rubygems/source_index'
1143
+ autoload :SourceIndex, 'rubygems/source_index'
1144
+ autoload :Platform, 'rubygems/platform'
1145
+ autoload :Builder, 'rubygems/builder'
1146
+ autoload :ConfigFile, 'rubygems/config_file'
1272
1147
  end
1273
1148
 
1274
1149
  module Kernel
@@ -1304,7 +1179,8 @@ module Kernel
1304
1179
  def gem(gem_name, *requirements) # :doc:
1305
1180
  skip_list = (ENV['GEM_SKIP'] || "").split(/:/)
1306
1181
  raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name
1307
- Gem.activate(gem_name, *requirements)
1182
+ spec = Gem::Dependency.new(gem_name, *requirements).to_spec
1183
+ spec.activate if spec
1308
1184
  end
1309
1185
 
1310
1186
  private :gem
@@ -1325,8 +1201,7 @@ def RbConfig.datadir(package_name)
1325
1201
 
1326
1202
  require 'rbconfig/datadir'
1327
1203
 
1328
- Gem.datadir(package_name) ||
1329
- File.join(Gem::ConfigMap[:datadir], package_name)
1204
+ Gem.datadir(package_name) || File.join(Gem::ConfigMap[:datadir], package_name)
1330
1205
  end
1331
1206
 
1332
1207
  require 'rubygems/exceptions'
@@ -1359,3 +1234,25 @@ require 'rubygems/custom_require'
1359
1234
 
1360
1235
  Gem.clear_paths
1361
1236
 
1237
+ module Gem
1238
+ class << self
1239
+ extend Deprecate
1240
+ deprecate :activate_dep, "Specification#activate", 2011, 6
1241
+ deprecate :activate_spec, "Specification#activate", 2011, 6
1242
+ deprecate :cache, "Gem::source_index", 2011, 8
1243
+ deprecate :activate, "Specification#activate", 2011, 10
1244
+ deprecate :all_load_paths, :none, 2011, 10
1245
+ deprecate :all_partials, :none, 2011, 10
1246
+ deprecate :latest_load_paths, :none, 2011, 10
1247
+ deprecate :promote_load_path, :none, 2011, 10
1248
+ deprecate :available?, "Specification::find_by_name", 2011, 11
1249
+ deprecate :cache_dir, "Specification#cache_dir", 2011, 11
1250
+ deprecate :cache_gem, "Specification#cache_file", 2011, 11
1251
+ deprecate :default_system_source_cache_dir, :none, 2011, 11
1252
+ deprecate :default_user_source_cache_dir, :none, 2011, 11
1253
+ deprecate :report_activate_error, :none, 2011, 11
1254
+ deprecate :required_location, :none, 2011, 11
1255
+ deprecate :searcher, "Specification", 2011, 11
1256
+ deprecate :source_index, "Specification", 2011, 11
1257
+ end
1258
+ end