rubygems-update 1.8.30 → 2.0.0.preview2

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 (241) hide show
  1. checksums.yaml +6 -6
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +3 -0
  4. data/.autotest +6 -3
  5. data/History.txt +137 -63
  6. data/LICENSE.txt +1 -5
  7. data/Manifest.txt +69 -32
  8. data/README.rdoc +11 -9
  9. data/Rakefile +24 -38
  10. data/bin/gem +0 -9
  11. data/bin/update_rubygems +1 -0
  12. data/lib/rubygems.rb +193 -405
  13. data/lib/rubygems/available_set.rb +95 -0
  14. data/lib/rubygems/command.rb +88 -45
  15. data/lib/rubygems/command_manager.rb +67 -40
  16. data/lib/rubygems/commands/build_command.rb +5 -23
  17. data/lib/rubygems/commands/cert_command.rb +199 -57
  18. data/lib/rubygems/commands/check_command.rb +14 -39
  19. data/lib/rubygems/commands/cleanup_command.rb +9 -1
  20. data/lib/rubygems/commands/contents_command.rb +30 -12
  21. data/lib/rubygems/commands/dependency_command.rb +3 -8
  22. data/lib/rubygems/commands/environment_command.rb +13 -8
  23. data/lib/rubygems/commands/fetch_command.rb +3 -16
  24. data/lib/rubygems/commands/generate_index_command.rb +7 -47
  25. data/lib/rubygems/commands/help_command.rb +1 -1
  26. data/lib/rubygems/commands/install_command.rb +69 -36
  27. data/lib/rubygems/commands/list_command.rb +6 -4
  28. data/lib/rubygems/commands/lock_command.rb +1 -1
  29. data/lib/rubygems/commands/mirror_command.rb +17 -0
  30. data/lib/rubygems/commands/outdated_command.rb +6 -3
  31. data/lib/rubygems/commands/owner_command.rb +13 -5
  32. data/lib/rubygems/commands/pristine_command.rb +19 -4
  33. data/lib/rubygems/commands/push_command.rb +12 -1
  34. data/lib/rubygems/commands/query_command.rb +43 -27
  35. data/lib/rubygems/commands/rdoc_command.rb +23 -28
  36. data/lib/rubygems/commands/search_command.rb +4 -18
  37. data/lib/rubygems/commands/server_command.rb +1 -1
  38. data/lib/rubygems/commands/setup_command.rb +124 -38
  39. data/lib/rubygems/commands/sources_command.rb +16 -16
  40. data/lib/rubygems/commands/specification_command.rb +11 -13
  41. data/lib/rubygems/commands/uninstall_command.rb +24 -7
  42. data/lib/rubygems/commands/unpack_command.rb +7 -3
  43. data/lib/rubygems/commands/update_command.rb +22 -36
  44. data/lib/rubygems/commands/yank_command.rb +98 -0
  45. data/lib/rubygems/compatibility.rb +51 -0
  46. data/lib/rubygems/config_file.rb +82 -54
  47. data/lib/rubygems/core_ext/kernel_gem.rb +53 -0
  48. data/lib/rubygems/core_ext/kernel_require.rb +119 -0
  49. data/lib/rubygems/defaults.rb +10 -21
  50. data/lib/rubygems/dependency.rb +61 -10
  51. data/lib/rubygems/dependency_installer.rb +157 -69
  52. data/lib/rubygems/dependency_list.rb +11 -19
  53. data/lib/rubygems/dependency_resolver.rb +562 -0
  54. data/lib/rubygems/deprecate.rb +40 -40
  55. data/lib/rubygems/errors.rb +77 -24
  56. data/lib/rubygems/exceptions.rb +25 -7
  57. data/lib/rubygems/ext/builder.rb +20 -23
  58. data/lib/rubygems/ext/configure_builder.rb +2 -2
  59. data/lib/rubygems/ext/ext_conf_builder.rb +5 -45
  60. data/lib/rubygems/ext/rake_builder.rb +2 -2
  61. data/lib/rubygems/gem_runner.rb +3 -16
  62. data/lib/rubygems/gemcutter_utilities.rb +22 -7
  63. data/lib/rubygems/indexer.rb +6 -159
  64. data/lib/rubygems/install_message.rb +12 -0
  65. data/lib/rubygems/install_update_options.rb +56 -18
  66. data/lib/rubygems/installer.rb +244 -134
  67. data/lib/rubygems/installer_test_case.rb +71 -19
  68. data/lib/rubygems/mock_gem_ui.rb +17 -0
  69. data/lib/rubygems/name_tuple.rb +110 -0
  70. data/lib/rubygems/package.rb +514 -43
  71. data/lib/rubygems/package/digest_io.rb +64 -0
  72. data/lib/rubygems/package/old.rb +147 -0
  73. data/lib/rubygems/package/tar_header.rb +18 -55
  74. data/lib/rubygems/package/tar_reader.rb +20 -3
  75. data/lib/rubygems/package/tar_writer.rb +63 -7
  76. data/lib/rubygems/package_task.rb +3 -4
  77. data/lib/rubygems/path_support.rb +14 -7
  78. data/lib/rubygems/platform.rb +19 -26
  79. data/lib/rubygems/rdoc.rb +316 -0
  80. data/lib/rubygems/remote_fetcher.rb +117 -54
  81. data/lib/rubygems/request_set.rb +182 -0
  82. data/lib/rubygems/requirement.rb +63 -26
  83. data/lib/rubygems/security.rb +295 -555
  84. data/lib/rubygems/security/policies.rb +115 -0
  85. data/lib/rubygems/security/policy.rb +227 -0
  86. data/lib/rubygems/security/signer.rb +136 -0
  87. data/lib/rubygems/security/trust_dir.rb +104 -0
  88. data/lib/rubygems/server.rb +45 -55
  89. data/lib/rubygems/source.rb +144 -0
  90. data/lib/rubygems/source_list.rb +87 -0
  91. data/lib/rubygems/source_local.rb +92 -0
  92. data/lib/rubygems/source_specific_file.rb +28 -0
  93. data/lib/rubygems/spec_fetcher.rb +116 -184
  94. data/lib/rubygems/specification.rb +731 -335
  95. data/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem +88 -30
  96. data/lib/rubygems/ssl_certs/Entrust_net-Secure-Server-Certification-Authority.pem +90 -0
  97. data/lib/rubygems/ssl_certs/VerisignClass3PublicPrimaryCertificationAuthority-G2.pem +57 -0
  98. data/lib/rubygems/syck_hack.rb +2 -0
  99. data/lib/rubygems/test_case.rb +199 -109
  100. data/lib/rubygems/test_utilities.rb +25 -5
  101. data/lib/rubygems/uninstaller.rb +62 -20
  102. data/lib/rubygems/user_interaction.rb +10 -0
  103. data/lib/rubygems/validator.rb +33 -40
  104. data/lib/rubygems/version.rb +19 -8
  105. data/setup.rb +8 -1
  106. data/test/rubygems/alternate_cert.pem +9 -0
  107. data/test/rubygems/alternate_cert_32.pem +9 -0
  108. data/test/rubygems/alternate_key.pem +9 -0
  109. data/test/rubygems/bad_rake.rb +1 -0
  110. data/test/rubygems/child_cert.pem +9 -0
  111. data/test/rubygems/child_cert_32.pem +9 -0
  112. data/test/rubygems/child_key.pem +9 -0
  113. data/test/rubygems/data/null-type.gemspec.rz +0 -0
  114. data/test/rubygems/expired_cert.pem +9 -0
  115. data/test/rubygems/future_cert.pem +9 -0
  116. data/test/rubygems/future_cert_32.pem +9 -0
  117. data/test/rubygems/good_rake.rb +1 -0
  118. data/test/rubygems/grandchild_cert.pem +9 -0
  119. data/test/rubygems/grandchild_cert_32.pem +9 -0
  120. data/test/rubygems/grandchild_key.pem +9 -0
  121. data/test/rubygems/invalid_issuer_cert.pem +9 -0
  122. data/test/rubygems/invalid_issuer_cert_32.pem +9 -0
  123. data/test/rubygems/invalid_key.pem +9 -0
  124. data/test/rubygems/invalid_signer_cert.pem +9 -0
  125. data/test/rubygems/invalid_signer_cert_32.pem +9 -0
  126. data/test/rubygems/invalidchild_cert.pem +9 -0
  127. data/test/rubygems/invalidchild_cert_32.pem +9 -0
  128. data/test/rubygems/invalidchild_key.pem +9 -0
  129. data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
  130. data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
  131. data/test/rubygems/private_key.pem +7 -25
  132. data/test/rubygems/public_cert.pem +8 -18
  133. data/test/rubygems/public_cert_32.pem +10 -0
  134. data/test/rubygems/public_key.pem +4 -0
  135. data/test/rubygems/rubygems/commands/crash_command.rb +1 -1
  136. data/test/rubygems/test_config.rb +4 -6
  137. data/test/rubygems/test_deprecate.rb +76 -0
  138. data/test/rubygems/test_gem.rb +318 -83
  139. data/test/rubygems/test_gem_available_set.rb +106 -0
  140. data/test/rubygems/test_gem_command.rb +10 -0
  141. data/test/rubygems/test_gem_command_manager.rb +55 -9
  142. data/test/rubygems/test_gem_commands_build_command.rb +11 -19
  143. data/test/rubygems/test_gem_commands_cert_command.rb +441 -42
  144. data/test/rubygems/test_gem_commands_cleanup_command.rb +29 -1
  145. data/test/rubygems/test_gem_commands_contents_command.rb +23 -0
  146. data/test/rubygems/test_gem_commands_dependency_command.rb +5 -0
  147. data/test/rubygems/test_gem_commands_fetch_command.rb +19 -20
  148. data/test/rubygems/test_gem_commands_generate_index_command.rb +2 -83
  149. data/test/rubygems/test_gem_commands_help_command.rb +2 -1
  150. data/test/rubygems/test_gem_commands_install_command.rb +647 -48
  151. data/test/rubygems/test_gem_commands_mirror.rb +32 -0
  152. data/test/rubygems/test_gem_commands_owner_command.rb +4 -8
  153. data/test/rubygems/test_gem_commands_pristine_command.rb +99 -4
  154. data/test/rubygems/test_gem_commands_push_command.rb +62 -8
  155. data/test/rubygems/test_gem_commands_query_command.rb +51 -0
  156. data/test/rubygems/test_gem_commands_search_command.rb +25 -0
  157. data/test/rubygems/test_gem_commands_setup_command.rb +45 -0
  158. data/test/rubygems/test_gem_commands_sources_command.rb +21 -6
  159. data/test/rubygems/test_gem_commands_specification_command.rb +33 -1
  160. data/test/rubygems/test_gem_commands_uninstall_command.rb +91 -31
  161. data/test/rubygems/test_gem_commands_unpack_command.rb +3 -3
  162. data/test/rubygems/test_gem_commands_update_command.rb +56 -38
  163. data/test/rubygems/test_gem_commands_which_command.rb +4 -4
  164. data/test/rubygems/test_gem_commands_yank_command.rb +97 -0
  165. data/test/rubygems/test_gem_config_file.rb +66 -21
  166. data/test/rubygems/test_gem_dependency.rb +46 -0
  167. data/test/rubygems/test_gem_dependency_installer.rb +228 -18
  168. data/test/rubygems/test_gem_dependency_list.rb +0 -9
  169. data/test/rubygems/test_gem_dependency_resolver.rb +327 -0
  170. data/test/rubygems/test_gem_ext_configure_builder.rb +4 -4
  171. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +21 -49
  172. data/test/rubygems/test_gem_ext_rake_builder.rb +13 -13
  173. data/test/rubygems/test_gem_gem_runner.rb +27 -5
  174. data/test/rubygems/test_gem_gemcutter_utilities.rb +19 -0
  175. data/test/rubygems/test_gem_indexer.rb +14 -227
  176. data/test/rubygems/test_gem_install_update_options.rb +83 -3
  177. data/test/rubygems/test_gem_installer.rb +211 -236
  178. data/test/rubygems/test_gem_local_remote_options.rb +8 -2
  179. data/test/rubygems/test_gem_name_tuple.rb +15 -0
  180. data/test/rubygems/test_gem_package.rb +547 -0
  181. data/test/rubygems/test_gem_package_old.rb +37 -0
  182. data/test/rubygems/test_gem_package_tar_reader.rb +32 -0
  183. data/test/rubygems/test_gem_package_tar_writer.rb +84 -1
  184. data/test/rubygems/test_gem_path_support.rb +4 -30
  185. data/test/rubygems/test_gem_platform.rb +3 -6
  186. data/test/rubygems/test_gem_rdoc.rb +245 -0
  187. data/test/rubygems/test_gem_remote_fetcher.rb +51 -5
  188. data/test/rubygems/test_gem_request_set.rb +70 -0
  189. data/test/rubygems/test_gem_requirement.rb +53 -24
  190. data/test/rubygems/test_gem_security.rb +189 -43
  191. data/test/rubygems/test_gem_security_policy.rb +376 -0
  192. data/test/rubygems/test_gem_security_signer.rb +184 -0
  193. data/test/rubygems/test_gem_security_trust_dir.rb +94 -0
  194. data/test/rubygems/test_gem_server.rb +31 -36
  195. data/test/rubygems/test_gem_silent_ui.rb +2 -2
  196. data/test/rubygems/test_gem_source.rb +188 -0
  197. data/test/rubygems/test_gem_source_list.rb +87 -0
  198. data/test/rubygems/test_gem_source_local.rb +83 -0
  199. data/test/rubygems/test_gem_source_specific_file.rb +33 -0
  200. data/test/rubygems/test_gem_spec_fetcher.rb +91 -255
  201. data/test/rubygems/test_gem_specification.rb +293 -39
  202. data/test/rubygems/test_gem_uninstaller.rb +136 -13
  203. data/test/rubygems/test_gem_validator.rb +14 -41
  204. data/test/rubygems/test_gem_version.rb +15 -21
  205. data/test/rubygems/test_require.rb +193 -0
  206. data/test/rubygems/wrong_key_cert.pem +9 -0
  207. data/test/rubygems/wrong_key_cert_32.pem +9 -0
  208. metadata +171 -83
  209. metadata.gz.sig +1 -0
  210. data/CVE-2013-4287.txt +0 -36
  211. data/CVE-2013-4363.txt +0 -45
  212. data/ci_build.sh +0 -27
  213. data/cruise_config.rb +0 -32
  214. data/lib/rbconfig/datadir.rb +0 -13
  215. data/lib/rubygems/builder.rb +0 -99
  216. data/lib/rubygems/custom_require.rb +0 -69
  217. data/lib/rubygems/doc_manager.rb +0 -243
  218. data/lib/rubygems/format.rb +0 -82
  219. data/lib/rubygems/gem_openssl.rb +0 -90
  220. data/lib/rubygems/gem_path_searcher.rb +0 -172
  221. data/lib/rubygems/old_format.rb +0 -153
  222. data/lib/rubygems/package/f_sync_dir.rb +0 -23
  223. data/lib/rubygems/package/tar_input.rb +0 -234
  224. data/lib/rubygems/package/tar_output.rb +0 -146
  225. data/lib/rubygems/require_paths_builder.rb +0 -18
  226. data/lib/rubygems/source_index.rb +0 -406
  227. data/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
  228. data/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
  229. data/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
  230. data/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
  231. data/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem +0 -20
  232. data/test/rubygems/test_bundled_ca.rb +0 -59
  233. data/test/rubygems/test_gem_builder.rb +0 -44
  234. data/test/rubygems/test_gem_doc_manager.rb +0 -32
  235. data/test/rubygems/test_gem_ext_builder.rb +0 -58
  236. data/test/rubygems/test_gem_format.rb +0 -88
  237. data/test/rubygems/test_gem_gem_path_searcher.rb +0 -94
  238. data/test/rubygems/test_gem_package_tar_input.rb +0 -129
  239. data/test/rubygems/test_gem_package_tar_output.rb +0 -101
  240. data/test/rubygems/test_gem_source_index.rb +0 -250
  241. data/util/update_bundled_ca_certificates.rb +0 -103
@@ -71,14 +71,9 @@ class Gem::Commands::DependencyCommand < Gem::Command
71
71
  if remote? and not options[:reverse_dependencies] then
72
72
  fetcher = Gem::SpecFetcher.fetcher
73
73
 
74
- # REFACTOR: fetcher.find_specs_matching => specs
75
- specs_and_sources = fetcher.find_matching(dependency,
76
- dependency.specific?, true,
77
- dependency.prerelease?)
78
-
79
- specs.concat specs_and_sources.map { |spec_tuple, source_uri|
80
- fetcher.fetch_spec spec_tuple, URI.parse(source_uri)
81
- }
74
+ ss, _ = fetcher.spec_for_dependency dependency
75
+
76
+ ss.each { |s,o| specs << s }
82
77
  end
83
78
 
84
79
  if specs.empty? then
@@ -24,33 +24,38 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
24
24
  The RubyGems environment can be controlled through command line arguments,
25
25
  gemrc files, environment variables and built-in defaults.
26
26
 
27
- Command line argument defaults and some RubyGems defaults can be set in
28
- ~/.gemrc file for individual users and a /etc/gemrc for all users. A gemrc
29
- is a YAML file with the following YAML keys:
27
+ Command line argument defaults and some RubyGems defaults can be set in a
28
+ ~/.gemrc file for individual users and a /etc/gemrc for all users. These
29
+ files are YAML files with the following YAML keys:
30
30
 
31
31
  :sources: A YAML array of remote gem repositories to install gems from
32
- :verbose: Verbosity of the gem command. false, true, and :really are the
32
+ :verbose: Verbosity of the gem command. false, true, and :really are the
33
33
  levels
34
34
  :update_sources: Enable/disable automatic updating of repository metadata
35
35
  :backtrace: Print backtrace when RubyGems encounters an error
36
36
  :gempath: The paths in which to look for gems
37
- gem_command: A string containing arguments for the specified gem command
37
+ :disable_default_gem_server: Force specification of gem server host on push
38
+ <gem_command>: A string containing arguments for the specified gem command
38
39
 
39
40
  Example:
40
41
 
41
42
  :verbose: false
42
43
  install: --no-wrappers
43
44
  update: --no-wrappers
45
+ :disable_default_gem_server: true
44
46
 
45
47
  RubyGems' default local repository can be overridden with the GEM_PATH and
46
- GEM_HOME environment variables. GEM_HOME sets the default repository to
47
- install into. GEM_PATH allows multiple local repositories to be searched for
48
+ GEM_HOME environment variables. GEM_HOME sets the default repository to
49
+ install into. GEM_PATH allows multiple local repositories to be searched for
48
50
  gems.
49
51
 
50
52
  If you are behind a proxy server, RubyGems uses the HTTP_PROXY,
51
53
  HTTP_PROXY_USER and HTTP_PROXY_PASS environment variables to discover the
52
54
  proxy server.
53
55
 
56
+ If you would like to push gems to a private gem server the RUBYGEMS_HOST
57
+ environment variable can be set to the URI for that server.
58
+
54
59
  If you are packaging RubyGems all of RubyGems' defaults are in
55
60
  lib/rubygems/defaults.rb. You may override these in
56
61
  lib/rubygems/defaults/operating_system.rb
@@ -74,7 +79,7 @@ lib/rubygems/defaults/operating_system.rb
74
79
  when /^gempath/, /^path/, /^GEM_PATH/ then
75
80
  out << Gem.path.join(File::PATH_SEPARATOR)
76
81
  when /^remotesources/ then
77
- out << Gem.sources.join("\n")
82
+ out << Gem.sources.to_a.join("\n")
78
83
  when /^platform/ then
79
84
  out << Gem.platforms.join(File::PATH_SEPARATOR)
80
85
  when nil then
@@ -34,7 +34,6 @@ class Gem::Commands::FetchCommand < Gem::Command
34
34
 
35
35
  def execute
36
36
  version = options[:version] || Gem::Requirement.default
37
- all = Gem::Requirement.default != version
38
37
 
39
38
  platform = Gem.platforms.last
40
39
  gem_names = get_all_gem_names
@@ -43,32 +42,20 @@ class Gem::Commands::FetchCommand < Gem::Command
43
42
  dep = Gem::Dependency.new gem_name, version
44
43
  dep.prerelease = options[:prerelease]
45
44
 
46
- specs_and_sources, errors =
47
- Gem::SpecFetcher.fetcher.fetch_with_errors(dep, all, true,
48
- dep.prerelease?)
49
-
45
+ specs_and_sources, errors = Gem::SpecFetcher.fetcher.spec_for_dependency dep
50
46
  if platform then
51
47
  filtered = specs_and_sources.select { |s,| s.platform == platform }
52
48
  specs_and_sources = filtered unless filtered.empty?
53
49
  end
54
50
 
55
- spec, source_uri = specs_and_sources.sort_by { |s,| s.version }.last
51
+ spec, source = specs_and_sources.sort_by { |s,| s.version }.first
56
52
 
57
53
  if spec.nil? then
58
54
  show_lookup_failure gem_name, version, errors, options[:domain]
59
55
  next
60
56
  end
61
57
 
62
- file = "#{spec.full_name}.gem"
63
- remote_path = URI.parse(source_uri) + "gems/#{file}"
64
-
65
- fetch = Gem::RemoteFetcher.fetcher
66
-
67
- gem = fetch.fetch_path remote_path.to_s
68
-
69
- File.open file, "wb" do |f|
70
- f.write gem
71
- end
58
+ source.download spec
72
59
 
73
60
  say "Downloaded #{spec.full_name}"
74
61
  end
@@ -11,29 +11,16 @@ class Gem::Commands::GenerateIndexCommand < Gem::Command
11
11
  def initialize
12
12
  super 'generate_index',
13
13
  'Generates the index files for a gem server directory',
14
- :directory => '.', :build_legacy => true, :build_modern => true
14
+ :directory => '.', :build_modern => true
15
15
 
16
16
  add_option '-d', '--directory=DIRNAME',
17
17
  'repository base dir containing gems subdir' do |dir, options|
18
18
  options[:directory] = File.expand_path dir
19
19
  end
20
20
 
21
- add_option '--[no-]legacy',
22
- 'Generate Marshal.4.8' do |value, options|
23
- unless options[:build_modern] or value then
24
- raise OptionParser::InvalidOption, 'no indicies will be built'
25
- end
26
-
27
- options[:build_legacy] = value
28
- end
29
-
30
21
  add_option '--[no-]modern',
31
- 'Generate indexes for RubyGems newer',
32
- 'than 1.2.0' do |value, options|
33
- unless options[:build_legacy] or value then
34
- raise OptionParser::InvalidOption, 'no indicies will be built'
35
- end
36
-
22
+ 'Generate indexes for RubyGems',
23
+ '(always true)' do |value, options|
37
24
  options[:build_modern] = value
38
25
  end
39
26
 
@@ -42,27 +29,10 @@ class Gem::Commands::GenerateIndexCommand < Gem::Command
42
29
  'since the last update' do |value, options|
43
30
  options[:update] = value
44
31
  end
45
-
46
- add_option :RSS, '--rss-gems-host=GEM_HOST',
47
- 'Host name where gems are served from,',
48
- 'used for GUID and enclosure values' do |value, options|
49
- options[:rss_gems_host] = value
50
- end
51
-
52
- add_option :RSS, '--rss-host=HOST',
53
- 'Host name for more gems information,',
54
- 'used for RSS feed link' do |value, options|
55
- options[:rss_host] = value
56
- end
57
-
58
- add_option :RSS, '--rss-title=TITLE',
59
- 'Set title for RSS feed' do |value, options|
60
- options[:rss_title] = value
61
- end
62
32
  end
63
33
 
64
34
  def defaults_str # :nodoc:
65
- "--directory . --legacy --modern"
35
+ "--directory . --modern"
66
36
  end
67
37
 
68
38
  def description # :nodoc:
@@ -85,25 +55,15 @@ When done, it will generate a set of files like this:
85
55
  prerelease_specs.<version>.gz # prerelease specs index
86
56
  quick/Marshal.<version>/<gemname>.gemspec.rz # Marshal quick index file
87
57
 
88
- # these files support legacy RubyGems
89
- Marshal.<version>
90
- Marshal.<version>.Z # Marshal full index
91
-
92
- The .Z and .rz extension files are compressed with the inflate algorithm.
58
+ The .rz extension files are compressed with the inflate algorithm.
93
59
  The Marshal version number comes from ruby's Marshal::MAJOR_VERSION and
94
60
  Marshal::MINOR_VERSION constants. It is used to ensure compatibility.
95
-
96
- If --rss-host and --rss-gem-host are given an RSS feed will be generated at
97
- index.rss containing gems released in the last two days.
98
61
  EOF
99
62
  end
100
63
 
101
64
  def execute
102
- if options[:update] and
103
- (options[:rss_host] or options[:rss_gems_host]) then
104
- alert_error '--update not compatible with RSS generation'
105
- terminate_interaction 1
106
- end
65
+ # This is always true becasue it's the only way now.
66
+ options[:build_modern] = true
107
67
 
108
68
  if not File.exist?(options[:directory]) or
109
69
  not File.directory?(options[:directory]) then
@@ -37,7 +37,7 @@ Some examples of 'gem' usage.
37
37
 
38
38
  * Create a gem:
39
39
 
40
- See http://rubygems.rubyforge.org/wiki/wiki.pl?CreateAGemInTenMinutes
40
+ See http://guides.rubygems.org/make-your-own-gem/
41
41
 
42
42
  * See information about RubyGems:
43
43
 
@@ -1,10 +1,11 @@
1
1
  require 'rubygems/command'
2
- require 'rubygems/doc_manager'
3
2
  require 'rubygems/install_update_options'
4
3
  require 'rubygems/dependency_installer'
5
4
  require 'rubygems/local_remote_options'
6
5
  require 'rubygems/validator'
7
6
  require 'rubygems/version_option'
7
+ require 'rubygems/install_message' # must come before rdoc for messaging
8
+ require 'rubygems/rdoc'
8
9
 
9
10
  ##
10
11
  # Gem installer command line tool
@@ -13,14 +14,14 @@ require 'rubygems/version_option'
13
14
 
14
15
  class Gem::Commands::InstallCommand < Gem::Command
15
16
 
17
+ attr_reader :installed_specs # :nodoc:
18
+
16
19
  include Gem::VersionOption
17
20
  include Gem::LocalRemoteOptions
18
21
  include Gem::InstallUpdateOptions
19
22
 
20
23
  def initialize
21
24
  defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
22
- :generate_rdoc => true,
23
- :generate_ri => true,
24
25
  :format_executable => false,
25
26
  :version => Gem::Requirement.default,
26
27
  })
@@ -32,6 +33,14 @@ class Gem::Commands::InstallCommand < Gem::Command
32
33
  add_platform_option
33
34
  add_version_option
34
35
  add_prerelease_option "to be installed. (Only for listed gems)"
36
+
37
+ add_option(:"Install/Update", '-g', '--file FILE',
38
+ 'Read from a gem dependencies API file and',
39
+ 'install the listed gems') do |v,o|
40
+ o[:gemdeps] = v
41
+ end
42
+
43
+ @installed_specs = nil
35
44
  end
36
45
 
37
46
  def arguments # :nodoc:
@@ -39,7 +48,7 @@ class Gem::Commands::InstallCommand < Gem::Command
39
48
  end
40
49
 
41
50
  def defaults_str # :nodoc:
42
- "--both --version '#{Gem::Requirement.default}' --rdoc --ri --no-force\n" \
51
+ "--both --version '#{Gem::Requirement.default}' --document --no-force\n" \
43
52
  "--install-dir #{Gem.dir}"
44
53
  end
45
54
 
@@ -100,31 +109,73 @@ to write the specification by hand. For example:
100
109
  "#{program_name} GEMNAME [GEMNAME ...] [options] -- --build-flags"
101
110
  end
102
111
 
112
+ def install_from_gemdeps(gf)
113
+ require 'rubygems/request_set'
114
+ rs = Gem::RequestSet.new
115
+ rs.load_gemdeps gf
116
+
117
+ rs.resolve
118
+
119
+ specs = rs.install options do |req, inst|
120
+ s = req.full_spec
121
+
122
+ if inst
123
+ say "Installing #{s.name} (#{s.version})"
124
+ else
125
+ say "Using #{s.name} (#{s.version})"
126
+ end
127
+ end
128
+
129
+ @installed_specs = specs
130
+
131
+ raise Gem::SystemExitException, 0
132
+ end
133
+
103
134
  def execute
104
- if options[:include_dependencies] then
105
- alert "`gem install -y` is now default and will be removed"
106
- alert "use --ignore-dependencies to install only the gems you list"
135
+ if gf = options[:gemdeps] then
136
+ install_from_gemdeps gf
137
+ return
107
138
  end
108
139
 
109
- installed_gems = []
140
+ @installed_specs = []
110
141
 
111
142
  ENV.delete 'GEM_PATH' if options[:install_dir].nil? and RUBY_VERSION > '1.9'
112
143
 
144
+ if options[:install_dir] and options[:user_install]
145
+ alert_error "Use --install-dir or --user-install but not both"
146
+ terminate_interaction 1
147
+ end
148
+
113
149
  exit_code = 0
114
150
 
115
- get_all_gem_names.each do |gem_name|
151
+ if options[:version] != Gem::Requirement.default &&
152
+ get_all_gem_names.size > 1 then
153
+ alert_error "Can't use --version w/ multiple gems. Use name:ver instead."
154
+ terminate_interaction 1
155
+ end
156
+
157
+
158
+ get_all_gem_names_and_versions.each do |gem_name, gem_version|
159
+ gem_version ||= options[:version]
160
+
116
161
  begin
117
162
  next if options[:conservative] and
118
- not Gem::Dependency.new(gem_name, options[:version]).matching_specs.empty?
163
+ not Gem::Dependency.new(gem_name, gem_version).matching_specs.empty?
119
164
 
120
165
  inst = Gem::DependencyInstaller.new options
121
- inst.install gem_name, options[:version]
166
+ inst.install gem_name, Gem::Requirement.create(gem_version)
122
167
 
123
- inst.installed_gems.each do |spec|
124
- say "Successfully installed #{spec.full_name}"
125
- end
168
+ @installed_specs.push(*inst.installed_gems)
126
169
 
127
- installed_gems.push(*inst.installed_gems)
170
+ next unless errs = inst.errors
171
+
172
+ errs.each do |x|
173
+ next unless Gem::SourceFetchProblem === x
174
+
175
+ msg = "Unable to pull data from '#{x.source.uri}': #{x.error.message}"
176
+
177
+ alert_warning msg
178
+ end
128
179
  rescue Gem::InstallError => e
129
180
  alert_error "Error installing #{gem_name}:\n\t#{e.message}"
130
181
  exit_code |= 1
@@ -135,27 +186,9 @@ to write the specification by hand. For example:
135
186
  end
136
187
  end
137
188
 
138
- unless installed_gems.empty? then
139
- gems = installed_gems.length == 1 ? 'gem' : 'gems'
140
- say "#{installed_gems.length} #{gems} installed"
141
-
142
- # NOTE: *All* of the RI documents must be generated first. For some
143
- # reason, RI docs cannot be generated after any RDoc documents are
144
- # generated.
145
-
146
- if options[:generate_ri] then
147
- installed_gems.each do |gem|
148
- Gem::DocManager.new(gem, options[:rdoc_args]).generate_ri
149
- end
150
-
151
- Gem::DocManager.update_ri_cache
152
- end
153
-
154
- if options[:generate_rdoc] then
155
- installed_gems.each do |gem|
156
- Gem::DocManager.new(gem, options[:rdoc_args]).generate_rdoc
157
- end
158
- end
189
+ unless @installed_specs.empty? then
190
+ gems = @installed_specs.length == 1 ? 'gem' : 'gems'
191
+ say "#{@installed_specs.length} #{gems} installed"
159
192
  end
160
193
 
161
194
  raise Gem::SystemExitException, exit_code
@@ -7,8 +7,9 @@ require 'rubygems/commands/query_command'
7
7
 
8
8
  class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
9
9
 
10
- def initialize
11
- super 'list', 'Display gems whose name starts with STRING'
10
+ def initialize(name = 'list',
11
+ summary = 'Display gems whose name starts with STRING')
12
+ super name, summary
12
13
 
13
14
  remove_option('--name-matches')
14
15
  end
@@ -26,8 +27,9 @@ class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
26
27
  end
27
28
 
28
29
  def execute
29
- string = get_one_optional_argument || ''
30
- options[:name] = /^#{string}/i
30
+ name = get_one_optional_argument || ''
31
+ options[:name] = /^#{name}/i
32
+
31
33
  super
32
34
  end
33
35
 
@@ -30,7 +30,7 @@ generated.
30
30
 
31
31
  Example:
32
32
 
33
- gemlock rails-1.0.0 > lockdown.rb
33
+ gem lock rails-1.0.0 > lockdown.rb
34
34
 
35
35
  will produce in lockdown.rb:
36
36
 
@@ -0,0 +1,17 @@
1
+ require 'rubygems/command'
2
+
3
+ class Gem::Commands::MirrorCommand < Gem::Command
4
+ def initialize
5
+ super('mirror', 'Mirror all gem files (requires rubygems-mirror)')
6
+ begin
7
+ Gem::Specification.find_by_name('rubygems-mirror').activate
8
+ rescue Gem::LoadError
9
+ # no-op
10
+ end
11
+ end
12
+
13
+ def execute
14
+ alert_error "Install the rubygems-mirror gem for the mirror command"
15
+ end
16
+
17
+ end
@@ -19,12 +19,15 @@ class Gem::Commands::OutdatedCommand < Gem::Command
19
19
  Gem::Specification.outdated.sort.each do |name|
20
20
  local = Gem::Specification.find_all_by_name(name).max
21
21
  dep = Gem::Dependency.new local.name, ">= #{local.version}"
22
- remotes = Gem::SpecFetcher.fetcher.fetch dep
22
+ remotes, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dep
23
23
 
24
24
  next if remotes.empty?
25
25
 
26
- remote = remotes.last.first
27
- say "#{local.name} (#{local.version} < #{remote.version})"
26
+ remotes.sort! { |a,b| a[0].version <=> b[0].version }
27
+
28
+ highest = remotes.last.first
29
+
30
+ say "#{local.name} (#{local.version} < #{highest.version})"
28
31
  end
29
32
  end
30
33
  end